]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - jpeg.c
made darkplaces compile successfully with g++ to test for errors C doesn't care about...
[xonotic/darkplaces.git] / jpeg.c
diff --git a/jpeg.c b/jpeg.c
index 70bd13dab1f5b00c537995429696bab95cd41424..4934b75899220afaa8820512e42a8c418abe1f37 100644 (file)
--- a/jpeg.c
+++ b/jpeg.c
@@ -397,7 +397,9 @@ qboolean JPEG_OpenLibrary (void)
 {
        const char* dllnames [] =
        {
 {
        const char* dllnames [] =
        {
-#ifdef WIN32
+#if defined(WIN64)
+               "libjpeg64.dll",
+#elif defined(WIN32)
                "libjpeg.dll",
 #elif defined(MACOSX)
                "libjpeg.62.dylib",
                "libjpeg.dll",
 #elif defined(MACOSX)
                "libjpeg.62.dylib",
@@ -468,9 +470,9 @@ static void JPEG_SkipInputData (j_decompress_ptr cinfo, long num_bytes)
     cinfo->src->bytes_in_buffer -= num_bytes;
 }
 
     cinfo->src->bytes_in_buffer -= num_bytes;
 }
 
-static void JPEG_MemSrc (j_decompress_ptr cinfo, qbyte *buffer)
+static void JPEG_MemSrc (j_decompress_ptr cinfo, const qbyte *buffer)
 {
 {
-       cinfo->src = cinfo->mem->alloc_small ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof (struct jpeg_source_mgr));
+       cinfo->src = (struct jpeg_source_mgr *)cinfo->mem->alloc_small ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof (struct jpeg_source_mgr));
 
        cinfo->src->next_input_byte = buffer;
        cinfo->src->bytes_in_buffer = fs_filesize;
 
        cinfo->src->next_input_byte = buffer;
        cinfo->src->bytes_in_buffer = fs_filesize;
@@ -496,7 +498,7 @@ JPEG_LoadImage
 Load a JPEG image into a RGBA buffer
 ====================
 */
 Load a JPEG image into a RGBA buffer
 ====================
 */
-qbyte* JPEG_LoadImage (qbyte *f, int matchwidth, int matchheight)
+qbyte* JPEG_LoadImage (const qbyte *f, int matchwidth, int matchheight)
 {
        struct jpeg_decompress_struct cinfo;
        struct jpeg_error_mgr jerr;
 {
        struct jpeg_decompress_struct cinfo;
        struct jpeg_error_mgr jerr;
@@ -528,8 +530,8 @@ qbyte* JPEG_LoadImage (qbyte *f, int matchwidth, int matchheight)
                return NULL;
        }
 
                return NULL;
        }
 
-       image_rgba = Mem_Alloc(tempmempool, image_width * image_height * 4);
-       scanline = Mem_Alloc(tempmempool, image_width * cinfo.output_components);
+       image_rgba = (qbyte *)Mem_Alloc(tempmempool, image_width * image_height * 4);
+       scanline = (qbyte *)Mem_Alloc(tempmempool, image_width * cinfo.output_components);
        if (!image_rgba || !scanline)
        {
                if (!image_rgba)
        if (!image_rgba || !scanline)
        {
                if (!image_rgba)
@@ -628,7 +630,7 @@ static void JPEG_TermDestination (j_compress_ptr cinfo)
 
        // Write any data remaining in the buffer
        if (datacount > 0)
 
        // Write any data remaining in the buffer
        if (datacount > 0)
-               if (FS_Write (dest->outfile, dest->buffer, datacount) != datacount)
+               if (FS_Write (dest->outfile, dest->buffer, datacount) != (fs_offset_t)datacount)
                        error_in_jpeg = true;
 }
 
                        error_in_jpeg = true;
 }
 
@@ -671,7 +673,7 @@ qboolean JPEG_SaveImage_preflipped (const char *filename, int width, int height,
        }
 
        // Open the file
        }
 
        // Open the file
-       file = FS_Open (filename, "wb", true);
+       file = FS_Open (filename, "wb", true, false);
        if (!file)
                return false;
 
        if (!file)
                return false;