| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkOSFile.h" | 8 #include "SkOSFile.h" |
| 9 #include "SkString.h" | 9 #include "SkString.h" |
| 10 #include "SkTFitsIn.h" | 10 #include "SkTFitsIn.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 return sk_fdmmap(fd, size); | 95 return sk_fdmmap(fd, size); |
| 96 } | 96 } |
| 97 | 97 |
| 98 //////////////////////////////////////////////////////////////////////////// | 98 //////////////////////////////////////////////////////////////////////////// |
| 99 | 99 |
| 100 struct SkOSFileIterData { | 100 struct SkOSFileIterData { |
| 101 SkOSFileIterData() : fDIR(0) { } | 101 SkOSFileIterData() : fDIR(0) { } |
| 102 DIR* fDIR; | 102 DIR* fDIR; |
| 103 SkString fPath, fSuffix; | 103 SkString fPath, fSuffix; |
| 104 }; | 104 }; |
| 105 SK_COMPILE_ASSERT(sizeof(SkOSFileIterData) <= SkOSFile::Iter::kStorageSize, not_
enough_space); | 105 static_assert(sizeof(SkOSFileIterData) <= SkOSFile::Iter::kStorageSize, "not_eno
ugh_space"); |
| 106 | 106 |
| 107 SkOSFile::Iter::Iter() { | 107 SkOSFile::Iter::Iter() { |
| 108 SkNEW_PLACEMENT(fSelf.get(), SkOSFileIterData); | 108 SkNEW_PLACEMENT(fSelf.get(), SkOSFileIterData); |
| 109 } | 109 } |
| 110 | 110 |
| 111 SkOSFile::Iter::Iter(const char path[], const char suffix[]) { | 111 SkOSFile::Iter::Iter(const char path[], const char suffix[]) { |
| 112 SkNEW_PLACEMENT(fSelf.get(), SkOSFileIterData); | 112 SkNEW_PLACEMENT(fSelf.get(), SkOSFileIterData); |
| 113 this->reset(path, suffix); | 113 this->reset(path, suffix); |
| 114 } | 114 } |
| 115 | 115 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 } | 174 } |
| 175 if (entry) { // we broke out with a file | 175 if (entry) { // we broke out with a file |
| 176 if (name) { | 176 if (name) { |
| 177 name->set(entry->d_name); | 177 name->set(entry->d_name); |
| 178 } | 178 } |
| 179 return true; | 179 return true; |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 return false; | 182 return false; |
| 183 } | 183 } |
| OLD | NEW |