]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Warning fixes
authorToni Wilen <twilen@winuae.net>
Sun, 25 Dec 2022 17:59:01 +0000 (19:59 +0200)
committerToni Wilen <twilen@winuae.net>
Sun, 25 Dec 2022 17:59:01 +0000 (19:59 +0200)
18 files changed:
ar.cpp
arcadia.cpp
archivers/chd/windows/winwork.cpp
blkdev.cpp
blkdev_cdimage.cpp
cd32_fmv.cpp
custom.cpp
disk.cpp
gayle.cpp
gfxutil.cpp
include/sysdeps.h
inputrecord.cpp
od-win32/ahidsound_new.cpp
od-win32/clipboard_win32.cpp
od-win32/debug_win32.cpp
od-win32/picasso96_win.cpp
pcem/vid_voodoo_render.cpp
zfile_archive.cpp

diff --git a/ar.cpp b/ar.cpp
index 50e48469d81a220f1e7c00349dd8b9a5feca58c6..b867fe7b0aeaa842eff59ca7b23739725610027b 100644 (file)
--- a/ar.cpp
+++ b/ar.cpp
@@ -1415,7 +1415,7 @@ static void disable_rom_test (void)
        */
 
        if (armodel == 1) {
-               uae_u16 search_value_rel = end_addr - start_addr;
+               uae_u16 search_value_rel = addrdiff(end_addr, start_addr);
                addr = find_relative_word(start_addr, end_addr, search_value_rel);
 
                if (addr) {
@@ -1427,7 +1427,7 @@ static void disable_rom_test (void)
                        }
                }
        } else {
-               uae_u32 search_value_abs = arrom_start + end_addr - start_addr;
+               uae_u32 search_value_abs = arrom_start + addrdiff(end_addr, start_addr);
                addr = find_absolute_long (start_addr, end_addr, search_value_abs);
 
                if (addr) {
index 1e0dbe7d40373ba86a1e93fa8e07b73f4a27dc0d..7a94107aa92387c217582a2b0e3d3b9d8e1e6000 100644 (file)
@@ -1122,7 +1122,7 @@ int touch_serial_write(void)
                        sprintf((char*)p, "%03d", y);
                        p += 3;
                        *p++ = 0x0d;
-                       touch_write_buf_offset = p - touch_data_w;
+                       touch_write_buf_offset = addrdiff(p, touch_data_w);
 
                        cubo_flag |= 0x40000000;
                }
index adf46fb43e6c6933495b82333a3bb648134655a5..bbc4fd8d5207f4002cafe4aae4c0415a531698ee 100644 (file)
@@ -58,6 +58,7 @@
 #undef YieldProcessor
 #endif
 
+#if 0
 #ifndef YieldProcessor
 #ifdef __GNUC__
 INLINE void YieldProcessor(void)
@@ -71,7 +72,7 @@ INLINE void YieldProcessor(void)
 }
 #endif
 #endif
-
+#endif
 
 
 //============================================================
index c6cfa11414aac0206a7c1f1295a5db1727abfe68..19608d7d4146d4e4aae2018376246cdb06e23569 100644 (file)
@@ -1886,7 +1886,7 @@ int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len,
                                        strack++;
                                }
                                addtocentry (&p2, &maxlen, 0xa2, 0xaa, msf, p, toc);                            
-                               int tlen = p2 - (p + 2);
+                               int tlen = addrdiff(p2, p + 2);
                                p[0] = tlen >> 8;
                                p[1] = tlen >> 0;
                                scsi_len = tlen + 2;
index 13adfbd303ce7d8cf0f4b06125a9c7f7a2cd365c..78635dcb4f49783e6cbcc1e519c4c6ea8d97d77c 100644 (file)
@@ -338,12 +338,12 @@ static int getsub_deinterleaved (uae_u8 *dst, struct cdunit *cdu, struct cdtoc *
                // regenerate Q-subchannel
                uae_u8 *s = dst + SUB_ENTRY_SIZE;
                s[0] = (t->ctrl << 4) | (t->adr << 0);
-               s[1] = tobcd (t - &cdu->toc[0] + 1);
-               s[2] = tobcd (1);
-               int msf = lsn2msf (sector);
-               tolongbcd (s + 7, msf);
-               msf = lsn2msf (sector - t->address - 150);
-               tolongbcd (s + 3, msf);
+               s[1] = tobcd(addrdiff(t, &cdu->toc[0] + 1));
+               s[2] = tobcd(1);
+               int msf = lsn2msf(sector);
+               tolongbcd(s + 7, msf);
+               msf = lsn2msf(addrdiff(sector, t->address - 150));
+               tolongbcd(s + 3, msf);
                ret = 2;
        }
        if (ret == 1) {
@@ -432,15 +432,15 @@ static void cdda_unpack_func (void *v)
        cdimage_unpack_thread = -1;
 }
 
