Commits

Richard Goedeken committed 8e0edcb

fixed compiler warnings

  • Participants
  • Parent commits 97a462e

Comments (0)

Files changed (13)

File src/Glide64/Combine.cpp

   wxUint32 actual_combine, current_combine, color_combine, alpha_combine;
   int left, right;
 
-  actual_combine = cmb_mode_c;
+  actual_combine = current_combine = cmb_mode_c;
   color_combine = actual_combine;
   if ((rdp.cycle2 & 0xFFFF) == 0x1FFF)
     actual_combine = (rdp.cycle1 << 16) | (rdp.cycle1 & 0xFFFF);
     ext_local = GR_CMBX_CONSTANT_COLOR;
     ext_local_a = GR_CMBX_CONSTANT_ALPHA;
     break;
+  default:
+    ext_local = GR_CMBX_ZERO;
+    ext_local_a = GR_CMBX_ZERO;
   };
   switch (cmb.c_oth)
   {
     ext_other = GR_CMBX_CONSTANT_COLOR;
     ext_other_a = GR_CMBX_CONSTANT_ALPHA;
     break;
+  default:
+    ext_other = GR_CMBX_ZERO;
+    ext_other_a = GR_CMBX_ZERO;
   };
   switch (cmb.c_fac)
   {
     cmb.c_ext_c = GR_CMBX_TEXTURE_ALPHA;
     cmb.c_ext_c_invert = 1;
     break;
+  default:
+    cmb.c_ext_c = GR_CMBX_ZERO;
+    cmb.c_ext_c_invert = 0;
   }
 
   switch (cmb.c_fnc)
     cmb.c_ext_d_invert = 0;
     break;
   case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
+  default:
     cmb.c_ext_a = GR_CMBX_ZERO;
     cmb.c_ext_a_mode = GR_FUNC_MODE_ZERO;
     cmb.c_ext_b = ext_local;
     tc_ext_c = GR_CMBX_DETAIL_FACTOR;
     tc_ext_c_invert = 1;
     break;
+  default:
+    tc_ext_c = GR_CMBX_ZERO;
+    tc_ext_c_invert = 0;
+    break;
   }
 
   switch (tmu_func)
     tc_ext_d = GR_CMBX_LOCAL_TEXTURE_ALPHA;
     tc_ext_d_invert = 0;
     break;
+  default:
+    tc_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB;
+    tc_ext_a_mode = GR_FUNC_MODE_ZERO;
+    tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
+    tc_ext_b_mode = GR_FUNC_MODE_ZERO;
+    tc_ext_c = GR_CMBX_ZERO;
+    tc_ext_c_invert = 0;
+    tc_ext_d = GR_CMBX_ZERO;
+    tc_ext_d_invert = 0;
+    break;
   }
 
   if (tmu == GR_TMU0)
     ta_ext_c = GR_CMBX_DETAIL_FACTOR;
     ta_ext_c_invert = 1;
     break;
+  default:
+    ta_ext_c = GR_CMBX_ZERO;
+    ta_ext_c_invert = 0;
+    break;
   }
 
   switch (tmu_a_func)
     ta_ext_d = GR_CMBX_B;
     ta_ext_d_invert = 0;
     break;
+  default:
+    ta_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+    ta_ext_a_mode = GR_FUNC_MODE_ZERO;
+    ta_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+    ta_ext_b_mode = GR_FUNC_MODE_ZERO;
+    ta_ext_c = GR_CMBX_ZERO;
+    ta_ext_c_invert = 0;
+    ta_ext_d = GR_CMBX_ZERO;
+    ta_ext_d_invert = 0;
+    break;
   }
 
   if (tmu == GR_TMU0)

File src/Glide64/Ini.cpp

     fseek(ini, 0L, SEEK_END);
     int t2 = ftell(ini);
     fseek(ini, t1, SEEK_SET);
