X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=contrib%2Fgtkgensurf%2Fbitmap.cpp;h=68eea5c2c43ee611a0bec432075a855bf2dc8cf6;hb=e78f526d5fbbbf18699ec76297e4973565356c81;hp=b49c6ca9e97c9ef2ca9bf3ae82dc1db84c44033d;hpb=830125fad042fad35dc029b6eb57c8156ad7e176;p=xonotic%2Fnetradiant.git diff --git a/contrib/gtkgensurf/bitmap.cpp b/contrib/gtkgensurf/bitmap.cpp index b49c6ca9..68eea5c2 100644 --- a/contrib/gtkgensurf/bitmap.cpp +++ b/contrib/gtkgensurf/bitmap.cpp @@ -19,16 +19,6 @@ #include #include - -#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 #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,17 +429,16 @@ 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, "" ); } if ( g_pWnd ) { gtk_entry_set_text( GTK_ENTRY( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_file" ) ), gbmp.name ); - gtk_widget_set_sensitive( GTK_WIDGET( g_object_get_data( G_OBJECT( g_pWnd ), "bmp_reload" ) ), + gtk_widget_set_sensitive( g_object_get_data( G_OBJECT( g_pWnd , "bmp_reload" ) ), strlen( gbmp.name ) ? TRUE : FALSE ); UpdatePreview( true );