-static void audio_unpack (struct cdunit *cdu, struct cdtoc *t)
+static void audio_unpack(struct cdunit *cdu, struct cdtoc *t)
 {
        // do this even if audio is not compressed, t->handle also could be
        // compressed and we want to unpack it in background too
        while (cdimage_unpack_active == 1)
                sleep_millis(10);
        cdimage_unpack_active = 0;
-       write_comm_pipe_u32 (&unpack_pipe, cdu - &cdunits[0], 0);
-       write_comm_pipe_u32 (&unpack_pipe, t - &cdu->toc[0], 1);
+       write_comm_pipe_u32(&unpack_pipe, addrdiff(cdu, &cdunits[0]), 0);
+       write_comm_pipe_u32(&unpack_pipe, addrdiff(t, &cdu->toc[0]), 1);
        while (cdimage_unpack_active == 0)
                sleep_millis(10);
 }
@@ -1040,7 +1040,7 @@ static int command_rawread (int unitnum, uae_u8 *data, int sector, int size, int
                                        p += SUB_CHANNEL_SIZE;
                                }
                        }
-                       ret += p - data;
+                       ret += addrdiff(p, data);
                        data = p;
                        sector++;
                }
index f44f662fbc89c9875c20d5799bfb30b6827fc192..0c69f00f0e779a6e0440593df9bc79e90f6cf6c1 100644 (file)
@@ -627,9 +627,9 @@ static void l64111_parse(void)
        }
 
        if (audio_frame_size && audio_data_remaining)
-               p += l64111_get_frame(p, L64111_FIFO_BYTES - (p - l64111_fifo));
+               p += l64111_get_frame(p, L64111_FIFO_BYTES - addrdiff(p, l64111_fifo));
 
-       while (p - l64111_fifo < L64111_FIFO_LOOKUP || ((p - l64111_fifo) & 1)) {
+       while (p - l64111_fifo < L64111_FIFO_LOOKUP || (addrdiff(p, l64111_fifo) & 1)) {
                uae_u8 *op = p;
                int size = 0;
 
@@ -664,16 +664,16 @@ static void l64111_parse(void)
                }
 
                if (audio_skip_size) {
-                       int size = audio_skip_size > L64111_FIFO_BYTES - (p - l64111_fifo) ? L64111_FIFO_BYTES - (p - l64111_fifo) : audio_skip_size;
+                       int size = audio_skip_size > L64111_FIFO_BYTES - addrdiff(p, l64111_fifo) ? L64111_FIFO_BYTES - addrdiff(p, l64111_fifo) : audio_skip_size;
                        p += size;
                        audio_skip_size -= size;
                }
                if (L64111_FIFO_BYTES - (p - l64111_fifo) > 0 && audio_data_remaining) {
                        if (audio_frame_size) {
-                               p += l64111_get_frame(p, L64111_FIFO_BYTES - (p - l64111_fifo));
+                               p += l64111_get_frame(p, L64111_FIFO_BYTES - addrdiff(p, l64111_fifo));
                        } else if (p[0] == 0xff && (p[1] & (0x80 | 0x40 | 0x20)) == (0x80 | 0x40 | 0x20)) {
                                if (parse_mp2_frame(p))
-                                       p += l64111_get_frame(p, L64111_FIFO_BYTES - (p - l64111_fifo));
+                                       p += l64111_get_frame(p, L64111_FIFO_BYTES - addrdiff(p, l64111_fifo));
                        }
                }
 
@@ -683,7 +683,7 @@ static void l64111_parse(void)
                                audio_data_remaining--;
                }
        }
-       l64111_fifo_cnt = L64111_FIFO_BYTES - (p - l64111_fifo);
+       l64111_fifo_cnt = L64111_FIFO_BYTES - addrdiff(p, l64111_fifo);
        if (l64111_fifo_cnt < 0)
                l64111_fifo_cnt = 0;
        if (l64111_fifo_cnt > 0)
