Warning fixes.

This commit is contained in:
Toni Wilen 2022-10-23 20:40:04 +03:00
parent 3d71f2d8fa
commit 2d3642dc62
14 changed files with 73 additions and 54 deletions

View 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;

View 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);

View 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);

View 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);
}

View 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 */

View File

@ -11,7 +11,11 @@
* 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)
{

View 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;
}

View 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*/
}

View 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)

View 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);

View 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 */

View 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

View 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 );

View File

@ -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)