From: Toni Wilen Date: Sat, 30 Apr 2022 14:32:14 +0000 (+0300) Subject: Warning fixes. X-Git-Tag: 41000~240 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=a1501346eaf25630eb1e70fe47ba4256598f880a;p=francis%2Fwinuae.git Warning fixes. --- diff --git a/hardfile.cpp b/hardfile.cpp index 2389aee2..9d8432c2 100644 --- a/hardfile.cpp +++ b/hardfile.cpp @@ -1838,7 +1838,7 @@ int scsi_hd_emulate (struct hardfiledata *hfd, struct hd_hardfiledata *hdhfd, ua p += bdlen; } for (;;) { - int rem = plen - (p - scsi_data); + int rem = (int)(plen - (p - scsi_data)); if (!rem) break; if (rem < 2) @@ -3025,7 +3025,7 @@ static void hardfile_thread (void *devs) uae_sem_post (&hfpd->sync_sem); uae_sem_post (&change_sem); return; - } else if (hardfile_do_io(ctx, get_hardfile_data_controller(hfpd - &hardfpd[0]), hfpd, iobuf, request) == 0) { + } else if (hardfile_do_io(ctx, get_hardfile_data_controller((int)(hfpd - &hardfpd[0])), hfpd, iobuf, request) == 0) { put_byte_host(iobuf + 30, get_byte_host(iobuf + 30) & ~1); trap_put_bytes(ctx, iobuf + 8, request + 8, 48 - 8); release_async_request(hfpd, request); diff --git a/inputdevice.cpp b/inputdevice.cpp index 344766cc..29930858 100644 --- a/inputdevice.cpp +++ b/inputdevice.cpp @@ -1406,7 +1406,7 @@ static bool read_slot (const TCHAR *parm, int num, int joystick, int button, str if (joystick < 0) { if (!(ie->allow_mask & AM_K)) return false; - id->eventid[keynum][subnum] = ie - events; + id->eventid[keynum][subnum] = (int)(ie - events); id->flags[keynum][subnum] = flags; id->port[keynum][subnum] = port; xfree (id->custom[keynum][subnum]); @@ -1418,7 +1418,7 @@ static bool read_slot (const TCHAR *parm, int num, int joystick, int button, str mask = AM_MOUSE_BUT; if (!(ie->allow_mask & mask)) return false; - id->eventid[num + ID_BUTTON_OFFSET][subnum] = ie - events; + id->eventid[num + ID_BUTTON_OFFSET][subnum] = (int)(ie - events); id->flags[num + ID_BUTTON_OFFSET][subnum] = flags; id->port[num + ID_BUTTON_OFFSET][subnum] = port; xfree (id->custom[num + ID_BUTTON_OFFSET][subnum]); @@ -1430,7 +1430,7 @@ static bool read_slot (const TCHAR *parm, int num, int joystick, int button, str mask = AM_MOUSE_AXIS; if (!(ie->allow_mask & mask)) return false; - id->eventid[num + ID_AXIS_OFFSET][subnum] = ie - events; + id->eventid[num + ID_AXIS_OFFSET][subnum] = (int)(ie - events); id->flags[num + ID_AXIS_OFFSET][subnum] = flags; id->port[num + ID_AXIS_OFFSET][subnum] = port; xfree (id->custom[num + ID_AXIS_OFFSET][subnum]); @@ -1997,7 +1997,7 @@ void inputdevice_parse_jport_custom(struct uae_prefs *pr, int index, int port, T goto skip; } if (outname == NULL) { - int evt = ie - &events[0]; + int evt = (int)(ie - &events[0]); if (joystick < 0) { if (port >= 0) { // all active keyboards @@ -3663,7 +3663,7 @@ static void inject_events (const TCHAR *str) const TCHAR *s2 = s; while (*s && *s != ' ') s++; - int s2len = s - s2; + int s2len = (int)(s - s2); if (!s2len) break; for (int i = 1; events[i].name; i++) { @@ -8212,7 +8212,7 @@ int inputdevice_iterate (int devnum, int num, TCHAR *name, int *af) if (ie->allow_mask & AM_INFO) { const struct inputevent *ie2 = ie + 1; while (!(ie2->allow_mask & AM_INFO)) { - if (is_event_used (idf, devindex, ie2 - ie, -1)) { + if (is_event_used (idf, devindex, (int)(ie2 - ie), -1)) { ie2++; continue; } diff --git a/od-win32/ahidsound_dsonly.cpp b/od-win32/ahidsound_dsonly.cpp index 7eaf1aaa..55bc7ca1 100644 --- a/od-win32/ahidsound_dsonly.cpp +++ b/od-win32/ahidsound_dsonly.cpp @@ -676,7 +676,7 @@ uae_u32 REGPARAM2 ahi_demux (TrapContext *context) if (OpenClipboard (0)) { clipdat = (TCHAR*)GetClipboardData (CF_UNICODETEXT); if (clipdat) { - clipsize = _tcslen (clipdat); + clipsize = uaetcslen(clipdat); clipsize++; return clipsize; } @@ -710,7 +710,7 @@ uae_u32 REGPARAM2 ahi_demux (TrapContext *context) if (OpenClipboard (0)) { EmptyClipboard(); - slen = _tcslen (s); + slen = uaetcslen(s); if (p) GlobalFree (p); p = (LPTSTR)GlobalAlloc (GMEM_MOVEABLE, (slen + 1) * sizeof (TCHAR)); diff --git a/od-win32/ahidsound_new.cpp b/od-win32/ahidsound_new.cpp index 6cd8c2b3..521850f2 100644 --- a/od-win32/ahidsound_new.cpp +++ b/od-win32/ahidsound_new.cpp @@ -488,7 +488,7 @@ static int setchannelevent (struct DSAHI *dsahip, struct dschannel *dc) { uae_u32 audioctrl = dsahip->audioctrl; uae_u32 puaebase = get_long (audioctrl + ahiac_DriverData); - int ch = dc - &dsahip->channel[0]; + int ch = (int)(dc - &dsahip->channel[0]); uae_u32 mask; if (!dsahip->playing || ahi_paused || !dc->al_source || !get_long (audioctrl + ahiac_SoundFunc)) @@ -537,7 +537,7 @@ static void setevent (struct DSAHI *dsahip) dsahip->evttime = t; if (t < 10) return; - event2_newevent2 (t, dsahip - &dsahi[0], evtfunc); + event2_newevent2(t, (int)(dsahip - &dsahi[0]), evtfunc); } static void alClear (void) @@ -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, (void*)recordbuf, dsahip->record_samples); if (alGetError () != AL_NO_ERROR) return; put_word (pbase + pub_RecordHookDone, 0); @@ -1355,7 +1355,7 @@ static uae_u32 AHIsub_AllocAudio (TrapContext *ctx) write_log (_T("AHI: corrupted memory\n")); return AHISF_ERROR; } - put_long (pbase + pub_Index, dsahip - dsahi); + put_long(pbase + pub_Index, (int)(dsahip - dsahi)); dsahip->audioctrl = audioctrl; dsahip->maxplaysamples = UAE_MAXPLAYSAMPLES; diff --git a/od-win32/avioutput.cpp b/od-win32/avioutput.cpp index 33e6c50c..49aa2104 100644 --- a/od-win32/avioutput.cpp +++ b/od-win32/avioutput.cpp @@ -1412,12 +1412,12 @@ static void AVIOutput_Begin2(bool fullstart, bool immediate) } else { ext1 = _T(".avi"); ext2 = _T(".wav"); } - if (_tcslen (avioutput_filename_inuse) >= 4 && !_tcsicmp (avioutput_filename_inuse + _tcslen (avioutput_filename_inuse) - 4, ext2)) - avioutput_filename_inuse[_tcslen (avioutput_filename_inuse) - 4] = 0; - if (_tcslen (avioutput_filename_inuse) >= 4 && _tcsicmp (avioutput_filename_inuse + _tcslen (avioutput_filename_inuse) - 4, ext1)) + if (uaetcslen(avioutput_filename_inuse) >= 4 && !_tcsicmp (avioutput_filename_inuse + uaetcslen(avioutput_filename_inuse) - 4, ext2)) + avioutput_filename_inuse[uaetcslen(avioutput_filename_inuse) - 4] = 0; + if (uaetcslen(avioutput_filename_inuse) >= 4 && _tcsicmp (avioutput_filename_inuse + uaetcslen(avioutput_filename_inuse) - 4, ext1)) _tcscat (avioutput_filename_inuse, ext1); _tcscpy (avioutput_filename_tmp, avioutput_filename_inuse); - i = _tcslen (avioutput_filename_tmp) - 1; + i = uaetcslen(avioutput_filename_tmp) - 1; while (i > 0 && avioutput_filename_tmp[i] != '.') i--; if (i > 0) avioutput_filename_tmp[i] = 0; diff --git a/od-win32/blkdev_win32_ioctl.cpp b/od-win32/blkdev_win32_ioctl.cpp index 017b0c53..903b8fdf 100644 --- a/od-win32/blkdev_win32_ioctl.cpp +++ b/od-win32/blkdev_win32_ioctl.cpp @@ -78,7 +78,7 @@ static int getunitnum (struct dev_info_ioctl *ciw) { if (!ciw) return -1; - int idx = ciw - &ciw32[0]; + int idx = (int)(ciw - &ciw32[0]); for (int i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) { if (unittable[i] - 1 == idx) return i; @@ -689,7 +689,7 @@ static int ioctl_command_rawread (int unitnum, uae_u8 *data, int sector, int siz memcpy (data + blocksize, p + readblocksize, SUB_CHANNEL_SIZE); data += blocksize + SUB_CHANNEL_SIZE; } - ret += data - odata; + ret += (int)(data - odata); sector++; } } diff --git a/od-win32/blkdev_win32_spti.cpp b/od-win32/blkdev_win32_spti.cpp index 412e751b..e91c5dae 100644 --- a/od-win32/blkdev_win32_spti.cpp +++ b/od-win32/blkdev_win32_spti.cpp @@ -77,7 +77,7 @@ static int getunitnum (struct dev_info_spti *di) { if (!di) return -1; - int idx = di - &dev_info[0]; + int idx = (int)(di - &dev_info[0]); for (int i = 0; i < MAX_TOTAL_SCSI_DEVICES; i++) { if (unittable[i] - 1 == idx) return i; diff --git a/od-win32/bsdsock.cpp b/od-win32/bsdsock.cpp index f942abb8..a5d74b4c 100644 --- a/od-win32/bsdsock.cpp +++ b/od-win32/bsdsock.cpp @@ -2757,11 +2757,11 @@ kludge: // compute total size of hostent size = 28; if (h->h_name != NULL) - size += strlen(h->h_name) + 1; + size += uaestrlen(h->h_name) + 1; if (h->h_aliases != NULL) while (h->h_aliases[numaliases]) - size += strlen(h->h_aliases[numaliases++]) + 5; + size += uaestrlen(h->h_aliases[numaliases++]) + 5; if (h->h_addr_list != NULL) { while (h->h_addr_list[numaddr]) numaddr++; @@ -2861,11 +2861,11 @@ void host_getprotobyname(TrapContext *ctx, SB, uae_u32 name) // compute total size of protoent size = 16; if (p->p_name != NULL) - size += strlen(p->p_name)+1; + size += uaestrlen(p->p_name)+1; if (p->p_aliases != NULL) while (p->p_aliases[numaliases]) - size += strlen(p->p_aliases[numaliases++])+5; + size += uaestrlen(p->p_aliases[numaliases++])+5; if (sb->protoent) { uae_FreeMem(ctx, sb->protoent, sb->protoentsize, sb->sysbase); @@ -2969,13 +2969,13 @@ void host_getservbynameport(TrapContext *ctx, SB, uae_u32 nameport, uae_u32 prot // compute total size of servent size = 20; if (s->s_name != NULL) - size += strlen(s->s_name)+1; + size += uaestrlen(s->s_name)+1; if (s->s_proto != NULL) - size += strlen(s->s_proto)+1; + size += uaestrlen(s->s_proto)+1; if (s->s_aliases != NULL) while (s->s_aliases[numaliases]) - size += strlen(s->s_aliases[numaliases++])+5; + size += uaestrlen(s->s_aliases[numaliases++])+5; if (sb->servent) { uae_FreeMem(ctx, sb->servent, sb->serventsize, sb->sysbase); diff --git a/od-win32/clipboard_win32.cpp b/od-win32/clipboard_win32.cpp index 6d3aad01..1c5e388c 100644 --- a/od-win32/clipboard_win32.cpp +++ b/od-win32/clipboard_win32.cpp @@ -99,8 +99,8 @@ static uae_char *pctoamiga (const uae_char *txt) uae_char *txt2; int i, j; - len = strlen (txt) + 1; - txt2 = xmalloc (uae_char, len); + len = uaestrlen(txt) + 1; + txt2 = xmalloc(uae_char, len); j = 0; for (i = 0; i < len; i++) { uae_char c = txt[i]; @@ -137,7 +137,7 @@ static TCHAR *amigatopc (const char *txt) pc = 0; cnt = 0; - len = strlen (txt) + 1; + len = uaestrlen(txt) + 1; for (i = 0; i < len; i++) { uae_char c = txt[i]; if (c == 13) @@ -179,7 +179,7 @@ static void to_iff_text(TrapContext *ctx, const TCHAR *pctxt) s = ua (pctxt); txt = pctoamiga (s); - txtlen = strlen (txt); + txtlen = uaestrlen(txt); xfree (to_amiga); size = txtlen + sizeof b + (txtlen & 1) - 8; b[4] = size >> 24; @@ -415,7 +415,7 @@ static void to_iff_ilbm(TrapContext *ctx, HBITMAP hbmp) } } - tsize = p - iff - 8; + tsize = (int)(p - iff - 8); p = iff + 4; p[0] = tsize >> 24; p[1] = tsize >> 16; diff --git a/od-win32/dinput.cpp b/od-win32/dinput.cpp index 94ea25ed..7263c7a7 100644 --- a/od-win32/dinput.cpp +++ b/od-win32/dinput.cpp @@ -2956,8 +2956,8 @@ static BOOL CALLBACK EnumObjectsCallback (const DIDEVICEOBJECTINSTANCE* pdidoi, static void trimws (TCHAR *s) { /* Delete trailing whitespace. */ - int len = _tcslen (s); - while (len > 0 && _tcscspn (s + len - 1, _T("\t \r\n")) == 0) + int len = uaetcslen(s); + while (len > 0 && _tcscspn(s + len - 1, _T("\t \r\n")) == 0) s[--len] = '\0'; } @@ -3014,7 +3014,7 @@ static BOOL di_enumcallback2 (LPCDIDEVICEINSTANCE lpddi, int joy) cleardid (did); if (lpddi->tszInstanceName) { - len = _tcslen (lpddi->tszInstanceName) + 5 + 1; + len = uaetcslen(lpddi->tszInstanceName) + 5 + 1; did->name = xmalloc (TCHAR, len); _tcscpy (did->name, lpddi->tszInstanceName); } else { diff --git a/od-win32/dxwrap.cpp b/od-win32/dxwrap.cpp index 10e2ddbe..0678ad28 100644 --- a/od-win32/dxwrap.cpp +++ b/od-win32/dxwrap.cpp @@ -1208,7 +1208,7 @@ int DirectDraw_Start (void) guid = NULL; if (isfullscreen ()) { MultiDisplay *md = getdisplay(&currprefs, 0); - int disp = md - Displays; + int disp = (int)(md - Displays); if (disp < 0) disp = 0; if (disp >= MAX_DISPLAYS) diff --git a/od-win32/fpp_native_msvc_80bit.cpp b/od-win32/fpp_native_msvc_80bit.cpp index 11c1bc1c..bf097b75 100644 --- a/od-win32/fpp_native_msvc_80bit.cpp +++ b/od-win32/fpp_native_msvc_80bit.cpp @@ -918,7 +918,7 @@ static void fp_from_pack (fpdata *src, uae_u32 *wrd, int kfactor) strp[1] = strp[0]; strp++; // add trailing zeros - i = strlen (strp); + i = uaestrlen(strp); cp = strp + i; while (i < ndigits) { *cp++ = '0'; diff --git a/od-win32/hardfile_win32.cpp b/od-win32/hardfile_win32.cpp index 4c2e4c37..65669fd4 100644 --- a/od-win32/hardfile_win32.cpp +++ b/od-win32/hardfile_win32.cpp @@ -2145,7 +2145,7 @@ emptyreal: } hfd->handle->h = h; - i = _tcslen (name) - 1; + i = uaetcslen(name) - 1; while (i >= 0) { if ((i > 0 && (name[i - 1] == '/' || name[i - 1] == '\\')) || i == 0) { _tcsncpy (hfd->product_id, name + i, 15); @@ -2483,7 +2483,7 @@ static int hdf_read_2 (struct hardfiledata *hfd, void *buffer, uae_u64 offset, i if (hfd->handle_valid == HDF_HANDLE_WIN32_NORMAL) { ReadFile(hfd->handle->h, hfd->cache, CACHE_SIZE, &outlen, NULL); } else if (hfd->handle_valid == HDF_HANDLE_ZFILE) { - outlen = zfile_fread(hfd->cache, 1, CACHE_SIZE, hfd->handle->zf); + outlen = (DWORD)zfile_fread(hfd->cache, 1, CACHE_SIZE, hfd->handle->zf); } hfd->cache_valid = 0; if (outlen != CACHE_SIZE) @@ -2531,7 +2531,7 @@ int hdf_read_target (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int ReadFile (hfd->handle->h, hfd->cache, len, &ret, NULL); memcpy (buffer, hfd->cache, ret); } else if (hfd->handle_valid == HDF_HANDLE_ZFILE) { - ret = zfile_fread (buffer, 1, len, hfd->handle->zf); + ret = (DWORD)zfile_fread (buffer, 1, len, hfd->handle->zf); } maxlen = len; } else { @@ -2593,7 +2593,7 @@ static int hdf_write_2 (struct hardfiledata *hfd, void *buffer, uae_u64 offset, } } } else if (hfd->handle_valid == HDF_HANDLE_ZFILE) { - outlen = zfile_fwrite (hfd->cache, 1, len, hfd->handle->zf); + outlen = (DWORD)zfile_fwrite (hfd->cache, 1, len, hfd->handle->zf); } return outlen; } diff --git a/od-win32/parser.cpp b/od-win32/parser.cpp index 3c369aed..5d653611 100644 --- a/od-win32/parser.cpp +++ b/od-win32/parser.cpp @@ -344,7 +344,7 @@ static void DoSomeWeirdPrintingStuff (uae_char val) psbuffer[0] = 0; psbuffers = 0; strcpy (prtbuf, "%!PS"); - prtbufbytes = strlen (prtbuf); + prtbufbytes = uaestrlen(prtbuf); flushprtbuf (); write_log (_T("PostScript start detected..\n")); return; @@ -957,7 +957,7 @@ static int opentcp (const TCHAR *sername) write_log(_T("SERIAL_TCP: socket() failed, %s:%s: %d\n"), name, port, WSAGetLastError ()); goto end; } - err = bind (serialsocket, socketinfo->ai_addr, socketinfo->ai_addrlen); + err = bind (serialsocket, socketinfo->ai_addr, (int)socketinfo->ai_addrlen); if (err < 0) { write_log(_T("SERIAL_TCP: bind() failed, %s:%s: %d\n"), name, port, WSAGetLastError ()); goto end; diff --git a/od-win32/picasso96_win.cpp b/od-win32/picasso96_win.cpp index a4b00dcd..6b03dead 100644 --- a/od-win32/picasso96_win.cpp +++ b/od-win32/picasso96_win.cpp @@ -2361,7 +2361,7 @@ int picasso_getwritewatch (int index, int offset, uae_u8 ***gwwbufp, uae_u8 **st *gwwbufp = (uae_u8**)gwwbuf[index]; if (startp) *startp = start; - return writewatchcount[index]; + return (int)writewatchcount[index]; } bool picasso_is_vram_dirty (int index, uaecptr addr, int size) { @@ -3183,7 +3183,7 @@ static uae_u32 picasso_SetSplitPosition(TrapContext *ctx) #ifdef CPU_64_BIT static void do_xor8 (uae_u8 *p, int w, uae_u32 v) { - while (ALIGN_POINTER_TO32 (p) != 7 && w) { + while (ALIGN_POINTER_TO32(p) != 7 && w) { *p ^= v; p++; w--; @@ -3205,7 +3205,7 @@ static void do_xor8 (uae_u8 *p, int w, uae_u32 v) #else static void do_xor8 (uae_u8 *p, int w, uae_u32 v) { - while (ALIGN_POINTER_TO32 (p) != 3 && w) { + while (ALIGN_POINTER_TO32(p) != 3 && w) { *p ^= v; p++; w--; @@ -5356,7 +5356,7 @@ static void picasso_flushpixels(int index, uae_u8 *src, int off, bool render) for (int split = 0; split < 2; split++) { - uae_u32 regionsize = src_end[split] - src_start[split]; + uae_u32 regionsize = (uae_u32)(src_end[split] - src_start[split]); if (src_start[split] == 0 && src_end[split] == 0) { break; } @@ -5373,7 +5373,7 @@ static void picasso_flushpixels(int index, uae_u8 *src, int off, bool render) continue; } - matchcount += gwwcnt; + matchcount += (int)gwwcnt; if (gwwcnt == 0) { continue; @@ -5441,7 +5441,7 @@ static void picasso_flushpixels(int index, uae_u8 *src, int off, bool render) int y, x, realoffset; if (p >= src + off) { - realoffset = p - (src + off); + realoffset = (int)(p - (src + off)); } else { realoffset = 0; } diff --git a/od-win32/posixemu.cpp b/od-win32/posixemu.cpp index 2581fd36..7b02209b 100644 --- a/od-win32/posixemu.cpp +++ b/od-win32/posixemu.cpp @@ -140,7 +140,7 @@ void uae_sem_destroy (uae_sem_t * event) uae_thread_id uae_thread_get_id(void) { - return (uae_thread_id)GetCurrentThreadId(); + return (uae_thread_id)(INT_PTR)GetCurrentThreadId(); } #ifndef _CONSOLE diff --git a/od-win32/registry.cpp b/od-win32/registry.cpp index d7ef5505..b5557367 100644 --- a/od-win32/registry.cpp +++ b/od-win32/registry.cpp @@ -48,7 +48,7 @@ int regsetstr (UAEREG *root, const TCHAR *name, const TCHAR *str) HKEY rk = gr (root); if (!rk) return 0; - return RegSetValueEx (rk, name, 0, REG_SZ, (CONST BYTE *)str, (_tcslen (str) + 1) * sizeof (TCHAR)) == ERROR_SUCCESS; + return RegSetValueEx (rk, name, 0, REG_SZ, (CONST BYTE *)str, (uaetcslen(str) + 1) * sizeof (TCHAR)) == ERROR_SUCCESS; } } @@ -138,7 +138,7 @@ int regquerystr (UAEREG *root, const TCHAR *name, TCHAR *str, int *size) if (_tcslen(tmp) >= *size) tmp[(*size) - 1] = 0; _tcscpy (str, tmp); - *size = _tcslen(str); + *size = uaetcslen(str); ret = 1; } xfree (tmp); @@ -195,7 +195,7 @@ int regquerydatasize (UAEREG *root, const TCHAR *name, int *size) int csize = 65536; TCHAR *tmp = xmalloc (TCHAR, csize); if (regquerystr (root, name, tmp, &csize)) { - *size = _tcslen (tmp) / 2; + *size = uaetcslen (tmp) / 2; ret = 1; } xfree (tmp); diff --git a/od-win32/rp.cpp b/od-win32/rp.cpp index e086b68e..695164b0 100644 --- a/od-win32/rp.cpp +++ b/od-win32/rp.cpp @@ -1261,7 +1261,7 @@ static void dos_execute_callback(uae_u32 id, uae_u32 status, uae_u32 flags, cons if (flags & (RP_EXECUTE_RETURN_EXIT_CODE | RP_EXECUTE_RETURN_OUTPUT)) { int outsize = 0; if (outbuf) { - outsize = strlen(outbuf); + outsize = uaestrlen(outbuf); } size += (outsize + 1) * sizeof(TCHAR); er = (RPExecuteResult *)xcalloc(uae_u8, size); @@ -1462,7 +1462,7 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM savestate_initsave (NULL, 0, TRUE, true); return 1; } - if (vpos == 0) { + if (vpos == maxvpos_display_vsync) { savestate_initsave (_T(""), 1, TRUE, true); save_state (s, _T("AmigaForever")); ret = 1; diff --git a/od-win32/screenshot.cpp b/od-win32/screenshot.cpp index 08a87ebd..47b044e5 100644 --- a/od-win32/screenshot.cpp +++ b/od-win32/screenshot.cpp @@ -42,7 +42,7 @@ static void namesplit (TCHAR *s) { int l; - l = _tcslen (s) - 1; + l = uaetcslen(s) - 1; while (l >= 0) { if (s[l] == '.') s[l] = 0; @@ -53,7 +53,7 @@ static void namesplit (TCHAR *s) l--; } if (l > 0) - memmove (s, s + l, (_tcslen (s + l) + 1) * sizeof (TCHAR)); + memmove (s, s + l, (uaetcslen(s + l) + 1) * sizeof (TCHAR)); } static int toclipboard (BITMAPINFO *bi, void *bmp) diff --git a/od-win32/sounddep/sound.cpp b/od-win32/sounddep/sound.cpp index 66d2bf76..e764b294 100644 --- a/od-win32/sounddep/sound.cpp +++ b/od-win32/sounddep/sound.cpp @@ -2661,7 +2661,7 @@ bool audio_is_event_frame_possible(int ms) return false; if (type == SOUND_DEVICE_WASAPI || type == SOUND_DEVICE_WASAPI_EXCLUSIVE || type == SOUND_DEVICE_PA) { struct sound_dp *s = sdp->data; - int bufsize = (uae_u8*)paula_sndbufpt - (uae_u8*)paula_sndbuffer; + int bufsize = (int)((uae_u8*)paula_sndbufpt - (uae_u8*)paula_sndbuffer); bufsize /= sdp->samplesize; int todo = s->bufferFrameCount - bufsize; int samplesperframe = (int)(sdp->obtainedfreq / vblank_hz); @@ -2695,7 +2695,7 @@ int audio_pull_buffer(void) struct sound_dp *s = sdp->data; if (s->pullbufferlen > 0) { cnt++; - int size = (uae_u8*)paula_sndbufpt - (uae_u8*)paula_sndbuffer; + int size = (int)((uae_u8*)paula_sndbufpt - (uae_u8*)paula_sndbuffer); if (size > sdp->sndbufsize * 2 / 3) cnt++; } @@ -2770,7 +2770,7 @@ static void handle_reset(void) void finish_sound_buffer (void) { static unsigned long tframe; - int bufsize = (uae_u8*)paula_sndbufpt - (uae_u8*)paula_sndbuffer; + int bufsize = (int)((uae_u8*)paula_sndbufpt - (uae_u8*)paula_sndbuffer); if (sdp->reset) { handle_reset(); diff --git a/od-win32/statusline_win32.cpp b/od-win32/statusline_win32.cpp index 96bf193a..4ab7ad31 100644 --- a/od-win32/statusline_win32.cpp +++ b/od-win32/statusline_win32.cpp @@ -288,7 +288,7 @@ void statusline_render(int monid, uae_u8 *buf, int bpp, int pitch, int width, in BitBlt(statusline_hdc, 0, 0, statusline_width, statusline_height, NULL, 0, 0, BLACKNESS); SIZE size; - if (GetTextExtentPoint32(statusline_hdc, text, _tcslen(text), &size)) { + if (GetTextExtentPoint32(statusline_hdc, text, uaetcslen(text), &size)) { textwidth = size.cx; if (isfullscreen()) { if (td_numbers_pos & TD_RIGHT) { @@ -302,7 +302,7 @@ void statusline_render(int monid, uae_u8 *buf, int bpp, int pitch, int width, in } if (x < 0) x = 0; - TextOut(statusline_hdc, x, y, text, _tcslen(text)); + TextOut(statusline_hdc, x, y, text, uaetcslen(text)); for (int y = 0; y < height && y < statusline_height; y++) { uae_u8 *src = (uae_u8*)statusline_bm + y * statusline_width; diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 6777fe4a..bb2bd808 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -2879,7 +2879,7 @@ static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam, if (txt) { SetBkMode(lpDIS->hDC, TRANSPARENT); oc = SetTextColor(lpDIS->hDC, RGB(0x00, 0x00, 0x00)); - DrawText(lpDIS->hDC, txt, _tcslen(txt), &lpDIS->rcItem, flags); + DrawText(lpDIS->hDC, txt, uaetcslen(txt), &lpDIS->rcItem, flags); SetTextColor(lpDIS->hDC, oc); } } else if (lpDIS->itemID > 0 && lpDIS->itemID <= window_led_joy_start) { @@ -2966,7 +2966,7 @@ static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam, lpDIS->rcItem.right--; lpDIS->rcItem.left += 2; } - DrawText (lpDIS->hDC, txt, _tcslen (txt), &lpDIS->rcItem, flags); + DrawText (lpDIS->hDC, txt, uaetcslen(txt), &lpDIS->rcItem, flags); SetTextColor (lpDIS->hDC, oc); } } @@ -3654,23 +3654,23 @@ uae_u8 *save_log(int bootlog, size_t *len) { FILE *f; uae_u8 *dst = NULL; - int size; + size_t size; if (!logging_started) return NULL; - f = _tfopen (bootlog ? LOG_BOOT : LOG_NORMAL, _T("rb")); + f = _tfopen(bootlog ? LOG_BOOT : LOG_NORMAL, _T("rb")); if (!f) return NULL; - fseek (f, 0, SEEK_END); - size = ftell (f); - fseek (f, 0, SEEK_SET); + fseek(f, 0, SEEK_END); + size = ftell(f); + fseek(f, 0, SEEK_SET); if (*len > 0 && size > *len) size = *len; if (size > 0) { - dst = xcalloc (uae_u8, size + 1); + dst = xcalloc(uae_u8, size + 1); if (dst) - fread (dst, 1, size, f); - fclose (f); + fread(dst, 1, size, f); + fclose(f); *len = size + 1; } return dst; @@ -4091,7 +4091,7 @@ static void shellexecute (const TCHAR *command) TCHAR **arg; int i, j, k, stop; - if (_tcslen (command) == 0) + if (uaetcslen(command) == 0) return; i = j = 0; stop = 0; @@ -4101,14 +4101,14 @@ static void shellexecute (const TCHAR *command) int len = 1; j = i; while (arg[i] && _tcscmp (arg[i], L";")) { - len += _tcslen (arg[i]) + 3; + len += uaetcslen(arg[i]) + 3; i++; } exec = NULL; cmd = xcalloc (TCHAR, len); for (k = j; k < i; k++) { int quote = 0; - if (_tcslen (cmd) > 0) + if (uaetcslen(cmd) > 0) _tcscat (cmd, L" "); if (_tcschr (arg[k], ' ')) quote = 1; @@ -4649,8 +4649,8 @@ int target_parse_option (struct uae_prefs *p, const TCHAR *option, const TCHAR * for (i = 0; i < MAX_SOUND_DEVICES && sound_devices[i]; i++) { if (!sound_devices[i]->prefix) continue; - int prefixlen = _tcslen(sound_devices[i]->prefix); - int tmplen = _tcslen(tmpbuf); + int prefixlen = uaetcslen(sound_devices[i]->prefix); + int tmplen = uaetcslen(tmpbuf); if (prefixlen > 0 && tmplen >= prefixlen && !_tcsncmp(sound_devices[i]->prefix, tmpbuf, prefixlen) && ((tmplen > prefixlen && tmpbuf[prefixlen] == ':') @@ -5441,7 +5441,7 @@ static void associate_init_extensions (void) RegSetValueEx (key1, _T("UseUrl"), 0, REG_DWORD, (LPBYTE)&val, sizeof val); _tcscpy (rpath, start_path_exe); rpath[_tcslen (rpath) - 1] = 0; - RegSetValueEx (key1, _T("Path"), 0, REG_SZ, (CONST BYTE *)rpath, (_tcslen (rpath) + 1) * sizeof (TCHAR)); + RegSetValueEx (key1, _T("Path"), 0, REG_SZ, (CONST BYTE *)rpath, (uaetcslen(rpath) + 1) * sizeof (TCHAR)); RegCloseKey (key1); SHChangeNotify (SHCNE_ASSOCCHANGED, 0, 0, 0); } @@ -6261,7 +6261,6 @@ static void getstartpaths (void) setpathmode (path_type); } -extern void test (void); extern int screenshotmode, postscript_print_debugging, sound_debug, log_uaeserial, clipboard_debug; extern int force_direct_catweasel, sound_mode_skip, maxmem; extern int pngprint, log_sercon, midi_inbuflen; @@ -7060,7 +7059,7 @@ static bool singleprocess (void) goto end; buf[0] = 0xfeff; _tcscpy (buf + 1, _T("IPC_QUIT")); - if (!WriteFile(p, (void*)buf, (_tcslen (buf) + 1) * sizeof (TCHAR), &ret, NULL)) + if (!WriteFile(p, (void*)buf, (uaetcslen(buf) + 1) * sizeof (TCHAR), &ret, NULL)) goto end; if (!PeekNamedPipe(p, NULL, 0, NULL, &avail, NULL)) goto end; @@ -7298,7 +7297,7 @@ static void savedump (MINIDUMPWRITEDUMP dump, HANDLE f, struct _EXCEPTION_POINTE musi.UserStreamCount++; musp->Type = LastReservedStream + musi.UserStreamCount; musp->Buffer = log; - musp->BufferSize = len; + musp->BufferSize = (ULONG)len; len = 30000; log = save_log (FALSE, &len); if (log) { @@ -7306,7 +7305,7 @@ static void savedump (MINIDUMPWRITEDUMP dump, HANDLE f, struct _EXCEPTION_POINTE musi.UserStreamCount++; musp->Type = LastReservedStream + musi.UserStreamCount; musp->Buffer = log; - musp->BufferSize = len; + musp->BufferSize = (ULONG)len; } } @@ -7316,7 +7315,7 @@ static void savedump (MINIDUMPWRITEDUMP dump, HANDLE f, struct _EXCEPTION_POINTE musi.UserStreamCount++; musp->Type = LastReservedStream + musi.UserStreamCount; musp->Buffer = (void*)config; - musp->BufferSize = len; + musp->BufferSize = (ULONG)len; } if (musi.UserStreamCount > 0) diff --git a/od-win32/win32_scaler.cpp b/od-win32/win32_scaler.cpp index 920343fb..d2d69061 100644 --- a/od-win32/win32_scaler.cpp +++ b/od-win32/win32_scaler.cpp @@ -782,10 +782,10 @@ cont: xs = dst_width; if (xmult) - xs -= dst_width / (int)xmult; + xs -= (int)(dst_width / xmult); ys = dst_height; if (ymult) - ys -= dst_height / (int)ymult; + ys -= (int)(dst_height / ymult); sizeoffset (dr, zr, xs, ys); filterxmult = xmult; diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index dd30291e..68e402f7 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -150,7 +150,8 @@ void HtmlHelp(HWND a, LPCWSTR b, UINT c, const TCHAR *d) (*pHtmlHelp)(a, b, c, (LPDWORD)d); } else { if (gui_message_multibutton(1, _T("Help file is not installed locally, do you want to open online version? (http://www.winuae.net/help/)")) == 1) { - if ((int)ShellExecute(NULL, _T("open"), _T("http://www.winuae.net/help/"), NULL, NULL, SW_SHOWNORMAL) <= 32) { + HINSTANCE h = ShellExecute(NULL, _T("open"), _T("http://www.winuae.net/help/"), NULL, NULL, SW_SHOWNORMAL); + if ((INT_PTR)h <= 32) { TCHAR szMessage[MAX_DPATH]; WIN32GUI_LoadUIString(IDS_NOHELP, szMessage, MAX_DPATH); gui_message(szMessage); @@ -936,7 +937,7 @@ static void addeditmenu (HMENU menu, struct favitems *fitem) mii.fType = MFT_STRING; mii.fState = MFS_ENABLED; mii.dwTypeData = _T("Add New"); - mii.cch = _tcslen (mii.dwTypeData); + mii.cch = uaetcslen(mii.dwTypeData); mii.wID = 1000; InsertMenuItem (emenu, -1, TRUE, &mii); i = 0; @@ -948,7 +949,7 @@ static void addeditmenu (HMENU menu, struct favitems *fitem) mii.wID = 1001 + i; _stprintf (newpath, _T("Remove '%s'"), fitem[i].value); mii.dwTypeData = newpath; - mii.cch = _tcslen (mii.dwTypeData); + mii.cch = uaetcslen(mii.dwTypeData); InsertMenuItem (emenu, -1, TRUE, &mii); } i++; @@ -958,7 +959,7 @@ static void addeditmenu (HMENU menu, struct favitems *fitem) mii.fType = MFT_STRING; mii.fState = MFS_ENABLED; mii.dwTypeData = _T("Edit"); - mii.cch = _tcslen (mii.dwTypeData); + mii.cch = uaetcslen(mii.dwTypeData); mii.hSubMenu = emenu; InsertMenuItem (menu, -1, TRUE, &mii); } @@ -981,7 +982,7 @@ static int popupmenu (HWND hwnd, struct favitems *items, int morefiles) mii.fState = MFS_ENABLED; mii.wID = items[i].type == 2 ? 1 + i : 990 - 3 + items[i].type; mii.dwTypeData = items[i].value; - mii.cch = _tcslen (mii.dwTypeData); + mii.cch = uaetcslen(mii.dwTypeData); InsertMenuItem (menu, -1, TRUE, &mii); got = 1; } @@ -995,7 +996,7 @@ static int popupmenu (HWND hwnd, struct favitems *items, int morefiles) mii.fState = MFS_ENABLED; mii.wID = 999; mii.dwTypeData = _T("[Directory scan]"); - mii.cch = _tcslen (mii.dwTypeData); + mii.cch = uaetcslen(mii.dwTypeData); InsertMenuItem (menu, -1, TRUE, &mii); got = 1; } @@ -1017,7 +1018,7 @@ static int popupmenu (HWND hwnd, struct favitems *items, int morefiles) mii.fState = MFS_ENABLED; mii.wID = 1 + i; mii.dwTypeData = items[i].value; - mii.cch = _tcslen (mii.dwTypeData); + mii.cch = uaetcslen(mii.dwTypeData); InsertMenuItem (menu, -1, TRUE, &mii); } i++; @@ -3302,13 +3303,13 @@ static int loopmulti (const TCHAR *s, TCHAR *out) static int index; if (!out) { - index = _tcslen (s) + 1; + index = uaetcslen(s) + 1; return 1; } if (index < 0) return 0; if (!s[index]) { - if (s[_tcslen (s) + 1] == 0) { + if (s[uaetcslen(s) + 1] == 0) { _tcscpy (out, s); index = -1; return 1; @@ -3316,7 +3317,7 @@ static int loopmulti (const TCHAR *s, TCHAR *out) return 0; } _stprintf (out, _T("%s\\%s"), s, s + index); - index += _tcslen (s + index) + 1; + index += uaetcslen(s + index) + 1; return 1; } @@ -5282,7 +5283,7 @@ static void InitializeListView (HWND hDlg) lvstruct.iSubItem = 0; result = ListView_InsertItem (list, &lvstruct); _tcscpy (tmp2, workprefs.dfxlist[i]); - j = _tcslen (tmp2) - 1; + j = uaetcslen(tmp2) - 1; if (j < 0) j = 0; while (j > 0) { @@ -19151,7 +19152,7 @@ static int genericpopupmenu (HWND hwnd, TCHAR **items, int *flags, int num) mii.fState |= MFS_CHECKED; mii.wID = i + 1; mii.dwTypeData = items[i]; - mii.cch = _tcslen (mii.dwTypeData); + mii.cch = uaetcslen(mii.dwTypeData); InsertMenuItem (menu, -1, TRUE, &mii); } GetCursorPos (&pt); diff --git a/od-win32/win32gui_extra.cpp b/od-win32/win32gui_extra.cpp index 5c4be637..3262d354 100644 --- a/od-win32/win32gui_extra.cpp +++ b/od-win32/win32gui_extra.cpp @@ -1060,7 +1060,7 @@ static int scaleresource2 (struct newresource *res, HWND parent, int resize, int p = skiptextone (p); p = todword (p); - int remain = ps2 - (BYTE*)res->sourceresource; + size_t remain = ps2 - (BYTE*)res->sourceresource; memcpy (p, ps2, res->sourcesize - remain); int id2 = 0; @@ -1603,10 +1603,10 @@ bool show_box_art(const TCHAR *path, const TCHAR *configpath) _tcscpy(config_path, configpath); } - int len = _tcslen(config_path); + int len = uaetcslen(config_path); if (len > 4 && !_tcsicmp(config_path + len - 4, _T(".uae"))) config_path[len - 4] = 0; - if (_tcslen(config_path) > 0) + if (uaetcslen(config_path) > 0) SetWindowText(boxarthwnd, config_path); if (max_visible_boxart_images < 1) { diff --git a/qemuvga/cirrus_vga.cpp b/qemuvga/cirrus_vga.cpp index 0aff01ca..ea615a2e 100644 --- a/qemuvga/cirrus_vga.cpp +++ b/qemuvga/cirrus_vga.cpp @@ -772,7 +772,7 @@ static void cirrus_bitblt_cputovideo_next(CirrusVGAState * s) word alignment, so we keep them for the next line */ /* XXX: keep alignment to speed up transfer */ end_ptr = s->cirrus_bltbuf + s->cirrus_blt_srcpitch; - copy_count = s->cirrus_srcptr_end - end_ptr; + copy_count = (int)(s->cirrus_srcptr_end - end_ptr); memmove(s->cirrus_bltbuf, end_ptr, copy_count); s->cirrus_srcptr = s->cirrus_bltbuf + copy_count; s->cirrus_srcptr_end = s->cirrus_bltbuf + s->cirrus_blt_srcpitch; diff --git a/qemuvga/es1370.cpp b/qemuvga/es1370.cpp index 5d1eeffa..b0922a8e 100644 --- a/qemuvga/es1370.cpp +++ b/qemuvga/es1370.cpp @@ -836,7 +836,7 @@ static void es1370_transfer_audio (ES1370State *s, struct chan *d, int loop_sel, int left = ((size - cnt + 1) << 2) + d->leftover; int transferred = 0; int temp = audio_MIN (max, audio_MIN (left, csc_bytes)); - int index = d - &s->chan[0]; + int index = (int)(d - &s->chan[0]); addr += (cnt << 2) + d->leftover; diff --git a/qemuvga/vga.cpp b/qemuvga/vga.cpp index 942db176..6dbae9b7 100644 --- a/qemuvga/vga.cpp +++ b/qemuvga/vga.cpp @@ -2379,7 +2379,7 @@ static void vga_update_text(void *opaque, console_ch_t *chardata) for (dst = chardata, i = 0; i < s->last_width * height; i ++) console_write_ch(dst ++, ' '); - size = strlen(msg_buffer); + size = (int)strlen(msg_buffer); width = (s->last_width - size) / 2; dst = chardata + s->last_width + width; for (i = 0; i < size; i ++) diff --git a/uaeipc.cpp b/uaeipc.cpp index 8f861ae1..71742148 100644 --- a/uaeipc.cpp +++ b/uaeipc.cpp @@ -84,10 +84,10 @@ static void parsemessage(TCHAR *in, struct uae_prefs *p, TCHAR *out, int outsize for (;;) { int ret; tmpout[0] = 0; - ret = cfgfile_modify (index, in, _tcslen (in), tmpout, sizeof (tmpout) / sizeof (TCHAR)); + ret = cfgfile_modify (index, in, uaetcslen(in), tmpout, sizeof (tmpout) / sizeof (TCHAR)); index++; - if (_tcslen (tmpout) > 0) { - if (_tcslen (out) == 0) + if (uaetcslen(tmpout) > 0) { + if (uaetcslen(out) == 0) _tcscat (out, _T("200 ")); _tcsncat (out, _T("\n"), outsize); _tcsncat (out, tmpout, outsize); @@ -261,7 +261,7 @@ int checkIPC (void *vipc, struct uae_prefs *p) if (ipc->binary) { ok = WriteFile (ipc->hipc, &ipc->outbin[ipc->outmessages][0], ipc->outbinlen[ipc->outmessages], &ret, &ipc->ol); } else { - ok = WriteFile (ipc->hipc, ipc->outmsg[ipc->outmessages], (_tcslen (ipc->outmsg[ipc->outmessages]) + 1) * sizeof (TCHAR), &ret, &ipc->ol); + ok = WriteFile (ipc->hipc, ipc->outmsg[ipc->outmessages], (uaetcslen(ipc->outmsg[ipc->outmessages]) + 1) * sizeof (TCHAR), &ret, &ipc->ol); } xfree (ipc->outmsg[ipc->outmessages--]); err = GetLastError (); @@ -338,16 +338,16 @@ int checkIPC (void *vipc, struct uae_prefs *p) if (type == 1) { char *outp = uutf8 (out); strcpy ((char*)ipc->outbuf, outp); - outlen = strlen ((char*)ipc->outbuf) + sizeof (char); + outlen = uaestrlen((char*)ipc->outbuf) + sizeof (char); xfree (outp); } else if (type == 2) { if (_tcslen (out) >= IPC_BUFFER_SIZE) out[IPC_BUFFER_SIZE - 1] = 0; _tcscpy ((TCHAR*)ipc->outbuf, out); - outlen = (_tcsclen ((TCHAR*)ipc->outbuf) + 1) * sizeof (TCHAR); + outlen = (uaetcslen((TCHAR*)ipc->outbuf) + 1) * sizeof (TCHAR); } else { ua_copy ((uae_char*)ipc->outbuf, sizeof ipc->outbuf, out); - outlen = strlen ((char*)ipc->outbuf) + sizeof (char); + outlen = uaestrlen((char*)ipc->outbuf) + sizeof (char); } memset (&ipc->ol, 0, sizeof (OVERLAPPED)); ipc->ol.hEvent = ipc->olevent; diff --git a/zfile_archive.cpp b/zfile_archive.cpp index 761233bb..4262e8e6 100644 --- a/zfile_archive.cpp +++ b/zfile_archive.cpp @@ -451,7 +451,7 @@ static struct zfile *archive_do_zip (struct znode *zn, struct zfile *z, int flag int err = -1; if (!(flags & FILE_DELAYEDOPEN) || z->size <= PEEK_BYTES) { unpack_log (_T("ZIP: unpacking %s, flags=%d\n"), name, flags); - err = unzReadCurrentFile (uz, z->data, (size_t)z->datasize); + err = unzReadCurrentFile (uz, z->data, (unsigned int)z->datasize); unpack_log (_T("ZIP: unpacked, code=%d\n"), err); } else { z->archiveparent = zfile_dup (zn->volume->archive); @@ -460,11 +460,11 @@ static struct zfile *archive_do_zip (struct znode *zn, struct zfile *z, int flag xfree (z->archiveparent->name); z->archiveparent->name = my_strdup (tmp); z->datasize = PEEK_BYTES; - err = unzReadCurrentFile (uz, z->data, (size_t)z->datasize); + err = unzReadCurrentFile (uz, z->data, (unsigned int)z->datasize); unpack_log (_T("ZIP: unpacked, code=%d\n"), err); } else { unpack_log (_T("ZIP: unpacking %s (failed DELAYEDOPEN)\n"), name); - err = unzReadCurrentFile (uz, z->data, (size_t)z->datasize); + err = unzReadCurrentFile (uz, z->data, (unsigned int)z->datasize); unpack_log (_T("ZIP: unpacked, code=%d\n"), err); } } @@ -903,7 +903,7 @@ static HRESULT __stdcall readCallback (int StreamID, uae_u64 offset, uae_u32 cou int ret; zfile_fseek (f, (long)offset, SEEK_SET); - ret = zfile_fread (buf, 1, count, f); + ret = (int)zfile_fread (buf, 1, count, f); if (processedSize) *processedSize = ret; return 0; @@ -913,7 +913,7 @@ static HRESULT __stdcall writeCallback (int StreamID, uae_u64 offset, uae_u32 co struct zfile *f = arcacc_stack[StreamID]; int ret; - ret = zfile_fwrite ((void*)buf, 1, count, f); + ret = (int)zfile_fwrite ((void*)buf, 1, count, f); if (processedSize) *processedSize = ret; if (ret != count)