| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 return kCannotFindProjectRootDir; | 131 return kCannotFindProjectRootDir; |
| 132 } | 132 } |
| 133 if (relative_dir_path_set) { | 133 if (relative_dir_path_set) { |
| 134 path = path + kPathDelimiter + relative_dir_path; | 134 path = path + kPathDelimiter + relative_dir_path; |
| 135 } | 135 } |
| 136 path = path + kPathDelimiter + ".." + kPathDelimiter + ".."; | 136 path = path + kPathDelimiter + ".." + kPathDelimiter + ".."; |
| 137 char canonical_path[FILENAME_MAX]; | 137 char canonical_path[FILENAME_MAX]; |
| 138 #ifdef WIN32 | 138 #ifdef WIN32 |
| 139 BOOL succeeded = PathCanonicalizeA(canonical_path, path.c_str()); | 139 BOOL succeeded = PathCanonicalizeA(canonical_path, path.c_str()); |
| 140 #else | 140 #else |
| 141 bool succeeded = realpath(path.c_str(), canonical_path) != NULL; | 141 bool succeeded = realpath(path.c_str(), canonical_path) != nullptr; |
| 142 #endif | 142 #endif |
| 143 if (succeeded) { | 143 if (succeeded) { |
| 144 path = std::string(canonical_path) + kPathDelimiter; | 144 path = std::string(canonical_path) + kPathDelimiter; |
| 145 return path; | 145 return path; |
| 146 } else { | 146 } else { |
| 147 fprintf(stderr, "Cannot find project root directory!\n"); | 147 fprintf(stderr, "Cannot find project root directory!\n"); |
| 148 return kCannotFindProjectRootDir; | 148 return kCannotFindProjectRootDir; |
| 149 } | 149 } |
| 150 #endif | 150 #endif |
| 151 } | 151 } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 } | 267 } |
| 268 | 268 |
| 269 // Fall back on name without architecture or platform. | 269 // Fall back on name without architecture or platform. |
| 270 return resources_path + name + "." + extension; | 270 return resources_path + name + "." + extension; |
| 271 #endif // defined (WEBRTC_IOS) | 271 #endif // defined (WEBRTC_IOS) |
| 272 } | 272 } |
| 273 | 273 |
| 274 size_t GetFileSize(const std::string& filename) { | 274 size_t GetFileSize(const std::string& filename) { |
| 275 FILE* f = fopen(filename.c_str(), "rb"); | 275 FILE* f = fopen(filename.c_str(), "rb"); |
| 276 size_t size = 0; | 276 size_t size = 0; |
| 277 if (f != NULL) { | 277 if (f != nullptr) { |
| 278 if (fseek(f, 0, SEEK_END) == 0) { | 278 if (fseek(f, 0, SEEK_END) == 0) { |
| 279 size = ftell(f); | 279 size = ftell(f); |
| 280 } | 280 } |
| 281 fclose(f); | 281 fclose(f); |
| 282 } | 282 } |
| 283 return size; | 283 return size; |
| 284 } | 284 } |
| 285 | 285 |
| 286 } // namespace test | 286 } // namespace test |
| 287 } // namespace webrtc | 287 } // namespace webrtc |
| OLD | NEW |