ultramegafix
authorkoda
Sun, 11 Oct 2009 20:40:03 +0000
changeset 2420 b7390a3040f8
parent 2419 dbaaba09146d
child 2421 a4b039ee2eb0
ultramegafix
hedgewars/CMakeLists.txt
openalbridge/globals.h
openalbridge/loaders.c
--- a/hedgewars/CMakeLists.txt	Sun Oct 11 20:25:24 2009 +0000
+++ b/hedgewars/CMakeLists.txt	Sun Oct 11 20:40:03 2009 +0000
@@ -1,9 +1,9 @@
 configure_file(${hedgewars_SOURCE_DIR}/hedgewars/proto.inc.in ${CMAKE_CURRENT_BINARY_DIR}/proto.inc)
 
-find_package(SDL REQUIRED)
-find_package(SDL_image REQUIRED)
-find_package(SDL_net REQUIRED)
-find_package(SDL_ttf REQUIRED)
+find_package(SDL)
+find_package(SDL_image)
+find_package(SDL_net)
+find_package(SDL_ttf)
 
 
 #SOURCE AND PROGRAMS SECTION 
@@ -116,6 +116,8 @@
 #DEPENDECIES AND EXECUTABLES SECTION
 IF(APPLE)
 #let's build sdlmain, which is absent from the framework
+	find_package(SDL REQUIRED)
+
 	set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
 	include_directories(${SDL_INCLUDE_DIR})
 	link_libraries(${SDL_LIBRARY})
--- a/openalbridge/globals.h	Sun Oct 11 20:25:24 2009 +0000
+++ b/openalbridge/globals.h	Sun Oct 11 20:40:03 2009 +0000
@@ -67,11 +67,11 @@
 #endif
 #endif /* _SLEEP_H */
 
-#ifdef __APPLE__
-/* check compiler requirements */
+/* check compiler requirements */    /*FIXME*/
 #if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
-#error Do not know the endianess of this architecture
-#endif
+#warning __BIG_ENDIAN__ or __LITTLE_ENDIAN__ not found, going to set __LITTLE_ENDIAN__ as default
+#define __LITTLE_ENDIAN__ 1
+//#error Do not know the endianess of this architecture
 #endif
 
 /* use byteswap macros from the host system, hopefully optimized ones ;-) 
@@ -81,7 +81,7 @@
 #else        
 #define bswap_16(x)	((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))
 #define bswap_32(x)	((((x) & 0xFF000000) >> 24) | (((x) & 0x00FF0000) >> 8)  | \
-(((x) & 0x0000FF00) << 8)  | (((x) & 0x000000FF) << 24) )
+                         (((x) & 0x0000FF00) << 8)  | (((x) & 0x000000FF) << 24) )
 #endif /* HAVE_BYTESWAP_H */
 
 /* swap numbers accordingly to architecture automatically */
--- a/openalbridge/loaders.c	Sun Oct 11 20:25:24 2009 +0000
+++ b/openalbridge/loaders.c	Sun Oct 11 20:40:03 2009 +0000
@@ -104,7 +104,7 @@
         fclose(wavfile);	
             
 #ifdef DEBUG
-        fprintf(stderr, "WAV data loaded\n");
+    err_msg("(%s) INFO - WAV data loaded", prog);
 #endif
             
         /*set parameters for OpenAL*/
@@ -116,8 +116,9 @@
                 if (ENDIAN_LITTLE_16(WAVHeader.BitsPerSample) == 16)
                     *format = AL_FORMAT_MONO16;
                 else {
-                    fprintf(stderr, "ERROR 'load_wavpcm()': wrong WAV header - bitsample value\n");
-                    return AL_FALSE;
+                        errno = EILSEQ;
+                        err_ret("(%s) ERROR - wrong WAV header [bitsample value]", prog);
+                        return AL_FALSE;
                 }
             } 
         } else {
@@ -128,13 +129,15 @@
                     if (ENDIAN_LITTLE_16(WAVHeader.BitsPerSample) == 16)
                         *format = AL_FORMAT_STEREO16;
                     else {
-                        fprintf(stderr, "ERROR 'load_wavpcm()': wrong WAV header - bitsample value\n");
+                            errno = EILSEQ;
+                            err_ret("(%s) ERROR - wrong WAV header [bitsample value]", prog);
                         return AL_FALSE;
                     }				
                 }
             } else {
-                fprintf(stderr, "ERROR 'load_wavpcm()': wrong WAV header - format value\n");
-                return AL_FALSE;
+                    errno = EILSEQ;
+                    err_ret("(%s) ERROR - wrong WAV header [format value]", prog); 
+                    return AL_FALSE;
             }
         }
         
@@ -157,7 +160,8 @@
 
 	result = ov_fopen((char*) filename, &oggStream);
 	if (result < 0) {
-		fprintf (stderr, "ERROR 'load_oggvorbis()': ov_fopen failed with %X", result);
+                errno = EINVAL;
+                err_ret("(%s) ERROR - ov_fopen() failed with %X", prog, result);
                 ov_clear(&oggStream);
 		return AL_FALSE;
 	}
@@ -214,7 +218,8 @@
                 if (result == 0)
                     break;
                 else { 
-                    fprintf(stderr, "ERROR 'load_oggvorbis()': end of file from OGG stream\n");
+                        errno = EILSEQ;
+                        err_ret("(%s) ERROR - End of file from OGG stream", prog);
                     ov_clear(&oggStream);
                     return AL_FALSE;
                 }