Skip to content

Commit

Permalink
Fixed bug 3832 - Compilation error with "IMG_jpg.c" on Mac OS X
Browse files Browse the repository at this point in the history
Holger Schemel

Summary: Error when compiling file "IMG_jpg.c" on Mac OS X.

This compilation error may possibly only occur in certain cases (maybe depending on what "./configure" detected); however, it will always occur if the first "#if" (at the very top of the file) results in the corresponding #if/#endif block to be skipped.

In this case, the remaining part of the source file (starting with "#define SAVE_JPG" / "#ifdef SAVE_JPG") will always be compiled, but has no SDL stuff defined (like "SDL_Surface" etc.), because "SDL_image.h" was never included in this case, and will therefore fail with a compiler error.

The attached patch simply moves that first "#if" below the "#include"s, which fixes the problem.
  • Loading branch information
slouken committed Sep 18, 2017
1 parent 64eb36d commit 1d642d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions IMG_jpg.c
Expand Up @@ -19,8 +19,6 @@
3. This notice may not be removed or altered from any source distribution.
*/

#if !(defined(__APPLE__) || defined(SDL_IMAGE_USE_WIC_BACKEND)) || defined(SDL_IMAGE_USE_COMMON_BACKEND)

/* This is a JPEG image file loading framework */

#include <stdio.h>
Expand All @@ -29,6 +27,8 @@

#include "SDL_image.h"

#if !(defined(__APPLE__) || defined(SDL_IMAGE_USE_WIC_BACKEND)) || defined(SDL_IMAGE_USE_COMMON_BACKEND)

#ifdef LOAD_JPG

#define USE_JPEGLIB
Expand Down

0 comments on commit 1d642d7

Please sign in to comment.