-    ftruncate(file, t2+space);
-     }
+    if (ftruncate(file, t2+space) != 0)
+        ERRLOG("Failed to truncate .ini file to %i bytes", t2+space);
+    }
 #endif // _WIN32
 
     while (1) {
         if (len > 2048) len = 2048;
 
         fseek (ini,-len,SEEK_CUR);
-        fread (chunk,1,len,ini);
+        if (fread(chunk,1,len,ini) != (size_t) len)
+            ERRLOG("Failed to read %i bytes from .ini file", len);
         fseek (ini,-len+space,SEEK_CUR);
-        fwrite (chunk,1,len,ini);
+        if (fwrite(chunk,1,len,ini) != (size_t) len)
+            ERRLOG("Failed to write %i bytes to .ini file", len);
         fseek (ini,-len-space,SEEK_CUR);
     }
 
     fseek(ini, 0L, SEEK_END);
     int t2 = ftell(ini);
     fseek(ini, t1, SEEK_SET);
-    ftruncate(file, t2+space);
+    if (ftruncate(file, t2+space) != 0)
+        ERRLOG("Failed to truncate .ini file to %i bytes", t2+space);
      }
 #endif // _WIN32
 }
     while(!feof(ini)) {
         ret = 0;
         *line=0;
-        fgets(line,255,ini);
+        if (fgets(line,255,ini) == NULL)
+            break;
 
         // remove enter
         i=strlen(line);
         // create the section
         fseek(ini,last_line,SEEK_SET);
         INI_InsertSpace ((!last_line_ret) * 2 + 6 + strlen(sectionname));
-        if (!last_line_ret) fwrite (&cr, 1, 2, ini);
-        fwrite (&cr, 1, 2, ini);
+        if (!last_line_ret)
+            if (fwrite(&cr, 1, 2, ini) != 2)
+                ERRLOG("Failed to write <CR><LF> to .ini file");
         sprintf (section, "[%s]", sectionname);
-        fwrite (section, 1, strlen(section), ini);
-        fwrite (&cr, 1, 2, ini);
+        if (fwrite(&cr, 1, 2, ini) != 2 ||
+            fwrite(section, 1, strlen(section), ini) != strlen(section) ||
+            fwrite(&cr, 1, 2, ini) != 2)
+            ERRLOG("Failed to write Section line to .ini file");
         sectionstart = ftell(ini);
         last_line = sectionstart;
         last_line_ret = 1;
     while(!feof(ini)) {
         ret = 0;
         *line=0;
-        fgets(line,255,ini);
+        if (fgets(line,255,ini) == NULL)
+            break;
 
         // remove enter
         i=strlen(line);
     {
         fseek(ini,last_line,SEEK_SET);
         INI_InsertSpace ((!last_line_ret) * 2 + strlen(itemname) + strlen(def_value) + 5);
-        if (!last_line_ret) fwrite (&cr, 1, 2, ini);
+        if (!last_line_ret)
+            if (fwrite(&cr, 1, 2, ini) != 2)
+                ERRLOG("Failed to write <CR><LF> to .ini file");
         sprintf (line, "%s = %s", itemname, def_value);
-        fwrite (line, 1, strlen(line), ini);
-        fwrite (&cr, 1, 2, ini);
+        if (fwrite(line, 1, strlen(line), ini) != strlen(line) ||
+            fwrite(&cr, 1, 2, ini) != 2)
+            ERRLOG("Failed to write key,value line to .ini file");
         last_line = ftell(ini);
         last_line_ret = 1;
     }
     while(!feof(ini)) {
         ret = 0;
         *line=0;
-        fgets(line,255,ini);
+        if (fgets(line,255,ini) == NULL) break;
 
         // remove enter
         i=strlen(line);
             INI_InsertSpace (-i + (strlen(itemname) + strlen(value) + 5));
             sprintf (line, "%s = %s", itemname, value);
             fseek (ini, -i, SEEK_CUR);
-            fwrite (line, 1, strlen(line), ini);
-            fwrite (&cr, 1, 2, ini);
+            if (fwrite(line, 1, strlen(line), ini) != strlen(line) ||
+                fwrite(&cr, 1, 2, ini) != 2)
+            {
+                ERRLOG("Failed to write line '%s' to .ini file", line);
+            }
             last_line = ftell(ini);
             last_line_ret = 1;
             return;
     // uh-oh, not found.  we need to create
     fseek(ini,last_line,SEEK_SET);
     INI_InsertSpace ((!last_line_ret) * 2 + strlen(itemname) + strlen(value) + 5);
-    if (!last_line_ret) fwrite (&cr, 1, 2, ini);
     sprintf (line, "%s = %s", itemname, value);
-    fwrite (line, 1, strlen(line), ini);
-    fwrite (&cr, 1, 2, ini);
+    if (!last_line_ret)
+        if (fwrite(&cr, 1, 2, ini) != 2)
+            ERRLOG("Failed to write <CR> to .ini file");
+    if (fwrite(line, 1, strlen(line), ini) != strlen(line) ||
+        fwrite(&cr, 1, 2, ini) != 2)
+    {
+        ERRLOG("Failed to write line '%s' to .ini file", line);
+    }
     last_line = ftell(ini);
     last_line_ret = 1;
     return;

File src/Glide64/TexCache.cpp

 //
 //****************************************************************
 
+#include <SDL.h>
 #include "Gfx_1.3.h"
 #include "TexCache.h"
 #include "Combine.h"
       if (ghq_dmptex_toggle_key) {
         DisplayLoadProgress(L"Texture dump - ON\n");
         ClearCache();
-        #pragma message( "TODO: should sleep here" )
-//        wxThread::Sleep(1000);
+        SDL_Delay(1000);
       } else {
         DisplayLoadProgress(L"Texture dump - OFF\n");
-//        wxThread::Sleep(1000);
+        SDL_Delay(1000);
       }
     }
   }

File src/Glide64/ucode09.h

 {
   wxUint32 textured, vnum, vsize;
   switch (type) {
-    case 0: //null
-      textured = vnum = vsize = 0;
-      break;
     case 1: //sh tri
       textured = 0;
       vnum = 3;
       vnum = 4;
       vsize = 16;
       break;
+    case 0: //null
+    default:
+      textured = vnum = vsize = 0;
+      break;
   }
   VERTEX vtx[4];
   for (wxUint32 i = 0; i < vnum; i++)
   wxUint32 a = -1024 + (rdp.cmd1&0xFFF);
   FRDP ("uc9:fmlight matrix: %d, num: %d, dmem: %04lx\n", mid, rdp.num_lights, a);
 
-  M44 *m;
+  M44 *m = NULL;
   switch (mid) {
   case 4:
     m = (M44*)rdp.model;
 static void uc9_mtxcat ()
 {
   LRDP("uc9:mtxcat ");
-  M44 *s;
-  M44 *t;
+  M44 *s = NULL;
+  M44 *t = NULL;
   wxUint32 S = rdp.cmd0&0xF;
   wxUint32 T = (rdp.cmd1>>16)&0xF;
   wxUint32 D = rdp.cmd1&0xF;

File src/GlideHQ/TextureFilters.cpp

       r1 = (pSrc[xSrc]>>16)&0xFF;
       a1 = (pSrc[xSrc]>>24)&0xFF;
 
+      // Pixel 1
+      pDst1[xSrc*2] = pSrc[xSrc];
+
+      // Pixel 2
       if( xSrc<nWidth-1 )
       {
         b2 = (pSrc[xSrc+1]>>0)&0xFF;
         g2 = (pSrc[xSrc+1]>>8)&0xFF;
         r2 = (pSrc[xSrc+1]>>16)&0xFF;
         a2 = (pSrc[xSrc+1]>>24)&0xFF;
+        pDst1[xSrc*2+1] = DWORD_MAKE((r1+r2)/2, (g1+g2)/2, (b1+b2)/2, (a1+a2)/2);
       }
+      else
+        pDst1[xSrc*2+1] = pSrc[xSrc];
 
+      // Pixel 3
       if( ySrc<nHeight-1 )
       {
         b3 = (pSrc2[xSrc]>>0)&0xFF;
         g3 = (pSrc2[xSrc]>>8)&0xFF;
         r3 = (pSrc2[xSrc]>>16)&0xFF;
         a3 = (pSrc2[xSrc]>>24)&0xFF;
+        pDst2[xSrc*2] = DWORD_MAKE((r1+r3)/2, (g1+g3)/2, (b1+b3)/2, (a1+a3)/2);
         if( xSrc<nWidth-1 )
         {
           b4 = (pSrc2[xSrc+1]>>0)&0xFF;
           g4 = (pSrc2[xSrc+1]>>8)&0xFF;
           r4 = (pSrc2[xSrc+1]>>16)&0xFF;
           a4 = (pSrc2[xSrc+1]>>24)&0xFF;
-        }
-      }
-
-
-      // Pixel 1
-      pDst1[xSrc*2] = pSrc[xSrc];
-
-      // Pixel 2
-      if( xSrc<nWidth-1 )
-      {
-        pDst1[xSrc*2+1] = DWORD_MAKE((r1+r2)/2, (g1+g2)/2, (b1+b2)/2, (a1+a2)/2);
-      }
-      else
-        pDst1[xSrc*2+1] = pSrc[xSrc];
-
-
-      // Pixel 3
-      if( ySrc<nHeight-1 )
-      {
-        pDst2[xSrc*2] = DWORD_MAKE((r1+r3)/2, (g1+g3)/2, (b1+b3)/2, (a1+a3)/2);
-      }
-      else
-        pDst2[xSrc*2] = pSrc[xSrc];
-
-      // Pixel 4
-      if( xSrc<nWidth-1 )
-      {
-        if( ySrc<nHeight-1 )
-        {
+          // Pixel 4
           pDst2[xSrc*2+1] = DWORD_MAKE((r1+r2+r3+r4)/4, (g1+g2+g3+g4)/4, (b1+b2+b3+b4)/4, (a1+a2+a3+a4)/4);
         }
         else
         {
-          pDst2[xSrc*2+1] = DWORD_MAKE((r1+r2)/2, (g1+g2)/2, (b1+b2)/2, (a1+a2)/2);
+          // Pixel 4
+          pDst2[xSrc*2+1] = DWORD_MAKE((r1+r3)/2, (g1+g3)/2, (b1+b3)/2, (a1+a3)/2);
         }
       }
       else
       {
-        if( ySrc<nHeight-1 )
+        // Pixel 3
+        pDst2[xSrc*2] = pSrc[xSrc];
+        // Pixel 4
+        if( xSrc<nWidth-1 )
         {
-          pDst2[xSrc*2+1] = DWORD_MAKE((r1+r3)/2, (g1+g3)/2, (b1+b3)/2, (a1+a3)/2);
+          pDst2[xSrc*2+1] = DWORD_MAKE((r1+r2)/2, (g1+g2)/2, (b1+b2)/2, (a1+a2)/2);
         }
         else
+        {
           pDst2[xSrc*2+1] = pSrc[xSrc];
+        }
       }
     }
   }

File src/GlideHQ/TextureFilters_hq2x.cpp

   unsigned i;
 
   for(i=0;i<count;++i) {
-    unsigned char mask;
+    unsigned char mask = 0;
 
     uint32 c[9];
 

File src/GlideHQ/TxCache.cpp

 #pragma warning(disable: 4786)
 #endif
 
-#include "../Glide64/m64p.h"
+#include <boost/filesystem.hpp>
+#include <zlib.h>
 #include "TxCache.h"
 #include "TxDbg.h"
-#include <zlib.h>
-#include <boost/filesystem.hpp>
+#include "../Glide64/m64p.h"
+#include "../Glide64/Gfx_1.3.h"
 
 TxCache::~TxCache()
 {
 #else
     char curpath[MAX_PATH];
     wcstombs(cbuf, cachepath.wstring().c_str(), MAX_PATH);
-    GETCWD(MAX_PATH, curpath);
-    CHDIR(cbuf);
+    if (GETCWD(MAX_PATH, curpath) == NULL)
+        ERRLOG("Error while retrieving working directory!");
+    if (CHDIR(cbuf) != 0)
+        ERRLOG("Error while changing current directory to '%s'!", cbuf);
 #endif
 
     wcstombs(cbuf, filename, MAX_PATH);
       gzclose(gzfp);
     }
 
-    CHDIR(curpath);
+    if (CHDIR(curpath) != 0)
+        ERRLOG("Error while changing current directory back to original path of '%s'!", curpath);
   }
 
   return _cache.empty();
 #else
   char curpath[MAX_PATH];
   wcstombs(cbuf, cachepath.wstring().c_str(), MAX_PATH);
-  GETCWD(MAX_PATH, curpath);
-  CHDIR(cbuf);
+  if (GETCWD(MAX_PATH, curpath) == NULL)
+      ERRLOG("Error while retrieving working directory!");
+  if (CHDIR(cbuf) != 0)
+      ERRLOG("Error while changing current directory to '%s'!", cbuf);
 #endif
 
   wcstombs(cbuf, filename, MAX_PATH);
     }
   }
 
