OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 FILE* file = fopen(name, "rb"); | 198 FILE* file = fopen(name, "rb"); |
199 if (file == NULL) return v8::Handle<v8::String>(); | 199 if (file == NULL) return v8::Handle<v8::String>(); |
200 | 200 |
201 fseek(file, 0, SEEK_END); | 201 fseek(file, 0, SEEK_END); |
202 int size = ftell(file); | 202 int size = ftell(file); |
203 rewind(file); | 203 rewind(file); |
204 | 204 |
205 char* chars = new char[size + 1]; | 205 char* chars = new char[size + 1]; |
206 chars[size] = '\0'; | 206 chars[size] = '\0'; |
207 for (int i = 0; i < size;) { | 207 for (int i = 0; i < size;) { |
208 int read = fread(&chars[i], 1, size - i, file); | 208 int read = static_cast<int>(fread(&chars[i], 1, size - i, file)); |
209 i += read; | 209 i += read; |
210 } | 210 } |
211 fclose(file); | 211 fclose(file); |
212 v8::Handle<v8::String> result = v8::String::New(chars, size); | 212 v8::Handle<v8::String> result = v8::String::New(chars, size); |
213 delete[] chars; | 213 delete[] chars; |
214 return result; | 214 return result; |
215 } | 215 } |
216 | 216 |
217 | 217 |
218 // Process remaining command line arguments and execute files | 218 // Process remaining command line arguments and execute files |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 printf("^"); | 331 printf("^"); |
332 } | 332 } |
333 printf("\n"); | 333 printf("\n"); |
334 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); | 334 v8::String::Utf8Value stack_trace(try_catch->StackTrace()); |
335 if (stack_trace.length() > 0) { | 335 if (stack_trace.length() > 0) { |
336 const char* stack_trace_string = ToCString(stack_trace); | 336 const char* stack_trace_string = ToCString(stack_trace); |
337 printf("%s\n", stack_trace_string); | 337 printf("%s\n", stack_trace_string); |
338 } | 338 } |
339 } | 339 } |
340 } | 340 } |
OLD | NEW |