project-navigation
Personal tools

Author Topic: HEAD (2.5) build failure on OSX 10.8/Clang and fix  (Read 4131 times)

Offline Jon_dArc

  • Squad Leader
  • ****
  • Posts: 134
    • View Profile
HEAD (2.5) build failure on OSX 10.8/Clang and fix
« on: June 05, 2013, 06:20:15 pm »
Building complains about two function calls in src/shared/images.cpp on account of no matching functions in jpeglib.h and no known conversion from bool to boolean; the offending argument is "true", and nearby similar functions use "TRUE" in the same position. Changing the two offending calls to "TRUE" satisfies the compiler; it looks like this might have been a typo (or brain-o) that might be concealed by an implicit conversion in other build environments. The relevant patch is included below:

Code: [Select]
diff --git a/src/shared/images.cpp b/src/shared/images.cpp
index d11e250..b8f9868 100644
--- a/src/shared/images.cpp
+++ b/src/shared/images.cpp
@@ -247,7 +247,7 @@ void R_WriteJPG (qFILE *f, byte *buffer, int width, int heig
 
        jpeg_set_defaults(&cinfo);
        jpeg_set_quality(&cinfo, quality, TRUE);
-       jpeg_start_compress(&cinfo, true);      /* start compression */
+       jpeg_start_compress(&cinfo, TRUE);      /* start compression */
        jpeg_write_marker(&cinfo, JPEG_COM, (const byte *) "UFOAI", (uint32_t) 5
 
        /* Feed scanline data */
@@ -397,7 +397,7 @@ static SDL_Surface* Img_LoadJPG(char const* const name)
                jpeg_mem_src(&cinfo, buf, len);
 #endif
 
-               jpeg_read_header(&cinfo, true);
+               jpeg_read_header(&cinfo, TRUE);
 
                cinfo.out_color_space = JCS_RGB;

~J

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: HEAD (2.5) build failure on OSX 10.8/Clang and fix
« Reply #1 on: June 05, 2013, 07:55:01 pm »
thanks a lot. applied to master

Offline Jon_dArc

  • Squad Leader
  • ****
  • Posts: 134
    • View Profile
Re: HEAD (2.5) build failure on OSX 10.8/Clang and fix
« Reply #2 on: June 05, 2013, 11:40:40 pm »
You missed the second occurrence (not hard, the code block hides it and gives no indication there's anything to scroll to).

Code: [Select]
diff --git a/src/shared/images.cpp b/src/shared/images.cpp
index 4ed93d3..b8f9868 100644
--- a/src/shared/images.cpp
+++ b/src/shared/images.cpp
@@ -397,7 +397,7 @@ static SDL_Surface* Img_LoadJPG(char const* const name)
                jpeg_mem_src(&cinfo, buf, len);
 #endif
 
-               jpeg_read_header(&cinfo, true);
+               jpeg_read_header(&cinfo, TRUE);
 
                cinfo.out_color_space = JCS_RGB;

~J

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: HEAD (2.5) build failure on OSX 10.8/Clang and fix
« Reply #3 on: June 06, 2013, 08:28:20 am »
applied to master, too. sorry and thanks again