index 288b12fb491049709f6da4a45724e6c5cf4dde41..734a185c38a5edefaf2f00c128c31a4dacfcc392 100644 (file)
@@ -3101,7 +3101,8 @@ STATIC_INLINE void do_delays_3_aga_hr(int nbits, int fm)
                        if (cmd & TOSCR_SPC_HIRES_END) {
                                toscr_res_pixels_mask_hr = 1 >> toscr_res_pixels_shift_hr;
                        }
-                       toscr_special_skip_ptr += 1 << toscr_res_pixels_shift_hr;
+                       int sh = 1 << toscr_res_pixels_shift_hr;
+                       toscr_special_skip_ptr += sh;
                        if (*toscr_special_skip_ptr == 0) {
                                toscr_special_skip_ptr = NULL;
                                break;
index 76b202d0d0a6c1a5b0ef0035de3860b9c95c3df0..f83e37cf6626652d1579d0671bfcd5a692f16fbd 100644 (file)
--- a/disk.cpp
+++ b/disk.cpp
@@ -2103,7 +2103,7 @@ static void decode_pcdos (drive *drv)
        while (dstmfmbuf - drv->bigmfmbuf < tracklen / 2)
                *dstmfmbuf++ = 0x9254;
        drv->skipoffset = 0;
-       drv->tracklen = (dstmfmbuf - drv->bigmfmbuf) * 16;
+       drv->tracklen = addrdiff(dstmfmbuf, drv->bigmfmbuf) * 16;
        if (disk_debug_logging > 0)
                write_log (_T("pcdos read track %d\n"), tr);
 }
index 0555e5158515776007d90a43e14bd94a4c7da722..8e9e6f3077810f1e1a1b4807277f64360ce2a05f 100644 (file)
--- a/gayle.cpp
+++ b/gayle.cpp
@@ -1278,7 +1278,7 @@ static void initscideattr (int readonly)
        strcpy ((char*)p, "Generic Emulated PCMCIA IDE");
        p += strlen ((char*)p) + 1;
        *p++= 0xff;
-       *rp = p - rp - 1;
+       *rp = addrdiff(p, rp - 1);
 
        /* CISTPL_FUNCID */
        *p++ = 0x21;
@@ -1380,7 +1380,7 @@ static void initsramattr (int size, int readonly)
        sprintf ((char*)p, "Generic Emulated %dKB PCMCIA SRAM Card", size >> 10);
        p += strlen ((char*)p) + 1;
        *p++= 0xff;
-       *rp = p - rp - 1;
+       *rp = addrdiff(p, rp - 1);
 
        /* CISTPL_FUNCID */
        *p++ = 0x21;
index 121854f48c67ac224b2666bd71f257f87023358d..50f4f5d14c353b334029959f200aba58f4d93837 100644 (file)
@@ -13,6 +13,7 @@
 #include "rtgmodes.h"
 #include "xwin.h"
 #include "gfxfilter.h"
+#include "machdep/maccess.h"
 
 #include <math.h>
 
