]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Warning fixes.
authorToni Wilen <twilen@winuae.net>
Sun, 23 Oct 2022 17:40:04 +0000 (20:40 +0300)
committerToni Wilen <twilen@winuae.net>
Sun, 23 Oct 2022 17:40:04 +0000 (20:40 +0300)
14 files changed:
arcadia.cpp
include/zfile.h
inputrecord.cpp
memory.cpp
od-win32/avioutput.cpp
od-win32/machdep/maccess.h
od-win32/picasso96_win.cpp
od-win32/scaler_more.cpp
od-win32/writelog.cpp
slirp/libslirp.h
slirp/slirp.cpp
slirp_uae.cpp
softfloat/softfloat.cpp
zfile.cpp

index 486cce0c3c5df8f5996d82ddccf4f0e20a9b9e8c..1e0dbe7d40373ba86a1e93fa8e07b73f4a27dc0d 100644 (file)
@@ -182,7 +182,7 @@ static struct arcadiarom *is_arcadia (const TCHAR *xpath, int cnt)
 
        _tcscpy (path, xpath);
        p = path;
-       for (i = _tcslen (xpath) - 1; i > 0; i--) {
+       for (i = uaetcslen (xpath) - 1; i > 0; i--) {
                if (path[i] == '\\' || path[i] == '/') {
                        path[i++] = 0;
                        p = path + i;
index a35e8da556bc73d30f7a3282d01b50266b8a55a5..7ed1cea8fc365dd99dd996ae1829fa7222dfd63e 100644 (file)
@@ -1,3 +1,4 @@
+ /*
  /*
   * UAE - The Un*x Amiga Emulator
   *
@@ -60,6 +61,7 @@ extern uae_s32 zfile_ftell32(struct zfile *z);
 extern uae_s64 zfile_size(struct zfile *z);
 extern uae_s32 zfile_size32(struct zfile *z);
 extern size_t zfile_fread(void *b, size_t l1, size_t l2, struct zfile *z);
+extern uae_s32 zfile_fread32(void *b, size_t l1, size_t l2, struct zfile *z);
 extern size_t zfile_fwrite(const void *b, size_t l1, size_t l2, struct zfile *z);
 extern TCHAR *zfile_fgets(TCHAR *s, int size, struct zfile *z);
 extern char *zfile_fgetsa(char *s, int size, struct zfile *z);
index 8c39f321a91b6d54c4a805018ed7e4c17e754883..23c3f3a32e8e08a404b11c0a6e08f2fdb7201a63 100644 (file)
@@ -53,7 +53,7 @@ static frame_time_t lastcycle;
 static uae_u32 cycleoffset;
 
 static uae_u32 pcs[16];
-static uae_u32 pcs2[16];
+static uae_u64 pcs2[16];
 extern void activate_debugger (void);
 static int warned;
 
@@ -236,7 +236,7 @@ static int inprec_pstart (uae_u8 type)
                                if (warned > 0) {
                                        warned--;
                                        for (int i = 0; i < 7; i++)
-                                               write_log (_T("%08x (%08x) "), pcs[i], pcs2[i]);
+                                               write_log (_T("%08x (%016llx) "), pcs[i], pcs2[i]);
                                        write_log (_T("\n"));
                                }
                                cycleoffset = (uae_u32)(cycles - cycles2);
@@ -644,10 +644,10 @@ void inprec_playdebug_cpu (int mode)
                        }
                        err = 1;
                } else {
-                       memmove (pcs + 1, pcs, 15 * 4);
+                       memmove(pcs + 1, pcs, 15 * sizeof(uae_u32));
                        pcs[0] = pc1;
-                       memmove (pcs2 + 1, pcs2, 15 * 4);
-                       pcs2[0] = get_cycles ();
+                       memmove(pcs2 + 1, pcs2, 15 * sizeof(uae_u64));
+                       pcs2[0] = get_cycles();
                }
                if (v1 != v2) {
                        if (warned > 0) {
@@ -871,7 +871,7 @@ static int savedisk (const TCHAR *path, const TCHAR *file, uae_u8 *data, uae_u8
                        char *fn = uutf8 (filename);
                        strcpy ((char*)outdata + 2, fn);
                        xfree (fn);
-                       len = 2 + strlen ((char*)outdata + 2) + 1;
+                       len = 2 + uaestrlen((char*)outdata + 2) + 1;
                }
        }
        xfree (fname);
index 4bfd3b33ed79592102671cc1d945961317c816ea..3b4cf78a104acba66aa2db3f8268a02032258148 100644 (file)
@@ -1452,23 +1452,23 @@ static void descramble_alg(uae_u8 *data, int size)
 
 static const uae_char *kickstring = "exec.library";
 
-static int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksum, int noalias)
+static int read_kickstart(struct zfile *f, uae_u8 *mem, int size, int dochecksum, int noalias)
 {
        uae_char buffer[11];
        int i, j, oldpos;
        int cr = 0, kickdisk = 0;
 
        if (size < 0) {
-               zfile_fseek (f, 0, SEEK_END);
+               zfile_fseek(f, 0, SEEK_END);
                size = zfile_ftell32(f) & ~0x3ff;
-               zfile_fseek (f, 0, SEEK_SET);
+               zfile_fseek(f, 0, SEEK_SET);
        }
        oldpos = zfile_ftell32(f);
-       i = zfile_fread (buffer, 1, sizeof(buffer), f);
+       i = zfile_fread32(buffer, 1, sizeof(buffer), f);
        if (i < sizeof(buffer))
                return 0;
-       if (!memcmp (buffer, "KICK", 4)) {
-               zfile_fseek (f, 512, SEEK_SET);
+       if (!memcmp(buffer, "KICK", 4)) {
+               zfile_fseek(f, 512, SEEK_SET);
                kickdisk = 1;
 #if 0
        } else if (size >= ROM_SIZE_512 && !memcmp (buffer, "AMIG", 4)) {
@@ -1476,14 +1476,14 @@ static int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksu
                zfile_fseek (f, oldpos + 0x6c, SEEK_SET);
                cr = 2;
 #endif
-       } else if (memcmp ((uae_char*)buffer, "AMIROMTYPE1", 11) != 0) {
-               zfile_fseek (f, oldpos, SEEK_SET);
+       } else if (memcmp((uae_char*)buffer, "AMIROMTYPE1", 11) != 0) {
+               zfile_fseek(f, oldpos, SEEK_SET);
        } else {
                cloanto_rom = 1;
                cr = 1;
        }
 
-       memset (mem, 0, size);
+       memset(mem, 0, size);
        if (size >= 131072) {
                for (i = 0; i < 8; i++) {
                        mem[size - 16 + i * 2 + 1] = 0x18 + i;
@@ -1494,7 +1494,7 @@ static int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksu
                mem[size - 17] = size >>  0;
        }
 
-       i = zfile_fread (mem, 1, size, f);
+       i = zfile_fread32(mem, 1, size, f);
 
        if (kickdisk && i > ROM_SIZE_256)
                i = ROM_SIZE_256;
@@ -1505,17 +1505,17 @@ static int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksu
        }
 #endif
        if (i < size - 20)
-               kickstart_fix_checksum (mem, size);
+               kickstart_fix_checksum(mem, size);
        j = 1;
        while (j < i)
                j <<= 1;
        i = j;
 
        if (!noalias && i == size / 2)
-               memcpy (mem + size / 2, mem, size / 2);
+               memcpy(mem + size / 2, mem, size / 2);
 
        if (cr) {
-               if (!decode_rom (mem, size, cr, i))
+               if (!decode_rom(mem, size, cr, i))
                        return 0;
        }
 
@@ -1525,26 +1525,26 @@ static int read_kickstart (struct zfile *f, uae_u8 *mem, int size, int dochecksu
        if (currprefs.cs_a1000ram && i < ROM_SIZE_256) {
                int off = 0;
                if (!a1000_bootrom)
-                       a1000_bootrom = xcalloc (uae_u8, ROM_SIZE_256);
+                       a1000_bootrom = xcalloc(uae_u8, ROM_SIZE_256);
                while (off + i < ROM_SIZE_256) {
-                       memcpy (a1000_bootrom + off, kickmem_bank.baseaddr, i);
+                       memcpy(a1000_bootrom + off, kickmem_bank.baseaddr, i);
                        off += i;
                }
-               memset (kickmem_bank.baseaddr, 0, kickmem_bank.allocated_size);
-               a1000_handle_kickstart (1);
+               memset(kickmem_bank.baseaddr, 0, kickmem_bank.allocated_size);
+               a1000_handle_kickstart(1);
                dochecksum = 0;
                i = ROM_SIZE_512;
        }
 
        for (j = 0; j < 256 && i >= ROM_SIZE_256; j++) {
-               if (!memcmp (mem + j, kickstring, strlen (kickstring) + 1))
+               if (!memcmp(mem + j, kickstring, strlen(kickstring) + 1))
                        break;
        }
 
        if (j == 256 || i < ROM_SIZE_256)
                dochecksum = 0;
        if (dochecksum)
-               kickstart_checksum (mem, size);
+               kickstart_checksum(mem, size);
        return i;
 }
 
@@ -3724,7 +3724,7 @@ void loadboardfile(addrbank *ab, struct boardloadfile * lf)
                else if (lf->loadoffset + size > ab->allocated_size)
                        size = ab->allocated_size - lf->loadoffset;
                if (size > 0) {
-                       int total = zfile_fread(ab->baseaddr + lf->loadoffset, 1, size, zf);
+                       int total = zfile_fread32(ab->baseaddr + lf->loadoffset, 1, size, zf);
                        write_log(_T("Expansion file '%s': load %u bytes, offset %u, start addr %08x\n"),
                                lf->loadfile, total, lf->loadoffset, ab->start + lf->loadoffset);
                }
index ab09f45e8fc718ac771058732108069f8212eb49..2f71e14c9f0a27b2fc396d087cf3a035aa952498 100644 (file)
@@ -719,13 +719,13 @@ int AVIOutput_ChooseVideoCodec (HWND hwnd, TCHAR *s, int len)
        pcompvars->dwFlags = 0;
        if (ICCompressorChoose (hwnd, ICMF_CHOOSE_DATARATE | ICMF_CHOOSE_KEYFRAME, lpbi, NULL, pcompvars, "Choose Video Codec") == TRUE) {
                UAEREG *avikey;
-               int ss;
+               LRESULT ss;
                uae_u8 *state;
 
                compressorallocated = TRUE;
                ss = ICGetState (pcompvars->hic, NULL, 0);
                if (ss > 0) {
-                       DWORD err;
+                       LRESULT err;
                        state = xmalloc (uae_u8, ss);
                        err = ICGetState (pcompvars->hic, state, ss);
                        if (err < 0) {
@@ -739,7 +739,7 @@ int AVIOutput_ChooseVideoCodec (HWND hwnd, TCHAR *s, int len)
                        state = xcalloc (uae_u8, 1);
                avikey = openavikey ();
                if (avikey) {
-                       regsetdata (avikey, _T("VideoConfigurationState"), state, ss);
+                       regsetdata (avikey, _T("VideoConfigurationState"), state, (DWORD)ss);
                        regsetdata (avikey, _T("VideoConfigurationVars"), pcompvars, pcompvars->cbSize);
                        storesettings (avikey);
                        regclosetree (avikey);
@@ -1909,7 +1909,7 @@ static int SrcLinear(HWORD X[], HWORD Y[], float factor, ULWORD *Time, UHWORD Nx
                *Y++ = WordToHword(v, Np);   /* Deposit output */
                *Time += dtb;               /* Move to next sample by time increment */
        }
-       return (Y - Ystart);            /* Return number of output samples */
+       return (int)(Y - Ystart);            /* Return number of output samples */
 }
 
 #define IBUFFSIZE 4096                         /* Input buffer size */
index 1b3cea31ce7740990c80cc0a0cd2b5c5b9020131..e36c20c403df7986c1b249022de398cfdf26ea74 100644 (file)
   * Copyright 1996 Bernd Schmidt
   */
 
-#define ALIGN_POINTER_TO32(p) ((~(unsigned long)(p)) & 3)
+#ifdef CPU_64_BIT
+#define ALIGN_POINTER_TO32(p) ((~(uae_u64)(p)) & 3)
+#else
+#define ALIGN_POINTER_TO32(p) ((~(uae_u32)(p)) & 3)
+#endif
 
 STATIC_INLINE uae_u64 do_get_mem_quad(uae_u64 *a)
 {
index 39bd8856007eb659e64455b32c96f194648cf0f6..8947706bdf2feab66cd033b2e261cdaf13f29944 100644 (file)
@@ -1086,8 +1086,8 @@ static void setconvert(int monid)
        gfx_set_picasso_colors(monid, state->RGBFormat);
        picasso_palette(state->CLUT, vidinfo->clut);
        if (vidinfo->host_mode != vidinfo->ohost_mode || state->RGBFormat != vidinfo->orgbformat) {
-               write_log (_T("RTG conversion: Depth=%d HostRGBF=%d P96RGBF=%d Mode=%d\n"),
-                       picasso_vidinfo[monid].pixbytes, vidinfo->host_mode, state->RGBFormat, vidinfo->picasso_convert);
+               write_log (_T("RTG conversion: Depth=%d HostRGBF=%d P96RGBF=%d Mode=%d/%d\n"),
+                       picasso_vidinfo[monid].pixbytes, vidinfo->host_mode, state->RGBFormat, vidinfo->picasso_convert[0], vidinfo->picasso_convert[1]);
                vidinfo->ohost_mode = vidinfo->host_mode;
                vidinfo->orgbformat = state->RGBFormat;
        }
index bef83ab123b67a37b1b193da326bae324575d4f9..cb196a3221877df94f58d5d45c6225f8318b1752 100644 (file)
@@ -213,7 +213,7 @@ void PAL_1x1_32(uae_u32 *src, int pitchs, uae_u32 *trg, int pitcht, int width, i
                wend = 0;
        } else {
                /* alignment: 8 pixels*/
-               wstart = (unsigned int)(8 - ((unsigned long)trg & 7));
+               wstart = (unsigned int)(8 - ((size_t)trg & 7));
                wfast = (width - wstart) >> 3; /* fast loop for 8 pixel segments*/
                wend = (width - wstart) & 0x07; /* do not forget the rest*/
        }
@@ -313,7 +313,7 @@ void PAL_1x1_16(uae_u16 *src, int pitchs, uae_u16 *trg, int pitcht, int width, i
                wend = 0;
        } else {
                /* alignment: 8 pixels*/
-               wstart = (unsigned int)(8 - ((unsigned long)trg & 7));
+               wstart = (unsigned int)(8 - ((size_t)trg & 7));
                wfast = (width - wstart) >> 3; /* fast loop for 8 pixel segments*/
                wend = (width - wstart) & 0x07; /* do not forget the rest*/
        }
index 61d01512f0cf2456ea86400aca4950aaa455d834..bf7b2435f66ad165a7beef4893c11ead4f1ebef0 100644 (file)
@@ -293,20 +293,20 @@ int read_log(void)
 #endif
 }
 
-static void writeconsole_2 (const TCHAR *buffer)
+static void writeconsole_2(const TCHAR *buffer)
 {
        DWORD temp;
 
        if (!consoleopen)
-               openconsole ();
+               openconsole();
 
        if (consoleopen > 0) {
-               WriteOutput (buffer, _tcslen (buffer));
+               WriteOutput(buffer, uaetcslen(buffer));
        } else if (realconsole) {
-               fputws (buffer, stdout);
-               fflush (stdout);
+               fputws(buffer, stdout);
+               fflush(stdout);
        } else if (consoleopen < 0) {
-               WriteConsole (stdoutput, buffer, _tcslen (buffer), &temp, 0);
+               WriteConsole(stdoutput, buffer, uaetcslen(buffer), &temp, 0);
        }
 }
 
@@ -729,7 +729,7 @@ void f_out (void *f, const TCHAR *format, ...)
        va_end (parms);
 }
 
