Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: src/utils.h

Issue 18583: Change type of snapshot from char array to byte array to avoid portability pr... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/snapshot-empty.cc ('k') | src/utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 217
218 // Our version of fflush. 218 // Our version of fflush.
219 void Flush(); 219 void Flush();
220 220
221 221
222 // Read a line of characters after printing the prompt to stdout. The resulting 222 // Read a line of characters after printing the prompt to stdout. The resulting
223 // char* needs to be disposed off with DeleteArray by the caller. 223 // char* needs to be disposed off with DeleteArray by the caller.
224 char* ReadLine(const char* prompt); 224 char* ReadLine(const char* prompt);
225 225
226 226
227 // Read and return the raw chars in a file. the size of the buffer is returned 227 // Read and return the raw bytes in a file. the size of the buffer is returned
228 // in size. 228 // in size.
229 // The returned buffer is not 0-terminated. It must be freed by the caller. 229 // The returned buffer must be freed by the caller.
230 char* ReadChars(const char* filename, int* size, bool verbose = true); 230 byte* ReadBytes(const char* filename, int* size, bool verbose = true);
231 231
232 232
233 // Write size chars from str to the file given by filename. 233 // Write size chars from str to the file given by filename.
234 // The file is overwritten. Returns the number of chars written. 234 // The file is overwritten. Returns the number of chars written.
235 int WriteChars(const char* filename, 235 int WriteChars(const char* filename,
236 const char* str, 236 const char* str,
237 int size, 237 int size,
238 bool verbose = true); 238 bool verbose = true);
239 239
240 240
241 // Write size bytes to the file given by filename.
242 // The file is overwritten. Returns the number of bytes written.
243 int WriteBytes(const char* filename,
244 const byte* bytes,
245 int size,
246 bool verbose = true);
247
248
241 // Write the C code 249 // Write the C code
242 // const char* <varname> = "<str>"; 250 // const char* <varname> = "<str>";
243 // const int <varname>_len = <len>; 251 // const int <varname>_len = <len>;
244 // to the file given by filename. Only the first len chars are written. 252 // to the file given by filename. Only the first len chars are written.
245 int WriteAsCFile(const char* filename, const char* varname, 253 int WriteAsCFile(const char* filename, const char* varname,
246 const char* str, int size, bool verbose = true); 254 const char* str, int size, bool verbose = true);
247 255
248 256
249 // ---------------------------------------------------------------------------- 257 // ----------------------------------------------------------------------------
250 // Miscellaneous 258 // Miscellaneous
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 #endif 531 #endif
524 while (dest < limit) { 532 while (dest < limit) {
525 *dest++ = static_cast<sinkchar>(*src++); 533 *dest++ = static_cast<sinkchar>(*src++);
526 } 534 }
527 } 535 }
528 536
529 537
530 } } // namespace v8::internal 538 } } // namespace v8::internal
531 539
532 #endif // V8_UTILS_H_ 540 #endif // V8_UTILS_H_
OLDNEW
« no previous file with comments | « src/snapshot-empty.cc ('k') | src/utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698