[LIBJPEG] Update to version 9c. CORE-14291
[reactos.git] / dll / 3rdparty / libjpeg / wrbmp.c
index 3283b0f..2814864 100644 (file)
@@ -2,6 +2,7 @@
  * wrbmp.c
  *
  * Copyright (C) 1994-1996, Thomas G. Lane.
+ * Modified 2017 by Guido Vollbeding.
  * This file is part of the Independent JPEG Group's software.
  * For conditions of distribution and use, see the accompanying README file.
  *
@@ -189,7 +190,7 @@ write_bmp_header (j_decompress_ptr cinfo, bmp_dest_ptr dest)
   /* File size */
   headersize = 14 + 40 + cmap_entries * 4; /* Header and colormap */
   bfSize = headersize + (INT32) dest->row_width * (INT32) cinfo->output_height;
-  
+
   /* Set unused fields of header to 0 */
   MEMZERO(bmpfileheader, SIZEOF(bmpfileheader));
   MEMZERO(bmpinfoheader, SIZEOF(bmpinfoheader));
@@ -254,7 +255,7 @@ write_os2_header (j_decompress_ptr cinfo, bmp_dest_ptr dest)
   /* File size */
   headersize = 14 + 12 + cmap_entries * 3; /* Header and colormap */
   bfSize = headersize + (INT32) dest->row_width * (INT32) cinfo->output_height;
-  
+
   /* Set unused fields of header to 0 */
   MEMZERO(bmpfileheader, SIZEOF(bmpfileheader));
   MEMZERO(bmpcoreheader, SIZEOF(bmpcoreheader));
@@ -376,8 +377,8 @@ finish_output_bmp (j_decompress_ptr cinfo, djpeg_dest_ptr dinfo)
     progress->completed_extra_passes++;
 
   /* Make sure we wrote the output file OK */
-  fflush(outfile);
-  if (ferror(outfile))
+  JFFLUSH(outfile);
+  if (JFERROR(outfile))
     ERREXIT(cinfo, JERR_FILE_WRITE);
 }
 
@@ -436,7 +437,7 @@ jinit_write_bmp (j_decompress_ptr cinfo, boolean is_os2)
     ((j_common_ptr) cinfo, JPOOL_IMAGE, row_width, (JDIMENSION) 1);
   dest->pub.buffer_height = 1;
 
-  return (djpeg_dest_ptr) dest;
+  return &dest->pub;
 }
 
 #endif /* BMP_SUPPORTED */