-TCHAR* buf_out (TCHAR *buffer, int *bufsize, const TCHAR *format, ...)
+TCHAR *buf_out(TCHAR *buffer, int *bufsize, const TCHAR *format, ...)
 {
        int count;
        va_list parms;
@@ -737,10 +737,10 @@ TCHAR* buf_out (TCHAR *buffer, int *bufsize, const TCHAR *format, ...)
 
        if (buffer == NULL)
                return 0;
-       count = _vsntprintf (buffer, (*bufsize) - 1, format, parms);
+       count = _vsntprintf(buffer, (*bufsize) - 1, format, parms);
        va_end (parms);
-       *bufsize -= _tcslen (buffer);
-       return buffer + _tcslen (buffer);
+       *bufsize -= uaetcslen(buffer);
+       return buffer + uaetcslen(buffer);
 }
 
 FILE *log_open (const TCHAR *name, int append, int bootlog, TCHAR *outpath)
index 6cb34ddd987418af2ec2fdf99b8c5e0925278d22..086e2c2b658fd5ccbd8656d59572c722d9eba681 100644 (file)
@@ -12,7 +12,7 @@ int inet_aton(const char *cp, struct in_addr *ia);
 int slirp_init(void);
 void slirp_cleanup(void);
 
-int slirp_select_fill(int *pnfds, 
+int slirp_select_fill(INT_PTR *pnfds, 
                                          fd_set *readfds, fd_set *writefds, fd_set *xfds);
 
 void slirp_select_poll(fd_set *readfds, fd_set *writefds, fd_set *xfds);
index b5b5583505a7c8d30cc46aaa742afcf46a09d3ec..7798273ac8f04ff1046190cdb2bcf04bb2e25d8e 100644 (file)
@@ -191,11 +191,11 @@ static void updtime(void)
 }
 #endif
 