-  CHDIR(curpath);
+  if (CHDIR(curpath) != 0)
+      ERRLOG("Error while changing current directory back to original path of '%s'!", curpath);
 
   return !_cache.empty();
 }

File src/GlideHQ/TxHiResCache.cpp

  * (0:disable, 1:enable, 2:extreme) */
 #define AGGRESSIVE_QUANTIZATION 1
 
-#include "TxHiResCache.h"
-#include "TxDbg.h"
 #include <zlib.h>
 #include <string>
 #include <SDL.h>
+#include "TxHiResCache.h"
+#include "TxDbg.h"
+#include "../Glide64/Gfx_1.3.h"
 
 TxHiResCache::~TxHiResCache()
 {
   char curpath[MAX_PATH];
   char cbuf[MAX_PATH];
   wcstombs(cbuf, dir_path.wstring().c_str(), MAX_PATH);
-  GETCWD(MAX_PATH, curpath);
-  CHDIR(cbuf);
+  if (GETCWD(MAX_PATH, curpath) == NULL)
+      ERRLOG("Error while retrieving working directory!");
+  if (CHDIR(cbuf) != 0)
+      ERRLOG("Error while changing current directory to '%s'!", cbuf);
 #endif
 
   /* NOTE: I could use the boost::wdirectory_iterator and boost::wpath
 
   }
 
-  CHDIR(curpath);
+  if (CHDIR(curpath) != 0)
+      ERRLOG("Error while changing current directory back to original path of '%s'!", curpath);
 
   return 1;
 }

File src/GlideHQ/TxImage.cpp

 #include "TxReSample.h"
 #include "TxDbg.h"
 #include <stdlib.h>
+#include "../Glide64/Gfx_1.3.h"
 
 boolean
 TxImage::getPNGInfo(FILE *fp, png_structp *png_ptr, png_infop *info_ptr)
   png_structp png_ptr;
   png_infop info_ptr;
   png_color_8 sig_bit;
-  png_colorp palette_ptr;
-  png_bytep trans_ptr;//, tex_ptr;
+  png_colorp palette_ptr = NULL;
+  png_bytep trans_ptr = NULL;
   int bit_depth, color_type, row_bytes, num_palette;
   int i;
   //uint16 srcfmt, destfmt;
   uint8 *image = NULL;
   uint8 *image_row = NULL;
   uint8 *tmpimage = NULL;
-  int row_bytes, pos, i, j;
+  unsigned int row_bytes, pos, i, j;
   /* Windows Bitmap */
   BITMAPFILEHEADER bmp_fhdr;
   BITMAPINFOHEADER bmp_ihdr;
       for (i = 0; i < bmp_ihdr.biHeight; i++) {
         /* read in image */
         fseek(fp, pos, SEEK_SET);
-        fread(tmpimage, row_bytes, 1, fp);
+        if (fread(tmpimage, 1, row_bytes, fp) != row_bytes)
+            ERRLOG("fread() failed for row of '%i' bytes in 8/32-bit BMP image", row_bytes);
         tmpimage += row_bytes;
         pos -= row_bytes;
       }
       for (i = 0; i < bmp_ihdr.biHeight; i++) {
         /* read in image */
         fseek(fp, pos, SEEK_SET);
-        fread(image_row, row_bytes, 1, fp);
+        if (fread(image_row, 1, row_bytes, fp) != row_bytes)
+            ERRLOG("fread failed for row of '%i' bytes in 4-bit BMP image", row_bytes);
         /* expand 4bpp to 8bpp. stuff 4bit values into 8bit comps. */
         for (j = 0; j < row_bytes; j++) {
           tmpimage[j << 1] = image_row[j] & 0x0f;
       for (i = 0; i < bmp_ihdr.biHeight; i++) {
         /* read in image */
         fseek(fp, pos, SEEK_SET);
-        fread(image_row, row_bytes, 1, fp);
+        if (fread(image_row, 1, row_bytes, fp) != row_bytes)
+            ERRLOG("fread failed for row of '%i' bytes in 24-bit BMP image", row_bytes);
         /* convert 24bpp to 32bpp. */
         for (j = 0; j < bmp_ihdr.biWidth; j++) {
           tmpimage[(j << 2)]     = image_row[j * 3];
     *format = tmpformat;
 
     fseek(fp, 128, SEEK_SET); /* size of header is 128 bytes */
-    fread(image, dds_fhdr.dwLinearSize, 1, fp);
+    if (fread(image, 1, dds_fhdr.dwLinearSize, fp) != dds_fhdr.dwLinearSize)
+        ERRLOG("fread failed to read DDS image of '%i' bytes", dds_fhdr.dwLinearSize);
   }
 
   return image;

File src/GlideHQ/TxQuantize.cpp

   for (i = 0; i < width; i++) errR[i] = errG[i] = errB[i] = 0;
 
   for (y = 0; y < height; y++) {
+    qr = qg = qb = 0;
     for (x = 0; x < width; x++) {
       /* incoming pixel values */
       ir = ((*src >> 16) & 0xFF) * 10000;
       ig = ((*src >>  8) & 0xFF) * 10000;
       ib = ((*src      ) & 0xFF) * 10000;
 
-      if (x == 0) qr = qg = qb = 0;
-
       /* quantize pixel values. 
        * qr * 0.4375 is the error from the pixel to the left, 
        * errR is the error from the pixel to the top, top left, and top right */
   for (i = 0; i < width; i++) errR[i] = errG[i] = errB[i] = 0;
 
   for (y = 0; y < height; y++) {
+    qr = qg = qb = 0;
     for (x = 0; x < width; x++) {
       /* incoming pixel values */
       ir = ((*src >> 16) & 0xFF) * 10000;
       ig = ((*src >>  8) & 0xFF) * 10000;
       ib = ((*src      ) & 0xFF) * 10000;
 
-      if (x == 0) qr = qg = qb = 0;
-
       /* quantize pixel values. 
        * qr * 0.4375 is the error from the pixel to the left, 
        * errR is the error from the pixel to the top, top left, and top right */
   for (i = 0; i < width; i++) errR[i] = errG[i] = errB[i] = errA[i] = 0;
 
   for (y = 0; y < height; y++) {
+    qr = qg = qb = qa = 0;
     for (x = 0; x < width; x++) {
       /* incoming pixel values */
       ir = ((*src >> 16) & 0xFF) * 10000;
       ib = ((*src      ) & 0xFF) * 10000;
       ia = ((*src >> 24) & 0xFF) * 10000;
 
-      if (x == 0) qr = qg = qb = qa = 0;
-
       /* quantize pixel values. 
        * qr * 0.4375 is the error from the pixel to the left, 
        * errR is the error from the pixel to the top, top left, and top right */
   for (i = 0; i < width; i++) errI[i] = errA[i] = 0;
 
   for (y = 0; y < height; y++) {
+    qi = qa = 0;
     for (x = 0; x < width; x++) {
       /* 3dfx style Intensity = R * 0.299 + G * 0.587 + B * 0.114 */
       ii = ((*src >> 16) & 0xFF) * 2990 +
            ((*src      ) & 0xFF) * 1140;
       ia = ((*src >> 24) & 0xFF) * 10000;
 
-      if (x == 0) qi = qa = 0;
-
       /* quantize pixel values. 
        * qi * 0.4375 is the error from the pixel to the left, 
        * errI is the error from the pixel to the top, top left, and top right */

File src/GlideHQ/TxUtil.cpp

   int cur_height;
   uint32_t pos;
   uint32_t word;
-  uint32_t word_hash;
+  uint32_t word_hash = 0;
   uint32_t tmp;
   const uint32_t bytes_per_width = ((width << size) + 1) >> 1;
 
   int cur_height;
   uint32_t pos;
   uint32_t word;
-  uint32_t word_hash;
+  uint32_t word_hash = 0;
   uint32_t tmp;
   const uint32_t bytes_per_width = ((width << size) + 1) >> 1;
 
   int cur_height;
   uint32_t pos;
   uint32_t word;
-  uint32_t word_hash;
+  uint32_t word_hash = 0;
   uint32_t tmp;
   const uint32_t bytes_per_width = ((width << size) + 1) >> 1;
 

File src/GlideHQ/tc-1.1+/fxt1.c

     /* left microtile */
     if (maxColL == -1) {
 	/* all transparent black */
-	cc[0] = ~0UL;
+	cc[0] = 0xFFFFFFFF;
 	for (i = 0; i < n_comp; i++) {
 	    vec[0][i] = 0;
 	    vec[1][i] = 0;
     /* right microtile */
     if (maxColR == -1) {
 	/* all transparent black */
-	cc[1] = ~0UL;
+	cc[1] = 0xFFFFFFFF;
 	for (i = 0; i < n_comp; i++) {
 	    vec[2][i] = 0;
 	    vec[3][i] = 0;
     if (trualpha) {
 	fxt1_quantize_ALPHA1(cc, input);
     } else if (l == 0) {
-	cc[0] = cc[1] = cc[2] = ~0UL;
+	cc[0] = cc[1] = cc[2] = 0xFFFFFFFF;
 	cc[3] = 0;
     } else if (l < N_TEXELS) {
 	fxt1_quantize_MIXED1(cc, input);

File src/Glitch64/main.cpp

   glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h);
   glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &fmt);
   //printf("copyteximage %dx%d fmt %x oldfmt %x\n", width, height, internalFormat, fmt);
-  if (w == width && h == height && fmt == internalFormat) {
+  if (w == (int) width && h == (int) height && fmt == (int) internalFormat) {
     if (x+width >= screen_width) {
       width = screen_width - x;
       //printf("resizing w --> %d\n", width);
     maxy = th - maxy;
     miny = th - miny;
     FxU32 tmp = maxy; maxy = miny; miny = tmp;
-    if (maxx > width) maxx = width;
-    if (maxy > height) maxy = height;
+    if (maxx > (FxU32) width) maxx = width;
+    if (maxy > (FxU32) height) maxy = height;
     if (int(minx) < 0) minx = 0;
     if (int(miny) < 0) miny = 0;
     if (maxx < minx) maxx = minx;
   glGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC)wglGetProcAddress("glGenRenderbuffersEXT");
   glRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC)wglGetProcAddress("glRenderbufferStorageEXT");
   glFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)wglGetProcAddress("glFramebufferRenderbufferEXT");
+  use_fbo = config.fbo && (glFramebufferRenderbufferEXT != NULL);
+#else
+  use_fbo = config.fbo;
 #endif // _WIN32
 
-  use_fbo = config.fbo && glFramebufferRenderbufferEXT;
-
   printf("use_fbo %d\n", use_fbo);
 
   if (isExtensionSupported("GL_ARB_shading_language_100") &&
   try // I don't know why, but opengl can be killed before this function call when emulator is closed (Gonetz).
     // ZIGGY : I found the problem : it is a function pointer, when the extension isn't supported , it is then zero, so just need to check the pointer prior to do the call.
   {
-    if (use_fbo && glBindFramebufferEXT)
+    if (use_fbo)
       glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, 0 );
   }
   catch (...)
 
     int rtmu = startAddress < grTexMinAddress(GR_TMU1)? 0 : 1;
     int size = pBufferWidth*pBufferHeight*2; //grTexFormatSize(fmt);
-    if (tmu_usage[rtmu].min > pBufferAddress)
+    if ((unsigned int) tmu_usage[rtmu].min > pBufferAddress)
       tmu_usage[rtmu].min = pBufferAddress;
-    if (tmu_usage[rtmu].max < pBufferAddress+size)
+    if ((unsigned int) tmu_usage[rtmu].max < pBufferAddress+size)
       tmu_usage[rtmu].max = pBufferAddress+size;
     //   printf("tmu %d usage now %gMb - %gMb\n",
     //          rtmu, tmu_usage[rtmu].min/1024.0f, tmu_usage[rtmu].max/1024.0f);
   int found, i;
   if (!use_fbo) {
     for (found=i=0; i<2; i++)
-      if (tmu_usage[i].min <= startAddress && tmu_usage[i].max > startAddress) {
+      if ((FxU32) tmu_usage[i].min <= startAddress && (FxU32) tmu_usage[i].max > startAddress) {
         //printf("tmu %d == framebuffer %x\n", tmu, startAddress);
         found = 1;
         break;