@@ -330,7 +331,7 @@ void alloc_colors_picasso (int rw, int gw, int bw, int rs, int gs, int bs, int r
                int lbmask = (1 << blue_bits) - 1;
                for (i = 65535; i >= 0; i--) {
                        uae_u32 r, g, b, c;
-                       uae_u32 j = byte_swap ? bswap_16 (i) : i;
+                       uae_u32 j = byte_swap ? do_byteswap_16(i) : i;
                        r = (((j >>   red_shift) & lrmask) << lrbits) | lowbits (j,   red_shift, lrbits);
                        g = (((j >> green_shift) & lgmask) << lgbits) | lowbits (j, green_shift, lgbits);
                        b = (((j >>  blue_shift) & lbmask) << lbbits) | lowbits (j,  blue_shift, lbbits);
@@ -364,13 +365,13 @@ void alloc_colors_rgb (int rw, int gw, int bw, int rs, int gs, int bs, int aw, i
 
                if (byte_swap) {
                        if (bpp <= 16) {
-                               rc[i] = bswap_16 (rc[i]);
-                               gc[i] = bswap_16 (gc[i]);
-                               bc[i] = bswap_16 (bc[i]);
+                               rc[i] = do_byteswap_16(rc[i]);
+                               gc[i] = do_byteswap_16(gc[i]);
+                               bc[i] = do_byteswap_16 (bc[i]);
                        } else {
-                               rc[i] = bswap_32 (rc[i]);
-                               gc[i] = bswap_32 (gc[i]);
-                               bc[i] = bswap_32 (bc[i]);
+                               rc[i] = do_byteswap_32(rc[i]);
+                               gc[i] = do_byteswap_32(gc[i]);
+                               bc[i] = do_byteswap_32(bc[i]);
                        }
                }
                if (bpp <= 16) {
@@ -406,9 +407,9 @@ void alloc_colors64k(int monid, int rw, int gw, int bw, int rs, int gs, int bs,
                xcolors[i] = doMask(r, rw, rs) | doMask(g, gw, gs) | doMask(b, bw, bs) | doAlpha(alpha, aw, as);
                if (byte_swap) {
                        if (bpp <= 16) {
-                               xcolors[i] = bswap_16(xcolors[i]);
+                               xcolors[i] = do_byteswap_16(xcolors[i]);
                        } else {
-                               xcolors[i] = bswap_32(xcolors[i]);
+                               xcolors[i] = do_byteswap_32(xcolors[i]);
                        }
                }
                if (bpp <= 16) {
@@ -469,9 +470,9 @@ void alloc_colors64k(int monid, int rw, int gw, int bw, int rs, int gs, int bs,
                        xcolors[i] = doMask(r, 5, 11) | doMask(g, 6, 5) | doMask(b, 5, 0);
                        if (byte_swap) {
                                if (bpp <= 16)
-                                       xcolors[i] = bswap_16 (xcolors[i]);
+                                       xcolors[i] = do_byteswap_16(xcolors[i]);
                                else
-                                       xcolors[i] = bswap_32 (xcolors[i]);
+                                       xcolors[i] = do_byteswap_32(xcolors[i]);
                        }
                        if (bpp <= 16) {
                                /* Fill upper 16 bits of each colour value
index de16bb2077bbed62155f0540a2dd87404090fc96..8e7ac28e46cb1e24b296010b31377c3a2b5047fc 100644 (file)
@@ -79,6 +79,12 @@ using namespace std;
 
 #include <tchar.h>
 
+#if CPU_64_BIT
+#define addrdiff(a, b) ((int)((a) - (b)))
+#else
+#define addrdiff(a, b) ((a) - (b))
+#endif
+
 #ifndef __STDC__
 #ifndef _MSC_VER
 #error "Your compiler is not ANSI. Get a real one."
@@ -508,29 +514,6 @@ extern bool use_long_double;
  */
 #define CPU_EMU_SIZE 0
 
-/*
- * Byte-swapping functions
- */
-
-/* Try to use system bswap_16/bswap_32 functions. */
-#if defined HAVE_BSWAP_16 && defined HAVE_BSWAP_32
-# include <byteswap.h>
-#  ifdef HAVE_BYTESWAP_H
-#  include <byteswap.h>
-# endif
-#else
-/* Else, if using SDL, try SDL's endian functions. */
-# ifdef USE_SDL
-#  include <SDL_endian.h>
-#  define bswap_16(x) SDL_Swap16(x)
-#  define bswap_32(x) SDL_Swap32(x)
-# else
-/* Otherwise, we'll roll our own. */
-#  define bswap_16(x) (((x) >> 8) | (((x) & 0xFF) << 8))
-#  define bswap_32(x) (((x) << 24) | (((x) << 8) & 0x00FF0000) | (((x) >> 8) & 0x0000FF00) | ((x) >> 24))
-# endif
-#endif
-
 #ifndef __cplusplus
 
 #define xmalloc(T, N) malloc(sizeof (T) * (N))
index 23c3f3a32e8e08a404b11c0a6e08f2fdb7201a63..a4fa99fe90d488431f223dde25beb6792b32e0f6 100644 (file)
@@ -135,7 +135,7 @@ static void inprec_rend (void)
 {
        if (!input_record || !inprec_zf)
                return;
-       int size = inprec_p - inprec_plast;
+       int size = addrdiff(inprec_p, inprec_plast);
        inprec_plast[1] = size >> 8;
        inprec_plast[2] = size >> 0;
        flush ();
@@ -150,7 +150,7 @@ static bool inprec_realtime (bool stopstart)
        write_log (_T("INPREC: play -> record\n"));
        input_record = INPREC_RECORD_RERECORD;
        input_play = 0;
-       int offset = inprec_p - inprec_buffer;
+       int offset = addrdiff(inprec_p, inprec_buffer);
        zfile_fseek (inprec_zf, offset, SEEK_SET);
        zfile_truncate (inprec_zf, offset);
        xfree (inprec_buffer);
@@ -401,7 +401,7 @@ int inprec_open (const TCHAR *fname, const TCHAR *statefilename)
                i = inprec_pu32 ();
                while (i-- > 0)
                        inprec_pu8 ();
-               header_end = inprec_plastptr - inprec_buffer;
+               header_end = addrdiff(inprec_plastptr, inprec_buffer);
                inprec_pstr (savestate_fname);
                if (savestate_fname[0]) {
                        savestate_state = STATE_RESTORE;
@@ -445,7 +445,7 @@ int inprec_open (const TCHAR *fname, const TCHAR *statefilename)
                        }
                }
                inprec_p = inprec_plastptr;
-               header_end2 = inprec_plastptr - inprec_buffer;
+               header_end2 = addrdiff(inprec_plastptr,  inprec_buffer);
                findlast ();
        } else if (input_record) {
                seed = uaesrand (seed);
@@ -749,7 +749,7 @@ int inprec_getposition (void)
 {
        int pos = -1;
        if (input_play == INPREC_PLAY_RERECORD) {
-               pos = inprec_p - inprec_buffer;
+               pos = addrdiff(inprec_p, inprec_buffer);
        } else if (input_record) {
                pos = zfile_ftell32(inprec_zf);
        }
index f9bf6c77d4fa42b7a72dd8ad328043f9309d5a73..16abd70155a7557352cfa25d54a8bf1e990c4018 100644 (file)
@@ -981,7 +981,7 @@ static void dorecord (struct DSAHI *dsahip)
        if (recordbuf == 0 || !valid_address (recordbuf, bytes))
                return;
        alClear ();
-       alcCaptureSamples(dsahip->al_recorddev, (void*)recordbuf, dsahip->record_samples);
+       alcCaptureSamples(dsahip->al_recorddev, get_real_address(recordbuf), dsahip->record_samples);
        if (alGetError () != AL_NO_ERROR)
                return;
        put_word (pbase + pub_RecordHookDone, 0);
index 43901f61674ffde57a4d6d5d6d9c78e033573c05..4cfc29d4a251c0aec9d341ee3dd9dc258e327405 100644 (file)
@@ -569,8 +569,10 @@ static void from_iff_ilbm(uae_u8 *saddr, uae_u32 len)
                        bmpw = (w * (bmpdepth / 8) + 3) & ~3;
 
                        bmsize = sizeof (BITMAPINFO);
-                       if (bmpdepth <= 8)
-                               bmsize += (1 << planes) * sizeof (RGBQUAD);
+                       if (bmpdepth <= 8) {
+                               int psize = (1 << planes);
+                               bmsize += psize * sizeof (RGBQUAD);
+                       }
                        bmih = (BITMAPINFO*)xcalloc (uae_u8, bmsize);
                        bmih->bmiHeader.biSize = sizeof (bmih->bmiHeader);
                        bmih->bmiHeader.biWidth = w;
index a37fca0729d896c4280192420122a32e56407857..a3e2a63a56e8a35e484963a1392550136a989d2a 100644 (file)
@@ -106,7 +106,7 @@ static void OutputCurrHistNode(HWND hWnd)
                GetWindowText(hWnd, buf, txtlen + 1);
                if (_tcscmp(buf, currhist->command)) {
                        SetWindowText(hWnd, currhist->command);
-                       txtlen = _tcslen(currhist->command);
+                       txtlen = uaetcslen(currhist->command);
                        SendMessage(hWnd, EM_SETSEL, (WPARAM)txtlen, (LPARAM)txtlen);
                        SendMessage(hWnd, EM_SETSEL, -1, -1);
                }
@@ -189,7 +189,7 @@ int GetInput (TCHAR *out, int maxlen)
        if (chars == 0)
                return 0;
        WriteOutput(linebreak + 1, 2);
-       WriteOutput(out, _tcslen(out));
+       WriteOutput(out, uaetcslen(out));
        WriteOutput(linebreak + 1, 2);
        AddToHistory(out);
        SetWindowText(hInput, _T(""));
@@ -199,7 +199,8 @@ int GetInput (TCHAR *out, int maxlen)
 static int CheckLineLimit(HWND hWnd, const TCHAR *out)
 {
        TCHAR *tmp, *p;
-       int lines_have, lines_new = 0, lastchr, txtlen, visible;
+       int lines_new = 0, txtlen, visible;
+       LRESULT lines_have, lastchr;
 
        tmp = (TCHAR *)out;
        lines_have = SendMessage(hWnd, EM_GETLINECOUNT, 0, 0);
@@ -228,7 +229,8 @@ static int CheckLineLimit(HWND hWnd, const TCHAR *out)
 
 void WriteOutput(const TCHAR *out, int len)
 {
-       int txtlen, pos = 0, count, index, leave = 0;
+       int pos = 0, leave = 0;
+       LRESULT count, index, txtlen;
        TCHAR *buf = 0, *p, *tmp;
 
        if (!hOutput || !_tcscmp(out, _T(">")) || len == 0)
@@ -239,7 +241,7 @@ void WriteOutput(const TCHAR *out, int len)
        for(;;) {
                p = _tcschr(tmp, '\n');
                if (p) {
-                       pos = p - tmp + 1;
+                       pos = addrdiff(p, tmp + 1);
                        if (pos > (MAX_LINEWIDTH + 1))
                                pos = MAX_LINEWIDTH + 1;
                        buf = xcalloc(TCHAR, pos + 2);
@@ -275,7 +277,7 @@ static HWND ulbs_hwnd;
 static int ulbs_pos;
 static void UpdateListboxString(HWND hWnd, int pos, TCHAR *out, int mark)
 {
-       int count;
+       LRESULT count;
        TCHAR text[MAX_LINEWIDTH + 1], *p;
        COLORREF cr;
 
@@ -325,14 +327,15 @@ static void ULBST(const TCHAR *format, ...)
 
 static int GetLBOutputLines(HWND hWnd)
 {
-       int lines = 0, clientsize, itemsize;
+       int lines = 0;
+       LRESULT itemsize, clientsize;
        RECT rc;
 
        GetClientRect(hWnd, &rc);
        clientsize = rc.bottom - rc.top;
        itemsize = SendMessage(hWnd, LB_GETITEMHEIGHT, 0, 0);
        while (clientsize > itemsize) {
-               lines ++;
+               lines++;
                clientsize -= itemsize;
        }
        return lines;
@@ -509,7 +512,8 @@ static void ShowCustom(void)
 static void ShowBreakpoints(void)
 {
        HWND hBrkpts;
-       int i, lines_old, got;
+       int i, got;
+       LRESULT lines_old;
        TCHAR outbp[MAX_LINEWIDTH + 1], outw[50];
 
        hBrkpts = GetDlgItem(hDbgWnd, IDC_DBG_BRKPTS);
@@ -548,7 +552,8 @@ static void ShowBreakpoints(void)
 static void ShowMem(int offset)
 {
        uae_u32 addr;
-       int i, lines_old, lines_new;
+       int i, lines_new;
+       LRESULT lines_old;
        TCHAR out[MAX_LINEWIDTH + 1];
        HWND hMemory;
 
@@ -591,7 +596,8 @@ static int GetPrevAddr(uae_u32 addr, uae_u32 *prevaddr)
 static void ShowDasm(int direction)
 {
        uae_u32 addr = 0, prev;
-       int i, lines_old, lines_new;
+       int i, lines_new;
+       LRESULT lines_old;
        TCHAR out[MAX_LINEWIDTH + 1];
        HWND hDasm;
 
@@ -738,7 +744,7 @@ static int GetTextSize(HWND hWnd, TCHAR *text, int width)
        if (!width)
                return tm.tmHeight + tm.tmExternalLeading;
        else if (text)
-               return tm.tmMaxCharWidth * _tcslen(text);
+               return tm.tmMaxCharWidth * uaetcslen(text);
        return 0;
 }
 
@@ -824,7 +830,7 @@ static LRESULT CALLBACK MemInputProc (HWND hWnd, UINT message, WPARAM wParam, LP
                case 0x16:              //ctrl+v
                        break;
                default:
-                       if (!debugger_active || !_tcschr(allowed, wParam))
+                       if (!debugger_active || !_tcschr(allowed, (TCHAR)wParam))
                                return 0;
                        break;
                }
@@ -943,7 +949,7 @@ static void CopyListboxText(HWND hwnd, BOOL all)
        if (!OpenClipboard(hwnd))
                return;
        EmptyClipboard();
-       if ((count = SendMessage(hwnd, LB_GETCOUNT, 0, 0)) < 1)
+       if ((count = (int)SendMessage(hwnd, LB_GETCOUNT, 0, 0)) < 1)
                return;
        if (all) {
                start = 0;
@@ -955,7 +961,7 @@ static void CopyListboxText(HWND hwnd, BOOL all)
                end = start + 1;
        }
        for (i = start; i < end; i++)
-               size += (SendMessage(hwnd, LB_GETTEXTLEN, i, 0) + 2);
+               size += (int)(SendMessage(hwnd, LB_GETTEXTLEN, i, 0) + 2);
        size++;
        hdata = GlobalAlloc(GMEM_MOVEABLE, size * sizeof (TCHAR));
        if (hdata) {
@@ -963,7 +969,7 @@ static void CopyListboxText(HWND hwnd, BOOL all)
                lptstr = (LPWSTR)GlobalLock(hdata);
                lptstr[size - 1] = '\0';
                for (i = start; i < end; i++) {
-                       int len = SendMessage(hwnd, LB_GETTEXTLEN, i, 0);
+                       int len = (int)SendMessage(hwnd, LB_GETTEXTLEN, i, 0);
                        SendMessage(hwnd, LB_GETTEXT, i, (LPARAM)lptstr);
                        lptstr[len] = '\r';
                        lptstr[len + 1] = '\n';
@@ -1145,7 +1151,7 @@ static LRESULT CALLBACK ListboxEditProc(HWND hWnd, UINT message, WPARAM wParam,
                        ListboxEndEdit(hparent, FALSE);
                        return 0;
                default:
-                       if (!_tcschr(allowed, wParam))
+                       if (!_tcschr(allowed, (TCHAR)wParam))
                                return 0;
                        break;
                }
@@ -1246,7 +1252,7 @@ static void ListboxEdit(HWND hwnd, int x, int y)
        else if (id == IDC_DBG_FPREG)
                length = 20;
        else
-               length = _tcslen(txt + offset);
+               length = uaetcslen(txt + offset);
        _tcsncpy(tmp, txt, offset);
        tmp[offset] = '\0';
        ri.left += GetTextSize(hwnd, tmp, TRUE);
@@ -1375,9 +1381,9 @@ static LRESULT CALLBACK ListboxProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
                height = rc.bottom - rc.top;
                width = rc.right - rc.left;
                bottom = rc.bottom;
-               itemheight = SendMessage(hWnd, LB_GETITEMHEIGHT, 0, 0);
+               itemheight = (int)SendMessage(hWnd, LB_GETITEMHEIGHT, 0, 0);
                rc.bottom = itemheight;
-               count = SendMessage(hWnd, LB_GETCOUNT, 0, 0);
+               count = (int)SendMessage(hWnd, LB_GETCOUNT, 0, 0);
                compdc = CreateCompatibleDC(hdc);
                compbmp = CreateCompatibleBitmap(hdc, width, height);
                oldbmp = (HBITMAP)SelectObject(compdc, compbmp);
@@ -1390,7 +1396,7 @@ static LRESULT CALLBACK ListboxProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
                dis.itemState = 0;
                dis.hwndItem = hWnd;
                dis.hDC = compdc;
-               top = SendMessage(hWnd, LB_GETTOPINDEX, 0, 0);
+               top = (int)SendMessage(hWnd, LB_GETTOPINDEX, 0, 0);
                for (i = top; i < count && rc.top < height; i++) {
                        dis.itemID = i;
                        dis.rcItem = rc;
@@ -1930,7 +1936,7 @@ static INT_PTR CALLBACK DebuggerProc (HWND hDlg, UINT message, WPARAM wParam, LP
                        SetBkMode(hdc, TRANSPARENT);
                        if (wParam == IDC_DBG_STATUS) {
                                SetTextColor(hdc, GetSysColor(pstatuscolor[pdis->itemID]));
-                               DrawText(hdc, pname[pdis->itemID], _tcslen(pname[pdis->itemID]), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
+                               DrawText(hdc, pname[pdis->itemID], uaetcslen(pname[pdis->itemID]), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
                                return TRUE;
                        }
                        else {
@@ -1947,7 +1953,7 @@ static INT_PTR CALLBACK DebuggerProc (HWND hDlg, UINT message, WPARAM wParam, LP
                                        FillRect(hdc, &rc, GetSysColorBrush(COLOR_WINDOW));
                                        SetBkColor(hdc, GetSysColor(COLOR_WINDOW));
                                }
-                               SetTextColor(hdc, pdis->itemData);
+                               SetTextColor(hdc, (COLORREF)pdis->itemData);
                                if (wParam == IDC_DBG_DASM || wParam == IDC_DBG_DASM2) {
                                        TCHAR addrstr[11] = { '0', 'x', '\0'}, *btemp;
                                        int i, j, size = rc.bottom - rc.top;
@@ -1973,7 +1979,7 @@ static INT_PTR CALLBACK DebuggerProc (HWND hDlg, UINT message, WPARAM wParam, LP
                                                        if (btemp)
                                                                _tcsncpy(addrstr + 2, btemp + 4, 8);
                                                        else {
-                                                               int pos = 34 + _tcslen(ucbranch[i]) + 3;
+                                                               int pos = 34 + uaetcslen(ucbranch[i]) + 3;
                                                                if (text[pos] == '$')   //absolute addressing
                                                                        _tcsncpy(addrstr + 2, text + pos + 1, 8);
                                                                else if (text[pos] == '(' && _istdigit(text[pos + 2])) { //address register indirect
@@ -2021,10 +2027,10 @@ static INT_PTR CALLBACK DebuggerProc (HWND hDlg, UINT message, WPARAM wParam, LP
                                                SetBkColor(hdc, GetSysColor(COLOR_HIGHLIGHT));
                                                SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
                                        }
-                                       TextOut(hdc, rc.left, rc.top, text, _tcslen(text));
+                                       TextOut(hdc, rc.left, rc.top, text, uaetcslen(text));
                                        i = 0;
                                        while (markinstr[i])  {
-                                               if (!_tcsncmp(text + 34, markinstr[i], _tcslen(markinstr[i]))) {
+                                               if (!_tcsncmp(text + 34, markinstr[i], uaetcslen(markinstr[i]))) {
                                                        MoveToEx(hdc, rc.left, rc.bottom - 1, NULL);
                                                        LineTo(hdc, rc.right, rc.bottom - 1);
                                                        break;
@@ -2035,12 +2041,12 @@ static INT_PTR CALLBACK DebuggerProc (HWND hDlg, UINT message, WPARAM wParam, LP
                                                DrawFocusRect(hdc, &rc);
                                }
                                else if (wParam == IDC_DBG_MEM || wParam == IDC_DBG_MEM2) {
-                                       TextOut(hdc, rc.left, rc.top, text, _tcslen(text));
+                                       TextOut(hdc, rc.left, rc.top, text, uaetcslen(text));
                                        if ((pdis->itemState) & (ODS_SELECTED))
                                                DrawFocusRect(hdc, &rc);
                                }
                                else
-                                       TextOut(hdc, rc.left, rc.top, text, _tcslen(text));
+                                       TextOut(hdc, rc.left, rc.top, text, uaetcslen(text));
                                return TRUE;
                        }
                        break;
@@ -2117,7 +2123,7 @@ int console_get_gui (TCHAR *out, int maxlen)
                                console_out(internalcmd);
                                console_out(_T("\n"));
                                _tcsncpy(out, internalcmd, maxlen);
-                               return _tcslen(out);
+                               return uaetcslen(out);
                        }
                        else
                                return GetInput(out, maxlen);
index 85769282579d4296fa1f2e2396f00ac4441b69b9..8ba3430e0c5c0dee058cc9006508a567e962f294 100644 (file)
@@ -3698,7 +3698,8 @@ static uae_u32 REGPARAM2 picasso_BlitPattern(TrapContext *ctx)
 
                uae_u16 *tmplbuf = NULL;
                if (indirect) {
-                       tmplbuf = xcalloc(uae_u16, 1 << pattern.Size);
+                       int size = 1 << pattern.Size;
+                       tmplbuf = xcalloc(uae_u16, size);
                        trap_get_words(ctx, tmplbuf, pattern.AMemory, 1 << pattern.Size);
                }
 
index f8ad7a4fe3f08a30a543cd146e090a9c8cfdb8b5..9a5118d1d8cfae1d95d2acf3b2e13d32ca333ff9 100644 (file)
@@ -1,5 +1,5 @@
 
-#include <emmintrin.h>
+#include <intrin.h>
 
 #include <math.h>
 #include <stddef.h>
index 4262e8e6904e3bd7d47edde5a3d97837734b728d..0581907e200f5d6540817e6134a0f3686c48601e 100644 (file)
@@ -1337,7 +1337,7 @@ static void recursesfs (struct znode *zn, int root, TCHAR *name, int sfs2)
                                znnew = zvolume_addfile_abs (zv, &zai);
                                if (znnew) {
                                        znnew->offset = block;
-                                       znnew->offset2 = p - adf->block;
+                                       znnew->offset2 = addrdiff(p, adf->block);
                                }
                        }
                        xfree (zai.comment);