-int slirp_select_fill(int *pnfds, 
+int slirp_select_fill(INT_PTR *pnfds, 
                                          fd_set *readfds, fd_set *writefds, fd_set *xfds)
 {
     struct socket *so, *so_next;
-    int nfds;
+       INT_PTR nfds;
     int timeout, tmp_time;
 
     /* fail safe */
index ff5007c6e700dd97cffe53a1843f01a421a6f1e8..1034bef532e2a444bded347151256508ba1a90b3 100644 (file)
@@ -143,7 +143,7 @@ static void slirp_receive_func(void *arg)
        while (slirp_thread_active) {
                // Wait for packets to arrive
                fd_set rfds, wfds, xfds;
-               int nfds;
+               INT_PTR nfds;
                int ret, timeout;
 
                // ... in the output queue
index bef29081abc43a8584a9b23dbd44f96136c482ae..b3c0117c913b2653046cc6907c73b6c68b63244e 100644 (file)
@@ -115,7 +115,8 @@ int8_t floatx80_internal_mode = float_round_nearest_even;
  *----------------------------------------------------------------------------*/
 floatx80 roundSaveFloatx80Internal( int8_t roundingPrecision, flag zSign, int32_t zExp, uint64_t zSig0, uint64_t zSig1, float_status *status )
 {
-    int64_t roundIncrement, roundMask, roundBits;
+    int64_t roundMask, roundBits;
+    uint64_t roundIncrement;
     flag increment;
     
     if ( roundingPrecision == 80 ) {
@@ -226,7 +227,8 @@ static void saveFloat32Internal( flag zSign, int16_t zExp, uint32_t zSig, float_
 
 void getRoundedFloatInternal( int8_t roundingPrecision, flag *pzSign, int32_t *pzExp, uint64_t *pzSig )
 {
-    int64_t roundIncrement, roundMask, roundBits;
+    int64_t roundMask, roundBits;
+    uint64_t roundIncrement;
     flag increment;
 
     flag zSign = floatx80_internal_sign;
@@ -1348,7 +1350,8 @@ floatx80 roundAndPackFloatx80( int8_t roundingPrecision, flag zSign, int32_t zEx
 {
     int8_t roundingMode;
     flag roundNearestEven, increment;
-    int64_t roundIncrement, roundMask, roundBits;
+    int64_t roundMask, roundBits;
+    uint64_t roundIncrement;
     int32_t expOffset;
     
     roundingMode = status->float_rounding_mode;
@@ -1501,7 +1504,8 @@ floatx80 roundSigAndPackFloatx80( int8_t roundingPrecision, flag zSign, int32_t
 {
     int8_t roundingMode;
     flag roundNearestEven, isTiny;
-    int64_t roundIncrement, roundMask, roundBits;
+    int64_t roundMask, roundBits;
+    uint64_t roundIncrement;
     
     roundingMode = status->float_rounding_mode;
     roundNearestEven = ( roundingMode == float_round_nearest_even );
index eb1d3d097b40f56359ef641b0318340c3210e597..e9b50d16b83024fd360a25b5346d2b3b6c725cf7 100644 (file)
--- a/zfile.cpp
+++ b/zfile.cpp
@@ -2244,6 +2244,15 @@ uae_s64 zfile_fseek (struct zfile *z, uae_s64 offset, int mode)
        return 1;
 }
 
+uae_s32 zfile_fread32(void *b, size_t l1, size_t l2, struct zfile *z)
+{
+       size_t s = zfile_fread(b, l1, l2, z);
+       if (s >= (1 << 31)) {
+               return 0;
+       }
+       return (int)s;
+}
+
 size_t zfile_fread(void *b, size_t l1, size_t l2, struct zfile *z)
 {
        if (z->zfileread)