]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - contrib/gtkgensurf/bitmap.cpp
Merge remote-tracking branch 'ttimo/master'
[xonotic/netradiant.git] / contrib / gtkgensurf / bitmap.cpp
index b49c6ca9e97c9ef2ca9bf3ae82dc1db84c44033d..2ca7e6b4b6f02d6b33193a037a2fff30eb3b267c 100644 (file)
 
 #include <stdio.h>
 #include <stdlib.h>
-
-#ifdef _WIN32
-// cough, cough
-typedef __int32 int32_t;
-typedef unsigned __int16 uint16_t;
-typedef unsigned __int8 uint8_t;
-typedef unsigned __int32 uint32_t;
-typedef __int16 int16_t;
-#endif
-
 #include <math.h>
 #include "gensurf.h"
 
@@ -90,7 +80,7 @@ static unsigned char* OpenBitmapFile(){
                fprintf( stderr,"%s:%d: Error file '%s' is malformed.\n",__FILE__,__LINE__,gbmp.name ); \
                fclose( fp ); \
                return NULL; \
-} while ( 0 )
+} while ( 0 );
 
        int32_t bmWidth;
        int32_t bmHeight;
@@ -117,8 +107,7 @@ static unsigned char* OpenBitmapFile(){
        rc = fread( &m1, 1, 1, fp );
        m_bytesRead++;
        if ( rc == -1 ) {
-               fclose( fp );
-               return NULL;
+               INVALID_FORMAT;
        }
 
        rc = fread( &m2, 1, 1, fp );
@@ -204,8 +193,9 @@ static unsigned char* OpenBitmapFile(){
 
        if ( bmBitsPixel != 8 ) {
                g_FuncTable.m_pfnMessageBox( g_pWnd, "This is not an 8-bit image. GenSurf can't use it.",
-                                                                        "Bitmap", MB_ICONEXCLAMATION, NULL );
-               INVALID_FORMAT;
+                                                                        "Bitmap", eMB_OK, eMB_ICONWARNING );
+               fclose( fp );
+               return NULL;
        }
 
        if ( colors == 0 ) {
@@ -439,11 +429,10 @@ bool OpenBitmap(){
        OpenBitmapFile();
 
        if ( !gbmp.colors ) {
-               g_print( "failed to load file gbmp %s\n",gbmp.name );
                char Text[256];
 
                sprintf( Text, "Error opening %s", gbmp.name );
-               g_FuncTable.m_pfnMessageBox( g_pWnd, Text, "Bitmap", MB_ICONEXCLAMATION, NULL );
+               g_FuncTable.m_pfnMessageBox( g_pWnd, Text, "Bitmap", eMB_OK, eMB_ICONWARNING );
                strcpy( gbmp.name, "" );
        }