Index: src/snapshot/mksnapshot.cc |
diff --git a/src/snapshot/mksnapshot.cc b/src/snapshot/mksnapshot.cc |
index 79c1643fb810ed6d7f3eda64942b6d475ad93d33..f44eca523a8d3e0660ca332ce1aa3dc73599b626 100644 |
--- a/src/snapshot/mksnapshot.cc |
+++ b/src/snapshot/mksnapshot.cc |
@@ -118,13 +118,13 @@ char* GetExtraCode(char* filename) { |
exit(1); |
} |
fseek(file, 0, SEEK_END); |
- int size = ftell(file); |
+ size_t size = ftell(file); |
rewind(file); |
char* chars = new char[size + 1]; |
chars[size] = '\0'; |
- for (int i = 0; i < size;) { |
- int read = static_cast<int>(fread(&chars[i], 1, size - i, file)); |
- if (read < 0) { |
+ for (size_t i = 0; i < size;) { |
+ size_t read = fread(&chars[i], 1, size - i, file); |
+ if (ferror(file)) { |
fprintf(stderr, "Failed to read '%s': errno %d\n", filename, errno); |
exit(1); |
} |