| OLD | NEW |
| 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 } | 232 } |
| 233 | 233 |
| 234 | 234 |
| 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) { | 238 bool verbose) { |
| 239 FILE* f = OS::FOpen(filename, "wb"); | 239 FILE* f = OS::FOpen(filename, "wb"); |
| 240 if (f == NULL) { | 240 if (f == NULL) { |
| 241 if (verbose) { | 241 if (verbose) { |
| 242 OS::PrintError("Cannot open file %s for reading.\n", filename); | 242 OS::PrintError("Cannot open file %s for writing.\n", filename); |
| 243 } | 243 } |
| 244 return 0; | 244 return 0; |
| 245 } | 245 } |
| 246 int written = WriteCharsToFile(str, size, f); | 246 int written = WriteCharsToFile(str, size, f); |
| 247 fclose(f); | 247 fclose(f); |
| 248 return written; | 248 return written; |
| 249 } | 249 } |
| 250 | 250 |
| 251 | 251 |
| 252 int WriteBytes(const char* filename, | 252 int WriteBytes(const char* filename, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 buffer_[position_] = '\0'; | 303 buffer_[position_] = '\0'; |
| 304 // Make sure nobody managed to add a 0-character to the | 304 // Make sure nobody managed to add a 0-character to the |
| 305 // buffer while building the string. | 305 // buffer while building the string. |
| 306 ASSERT(strlen(buffer_.start()) == static_cast<size_t>(position_)); | 306 ASSERT(strlen(buffer_.start()) == static_cast<size_t>(position_)); |
| 307 position_ = -1; | 307 position_ = -1; |
| 308 ASSERT(is_finalized()); | 308 ASSERT(is_finalized()); |
| 309 return buffer_.start(); | 309 return buffer_.start(); |
| 310 } | 310 } |
| 311 | 311 |
| 312 } } // namespace v8::internal | 312 } } // namespace v8::internal |
| OLD | NEW |