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

Side by Side Diff: src/platform-macos.cc

Issue 4002005: Use return value from fwrite in log.cc to please compilers. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 2 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/log.cc ('k') | no next file » | 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 FILE* file_; 199 FILE* file_;
200 void* memory_; 200 void* memory_;
201 int size_; 201 int size_;
202 }; 202 };
203 203
204 204
205 OS::MemoryMappedFile* OS::MemoryMappedFile::create(const char* name, int size, 205 OS::MemoryMappedFile* OS::MemoryMappedFile::create(const char* name, int size,
206 void* initial) { 206 void* initial) {
207 FILE* file = fopen(name, "w+"); 207 FILE* file = fopen(name, "w+");
208 if (file == NULL) return NULL; 208 if (file == NULL) return NULL;
209 fwrite(initial, size, 1, file); 209 int result = fwrite(initial, size, 1, file);
210 if (result < 1) {
211 fclose(file);
212 return NULL;
213 }
210 void* memory = 214 void* memory =
211 mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0); 215 mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0);
212 return new PosixMemoryMappedFile(file, memory, size); 216 return new PosixMemoryMappedFile(file, memory, size);
213 } 217 }
214 218
215 219
216 PosixMemoryMappedFile::~PosixMemoryMappedFile() { 220 PosixMemoryMappedFile::~PosixMemoryMappedFile() {
217 if (memory_) munmap(memory_, size_); 221 if (memory_) munmap(memory_, size_);
218 fclose(file_); 222 fclose(file_);
219 } 223 }
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 677
674 // Deallocate Mach port for thread. 678 // Deallocate Mach port for thread.
675 if (IsSynchronous()) { 679 if (IsSynchronous()) {
676 mach_port_deallocate(data_->task_self_, data_->profiled_thread_); 680 mach_port_deallocate(data_->task_self_, data_->profiled_thread_);
677 } 681 }
678 } 682 }
679 683
680 #endif // ENABLE_LOGGING_AND_PROFILING 684 #endif // ENABLE_LOGGING_AND_PROFILING
681 685
682 } } // namespace v8::internal 686 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/log.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698