| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdarg.h> | 5 #include <stdarg.h> |
| 6 #include <sys/stat.h> | 6 #include <sys/stat.h> |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/base/functional.h" | 10 #include "src/base/functional.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 bool verbose, | 196 bool verbose, |
| 197 const char* filename) { | 197 const char* filename) { |
| 198 if (file == NULL || fseek(file, 0, SEEK_END) != 0) { | 198 if (file == NULL || fseek(file, 0, SEEK_END) != 0) { |
| 199 if (verbose) { | 199 if (verbose) { |
| 200 base::OS::PrintError("Cannot read from file %s.\n", filename); | 200 base::OS::PrintError("Cannot read from file %s.\n", filename); |
| 201 } | 201 } |
| 202 return NULL; | 202 return NULL; |
| 203 } | 203 } |
| 204 | 204 |
| 205 // Get the size of the file and rewind it. | 205 // Get the size of the file and rewind it. |
| 206 *size = ftell(file); | 206 *size = static_cast<int>(ftell(file)); |
| 207 rewind(file); | 207 rewind(file); |
| 208 | 208 |
| 209 char* result = NewArray<char>(*size + extra_space); | 209 char* result = NewArray<char>(*size + extra_space); |
| 210 for (int i = 0; i < *size && feof(file) == 0;) { | 210 for (int i = 0; i < *size && feof(file) == 0;) { |
| 211 int read = static_cast<int>(fread(&result[i], 1, *size - i, file)); | 211 int read = static_cast<int>(fread(&result[i], 1, *size - i, file)); |
| 212 if (read != (*size - i) && ferror(file) != 0) { | 212 if (read != (*size - i) && ferror(file) != 0) { |
| 213 fclose(file); | 213 fclose(file); |
| 214 DeleteArray(result); | 214 DeleteArray(result); |
| 215 return NULL; | 215 return NULL; |
| 216 } | 216 } |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 } | 420 } |
| 421 if (u.bits.exp == 0) { | 421 if (u.bits.exp == 0) { |
| 422 // Detect +0, and -0 for IEEE double precision floating point. | 422 // Detect +0, and -0 for IEEE double precision floating point. |
| 423 if ((u.bits.man_low | u.bits.man_high) == 0) return false; | 423 if ((u.bits.man_low | u.bits.man_high) == 0) return false; |
| 424 } | 424 } |
| 425 return true; | 425 return true; |
| 426 } | 426 } |
| 427 | 427 |
| 428 | 428 |
| 429 } } // namespace v8::internal | 429 } } // namespace v8::internal |
| OLD | NEW |