Revision: 5694
Author: [email protected]
Date: Mon Oct 25 01:22:23 2010
Log: Use return value from fwrite in log.cc to please compilers.

BUG=453
Review URL: http://codereview.chromium.org/4002005
http://code.google.com/p/v8/source/detail?r=5694

Modified:
 /branches/bleeding_edge/src/log.cc
 /branches/bleeding_edge/src/platform-macos.cc

=======================================
--- /branches/bleeding_edge/src/log.cc  Wed Oct 20 01:32:24 2010
+++ /branches/bleeding_edge/src/log.cc  Mon Oct 25 01:22:23 2010
@@ -1378,8 +1378,10 @@
 void Logger::LowLevelCodeCreateEvent(Code* code, LogMessageBuilder* msg) {
   if (!FLAG_ll_prof || Log::output_code_handle_ == NULL) return;
   int pos = static_cast<int>(ftell(Log::output_code_handle_));
-  fwrite(code->instruction_start(), 1, code->instruction_size(),
-         Log::output_code_handle_);
+  int rv = fwrite(code->instruction_start(), 1, code->instruction_size(),
+                  Log::output_code_handle_);
+  ASSERT(static_cast<size_t>(code->instruction_size()) == rv);
+  USE(rv);
   msg->Append(",%d", pos);
 }

=======================================
--- /branches/bleeding_edge/src/platform-macos.cc       Tue Oct 19 09:45:11 2010
+++ /branches/bleeding_edge/src/platform-macos.cc       Mon Oct 25 01:22:23 2010
@@ -206,7 +206,11 @@
     void* initial) {
   FILE* file = fopen(name, "w+");
   if (file == NULL) return NULL;
-  fwrite(initial, size, 1, file);
+  int result = fwrite(initial, size, 1, file);
+  if (result < 1) {
+    fclose(file);
+    return NULL;
+  }
   void* memory =
       mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0);
   return new PosixMemoryMappedFile(file, memory, size);

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to