chiark / gitweb /
Bug fix in stdio_write_func
authorespen <espen>
Mon, 9 Feb 2009 11:46:21 +0000 (11:46 +0000)
committerespen <espen>
Mon, 9 Feb 2009 11:46:21 +0000 (11:46 +0000)
cairo/alien/cairo-jpeg.c

index 988258808c5e02d85e5ef59a2e365dc23b278d86..c59e299fc3d326c2fe7826c5d1fdd8b6ef8341de 100644 (file)
@@ -393,7 +393,14 @@ cairo_status_t stdio_write_func (void *closure,
                                  const unsigned char *data,
                                  unsigned int length)
 {
-  return fwrite(data, 1, length, (FILE *)closure);
+  int bytes_written;
+  do {
+    bytes_written = fwrite(data, 1, length, (FILE *)closure);
+    data += bytes_written;
+    length -= bytes_written;
+  } while (bytes_written > 0 && length > 0);
+  
+  return CAIRO_STATUS_SUCCESS;  
 }
 
 /*