From 705502c97270a25a8958ebc6089cf419ebc710c7 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 25 Dec 2022 19:59:01 +0200 Subject: [PATCH] Warning fixes --- ar.cpp | 4 +- arcadia.cpp | 2 +- archivers/chd/windows/winwork.cpp | 3 +- blkdev.cpp | 2 +- blkdev_cdimage.cpp | 20 +++++----- cd32_fmv.cpp | 12 +++--- custom.cpp | 3 +- disk.cpp | 2 +- gayle.cpp | 4 +- gfxutil.cpp | 23 +++++------ include/sysdeps.h | 29 +++----------- inputrecord.cpp | 10 ++--- od-win32/ahidsound_new.cpp | 2 +- od-win32/clipboard_win32.cpp | 6 ++- od-win32/debug_win32.cpp | 64 +++++++++++++++++-------------- od-win32/picasso96_win.cpp | 3 +- pcem/vid_voodoo_render.cpp | 2 +- zfile_archive.cpp | 2 +- 18 files changed, 94 insertions(+), 99 deletions(-) diff --git a/ar.cpp b/ar.cpp index 50e48469..b867fe7b 100644 --- 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) { diff --git a/arcadia.cpp b/arcadia.cpp index 1e0dbe7d..7a94107a 100644 --- a/arcadia.cpp +++ b/arcadia.cpp @@ -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; } diff --git a/archivers/chd/windows/winwork.cpp b/archivers/chd/windows/winwork.cpp index adf46fb4..bbc4fd8d 100644 --- a/archivers/chd/windows/winwork.cpp +++ b/archivers/chd/windows/winwork.cpp @@ -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 //============================================================ diff --git a/blkdev.cpp b/blkdev.cpp index c6cfa114..19608d7d 100644 --- a/blkdev.cpp +++ b/blkdev.cpp @@ -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; diff --git a/blkdev_cdimage.cpp b/blkdev_cdimage.cpp index 13adfbd3..78635dcb 100644 --- a/blkdev_cdimage.cpp +++ b/blkdev_cdimage.cpp @@ -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++; } diff --git a/cd32_fmv.cpp b/cd32_fmv.cpp index f44f662f..0c69f00f 100644 --- a/cd32_fmv.cpp +++ b/cd32_fmv.cpp @@ -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) diff --git a/custom.cpp b/custom.cpp index 288b12fb..734a185c 100644 --- a/custom.cpp +++ b/custom.cpp @@ -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; diff --git a/disk.cpp b/disk.cpp index 76b202d0..f83e37cf 100644 --- 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); } diff --git a/gayle.cpp b/gayle.cpp index 0555e515..8e9e6f30 100644 --- 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; diff --git a/gfxutil.cpp b/gfxutil.cpp index 121854f4..50f4f5d1 100644 --- a/gfxutil.cpp +++ b/gfxutil.cpp @@ -13,6 +13,7 @@ #include "rtgmodes.h" #include "xwin.h" #include "gfxfilter.h" +#include "machdep/maccess.h" #include @@ -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 diff --git a/include/sysdeps.h b/include/sysdeps.h index de16bb20..8e7ac28e 100644 --- a/include/sysdeps.h +++ b/include/sysdeps.h @@ -79,6 +79,12 @@ using namespace std; #include +#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 -# ifdef HAVE_BYTESWAP_H -# include -# endif -#else -/* Else, if using SDL, try SDL's endian functions. */ -# ifdef USE_SDL -# include -# 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)) diff --git a/inputrecord.cpp b/inputrecord.cpp index 23c3f3a3..a4fa99fe 100644 --- a/inputrecord.cpp +++ b/inputrecord.cpp @@ -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); } diff --git a/od-win32/ahidsound_new.cpp b/od-win32/ahidsound_new.cpp index f9bf6c77..16abd701 100644 --- a/od-win32/ahidsound_new.cpp +++ b/od-win32/ahidsound_new.cpp @@ -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); diff --git a/od-win32/clipboard_win32.cpp b/od-win32/clipboard_win32.cpp index 43901f61..4cfc29d4 100644 --- a/od-win32/clipboard_win32.cpp +++ b/od-win32/clipboard_win32.cpp @@ -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; diff --git a/od-win32/debug_win32.cpp b/od-win32/debug_win32.cpp index a37fca07..a3e2a63a 100644 --- a/od-win32/debug_win32.cpp +++ b/od-win32/debug_win32.cpp @@ -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); diff --git a/od-win32/picasso96_win.cpp b/od-win32/picasso96_win.cpp index 85769282..8ba3430e 100644 --- a/od-win32/picasso96_win.cpp +++ b/od-win32/picasso96_win.cpp @@ -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); } diff --git a/pcem/vid_voodoo_render.cpp b/pcem/vid_voodoo_render.cpp index f8ad7a4f..9a5118d1 100644 --- a/pcem/vid_voodoo_render.cpp +++ b/pcem/vid_voodoo_render.cpp @@ -1,5 +1,5 @@ -#include +#include #include #include diff --git a/zfile_archive.cpp b/zfile_archive.cpp index 4262e8e6..0581907e 100644 --- a/zfile_archive.cpp +++ b/zfile_archive.cpp @@ -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); -- 2.47.3