Warning fixes.

This commit is contained in:
Toni Wilen 2022-05-01 18:00:42 +03:00
parent a1501346ea
commit 847820d126
32 changed files with 1138 additions and 1138 deletions

View File

@ -280,7 +280,7 @@ decode_c_dyn(void)
cnt = 0;
}
} while (c > 0);
fillbuf(cnt);
fillbuf((unsigned char)cnt);
c = ~c;
update_c(c);
if (c == n1)
@ -312,7 +312,7 @@ decode_p_dyn(void)
cnt = 0;
}
}
fillbuf(cnt);
fillbuf((unsigned char)cnt);
c = (~c) - N_CHAR;
update_p(c);

View File

@ -90,7 +90,7 @@ struct zfile *archive_access_lha (struct znode *zn)
switch (zn->method) {
case LZHUFF0_METHOD_NUM:
case LARC4_METHOD_NUM:
zfile_fread(out->data, zn->size, 1, zf);
zfile_fread(out->data, (size_t)zn->size, 1, zf);
break;
case LARC_METHOD_NUM: /* -lzs- */
lhinterface.dicbit = 11;

View File

@ -715,7 +715,7 @@ struct zfile *archive_access_lzx (struct znode *zn)
if (!znfirst->f) {
dstf = zfile_fopen_empty (zf, znfirst->name, znfirst->size);
if (znfirst->size) {
zfile_fwrite(dbuf + znfirst->offset2, znfirst->size, 1, dstf);
zfile_fwrite(dbuf + znfirst->offset2, (size_t)znfirst->size, 1, dstf);
}
znfirst->f = dstf;
if (znfirst == zn)

View File

@ -688,7 +688,7 @@ static void pcem_flush(struct rtggfxboard* gb, int index)
gb->pcemdev->force_redraw(gb->pcemobject);
} else {
for (int i = 0; i < cnt; i++) {
int offset = buf[i] - start;
int offset = (int)(buf[i] - start);
pcem_linear_mark(offset);
}
}
@ -1345,7 +1345,7 @@ DisplaySurface* qemu_create_displaysurface_from(int width, int height, int bpp,
struct rtggfxboard *gb = &rtggfxboards[i];
if (data >= gb->vram && data < gb->vramend) {
struct picasso96_state_struct *state = &picasso96_state[gb->monitor_id];
state->XYOffset = (gb->vram - data) + gfxmem_banks[gb->rtg_index]->start;
state->XYOffset = (int)((gb->vram - data) + gfxmem_banks[gb->rtg_index]->start);
gb->resolutionchange = 1;
return &gb->fakesurface;
}
@ -4074,7 +4074,8 @@ int gfxboard_get_index_from_id(int id)
if (id == GFXBOARD_UAE_Z3)
return GFXBOARD_UAE_Z3;
const struct gfxboard *b = find_board(id);
return b - &boards[0] + GFXBOARD_HARDWARE;}
return (int)(b - &boards[0] + GFXBOARD_HARDWARE);
}
int gfxboard_get_id_from_index(int index)
{
@ -4469,7 +4470,7 @@ bool gfxboard_init_memory (struct autoconfig_info *aci)
if (zf) {
gb->bios = xcalloc(uae_u8, 65536);
gb->bios_mask = 65535;
int size = zfile_fread(gb->bios, 1, 65536, zf);
int size = (int)zfile_fread(gb->bios, 1, 65536, zf);
zfile_fclose(zf);
write_log(_T("PCI RTG board BIOS load, %d bytes\n"), size);
} else {

View File

@ -43,11 +43,6 @@
#define DUNUSED(x)
#define D
#if DEBUG
#define bug write_log
#else
#define bug
#endif
static __inline void flush_internals (void) { }

View File

@ -137,7 +137,7 @@ extern void zfile_resetdir_archive (struct zdirectory *);
extern int zfile_fill_file_attrs_archive (const TCHAR *path, int *isdir, int *flags, TCHAR **comment);
extern uae_s64 zfile_lseek_archive (struct zfile *d, uae_s64 offset, int whence);
extern uae_s64 zfile_fsize_archive (struct zfile *d);
extern unsigned int zfile_read_archive (struct zfile *d, void *b, unsigned int size);
extern int zfile_read_archive (struct zfile *d, void *b, unsigned int size);
extern void zfile_close_archive (struct zfile *d);
extern struct zfile *zfile_open_archive (const TCHAR *path, int flags);
extern int zfile_exists_archive (const TCHAR *path, const TCHAR *rel);

View File

@ -2656,21 +2656,21 @@ static int createmask2texture(struct d3d11struct *d3d, const TCHAR *filename)
}
d3d->mask2texture_wh = (float)d3d->m_screenHeight;
d3d->mask2texture_ww = (float)d3d->mask2texture_w * d3d->mask2texture_multx;
d3d->mask2texture_ww = d3d->mask2texture_w * d3d->mask2texture_multx;
d3d->mask2texture_offsetw = (d3d->m_screenWidth - d3d->mask2texture_ww) / 2;
if (d3d->mask2texture_offsetw > 0) {
allocsprite(d3d, &d3d->blanksprite, (int)d3d->mask2texture_offsetw + 1, d3d->m_screenHeight, false);
allocsprite(d3d, &d3d->blanksprite, (int)(d3d->mask2texture_offsetw + 1), d3d->m_screenHeight, false);
}
xmult = d3d->mask2texture_multx;
ymult = d3d->mask2texture_multy;
d3d->mask2rect.left *= (int)xmult;
d3d->mask2rect.right *= (int)xmult;
d3d->mask2rect.top *= (int)ymult;
d3d->mask2rect.bottom *= (int)ymult;
d3d->mask2rect.left = (int)(d3d->mask2rect.left * xmult);
d3d->mask2rect.right = (int)(d3d->mask2rect.right * xmult);
d3d->mask2rect.top = (int)(d3d->mask2rect.top * ymult);
d3d->mask2rect.bottom = (int)(d3d->mask2rect.bottom * ymult);
d3d->mask2texture_wwx = d3d->mask2texture_w * xmult;
if (d3d->mask2texture_wwx > d3d->m_screenWidth)
d3d->mask2texture_wwx = (float)d3d->m_screenWidth;
@ -4242,9 +4242,9 @@ static void RenderSprite(struct d3d11struct *d3d, struct d3d11sprite *spr)
if (!spr->enabled)
return;
left = (d3d->m_screenWidth + 1.0f) / -2.0f;
left = (float)((d3d->m_screenWidth + 1) / -2);
left += spr->x;
top = (d3d->m_screenHeight + 1.0f) / 2.0f;
top = (float)((d3d->m_screenHeight + 1) / 2);
top -= spr->y;
if (spr->outwidth) {

View File

@ -624,8 +624,8 @@ struct picasso96_state_struct
uae_u16 VirtualHeight; /* Total screen height */
uae_u8 GC_Depth; /* From SetGC() */
uae_u8 GC_Flags; /* From SetGC() */
long XOffset; /* From SetPanning() */
long YOffset; /* From SetPanning() */
int XOffset; /* From SetPanning() */
int YOffset; /* From SetPanning() */
uae_u8 SwitchState; /* From SetSwitch() - 0 is Amiga, 1 isPicasso */
uae_u8 BytesPerPixel;
uae_u8 CardFound;
@ -637,7 +637,7 @@ struct picasso96_state_struct
// support NO direct access all the time to gfx Card
// every time windows can remove your surface from card so the mainrender place
// must be in memory
long XYOffset;
int XYOffset;
bool dualclut, advDragging;
int HLineDBL, VLineDBL;
};

View File

@ -485,11 +485,11 @@ int port_insert_custom (int inputmap_port, int devicetype, DWORD flags, const TC
if (!p3 || p3 >= p2) {
p3 = NULL;
if (eventlen < 0)
eventlen = p2 - p;
eventlen = (int)(p2 - p);
break;
}
if (eventlen < 0)
eventlen = p3 - p;
eventlen = (int)(p3 - p);
if (!_tcsnicmp (p3 + 1, L"autorepeat", 10))
flags |= IDEV_MAPPED_AUTOFIRE_SET;
p4 = p3 + 1;
@ -1388,8 +1388,8 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM
}
return 1;
case RP_IPC_TO_GUEST_VOLUME:
currprefs.sound_volume_master = changed_prefs.sound_volume_master = 100 - wParam;
currprefs.sound_volume_cd = changed_prefs.sound_volume_cd = 100 - wParam;
currprefs.sound_volume_master = changed_prefs.sound_volume_master = 100 - (int)wParam;
currprefs.sound_volume_cd = changed_prefs.sound_volume_cd = 100 - (int)wParam;
set_volume (currprefs.sound_volume_master, 0);
return TRUE;
#if 0
@ -1523,7 +1523,7 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM
case RP_IPC_TO_GUEST_MOVESCREENOVERLAY:
return movescreenoverlay(wParam, lParam);
case RP_IPC_TO_GUEST_SENDMOUSEEVENTS:
sendmouseevents = wParam;
sendmouseevents = (int)wParam;
if (sendmouseevents) {
LPARAM lp = MAKELONG(mouseevent_x, mouseevent_y);
RPPostMessagex(RP_IPC_TO_HOST_MOUSEMOVE, 0, lp, &guestinfo);

View File

@ -2569,7 +2569,7 @@ static LRESULT CALLBACK AmigaWindowProc(HWND hWnd, UINT message, WPARAM wParam,
tablet = NULL;
return 0;
}
if (pWTPacket((HCTX)lParam, wParam, &pkt)) {
if (pWTPacket((HCTX)lParam, (UINT)wParam, &pkt)) {
int x, y, z, pres, proxi;
DWORD buttons;
ORIENTATION ori;
@ -5250,9 +5250,9 @@ static int shell_associate_2 (const TCHAR *extension, const TCHAR *shellcommand,
_tcscat (rpath2, extension);
if (RegCreateKeyEx (rkey, rpath2, 0, NULL, REG_OPTION_NON_VOLATILE,
KEY_WRITE | KEY_READ, NULL, &key1, &disposition) == ERROR_SUCCESS) {
RegSetValueEx (key1, _T(""), 0, REG_SZ, (CONST BYTE *)defprogid, (_tcslen (defprogid) + 1) * sizeof (TCHAR));
RegSetValueEx (key1, _T(""), 0, REG_SZ, (CONST BYTE *)defprogid, (uaetcslen(defprogid) + 1) * sizeof (TCHAR));
if (perceivedtype)
RegSetValueEx (key1, _T("PerceivedType"), 0, REG_SZ, (CONST BYTE *)perceivedtype, (_tcslen (perceivedtype) + 1) * sizeof (TCHAR));
RegSetValueEx (key1, _T("PerceivedType"), 0, REG_SZ, (CONST BYTE *)perceivedtype, (uaetcslen(perceivedtype) + 1) * sizeof (TCHAR));
RegCloseKey (key1);
}
_tcscpy (rpath2, rpath1);
@ -5262,12 +5262,12 @@ static int shell_associate_2 (const TCHAR *extension, const TCHAR *shellcommand,
if (description) {
if (RegCreateKeyEx (rkey, rpath2, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE | KEY_READ, NULL, &key1, &disposition) == ERROR_SUCCESS) {
TCHAR tmp[MAX_DPATH];
RegSetValueEx (key1, _T(""), 0, REG_SZ, (CONST BYTE *)description, (_tcslen (description) + 1) * sizeof (TCHAR));
RegSetValueEx (key1, _T("AppUserModelID"), 0, REG_SZ, (CONST BYTE *)WINUAEAPPNAME, (_tcslen (WINUAEAPPNAME) + 1) * sizeof (TCHAR));
RegSetValueEx (key1, _T(""), 0, REG_SZ, (CONST BYTE *)description, (uaetcslen(description) + 1) * sizeof (TCHAR));
RegSetValueEx (key1, _T("AppUserModelID"), 0, REG_SZ, (CONST BYTE *)WINUAEAPPNAME, (uaetcslen(WINUAEAPPNAME) + 1) * sizeof (TCHAR));
_tcscpy (tmp, rpath2);
_tcscat (tmp, _T("\\CurVer"));
if (RegCreateKeyEx (rkey, tmp, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE | KEY_READ, NULL, &key2, &disposition) == ERROR_SUCCESS) {
RegSetValueEx (key2, _T(""), 0, REG_SZ, (CONST BYTE *)defprogid, (_tcslen (defprogid) + 1) * sizeof (TCHAR));
RegSetValueEx (key2, _T(""), 0, REG_SZ, (CONST BYTE *)defprogid, (uaetcslen(defprogid) + 1) * sizeof (TCHAR));
RegCloseKey (key2);
}
if (icon) {
@ -5275,7 +5275,7 @@ static int shell_associate_2 (const TCHAR *extension, const TCHAR *shellcommand,
_tcscat (tmp, _T("\\DefaultIcon"));
if (RegCreateKeyEx (rkey, tmp, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE | KEY_READ, NULL, &key2, &disposition) == ERROR_SUCCESS) {
_stprintf (tmp, _T("%s,%d"), executable_path, -icon);
RegSetValueEx (key2, _T(""), 0, REG_SZ, (CONST BYTE *)tmp, (_tcslen (tmp) + 1) * sizeof (TCHAR));
RegSetValueEx (key2, _T(""), 0, REG_SZ, (CONST BYTE *)tmp, (uaetcslen(tmp) + 1) * sizeof (TCHAR));
RegCloseKey (key2);
}
}
@ -5305,7 +5305,7 @@ static int shell_associate_2 (const TCHAR *extension, const TCHAR *shellcommand,
KEY_WRITE | KEY_READ, NULL, &key1, &disposition) == ERROR_SUCCESS) {
TCHAR tmp[MAX_DPATH];
_stprintf (tmp, _T("%s,%d"), executable_path, -cc[i].icon);
RegSetValueEx (key1, _T("Icon"), 0, REG_SZ, (CONST BYTE *)tmp, (_tcslen (tmp) + 1) * sizeof (TCHAR));
RegSetValueEx (key1, _T("Icon"), 0, REG_SZ, (CONST BYTE *)tmp, (uaetcslen(tmp) + 1) * sizeof (TCHAR));
RegCloseKey (key1);
}
}
@ -5314,7 +5314,7 @@ static int shell_associate_2 (const TCHAR *extension, const TCHAR *shellcommand,
KEY_WRITE | KEY_READ, NULL, &key1, &disposition) == ERROR_SUCCESS) {
TCHAR path[MAX_DPATH];
_stprintf (path, _T("\"%sWinUAE.exe\" %s"), start_path_exe, cc[i].command);
RegSetValueEx (key1, _T(""), 0, REG_SZ, (CONST BYTE *)path, (_tcslen (path) + 1) * sizeof (TCHAR));
RegSetValueEx (key1, _T(""), 0, REG_SZ, (CONST BYTE *)path, (uaetcslen(path) + 1) * sizeof (TCHAR));
RegCloseKey (key1);
}
}
@ -5437,10 +5437,10 @@ static void associate_init_extensions (void)
if (setit) {
if (RegCreateKeyEx (rkey, rpath, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL, &key1, &disposition) == ERROR_SUCCESS) {
DWORD val = 1;
RegSetValueEx (key1, _T(""), 0, REG_SZ, (CONST BYTE *)executable_path, (_tcslen (executable_path) + 1) * sizeof (TCHAR));
RegSetValueEx (key1, _T(""), 0, REG_SZ, (CONST BYTE *)executable_path, (uaetcslen(executable_path) + 1) * sizeof (TCHAR));
RegSetValueEx (key1, _T("UseUrl"), 0, REG_DWORD, (LPBYTE)&val, sizeof val);
_tcscpy (rpath, start_path_exe);
rpath[_tcslen (rpath) - 1] = 0;
rpath[uaetcslen(rpath) - 1] = 0;
RegSetValueEx (key1, _T("Path"), 0, REG_SZ, (CONST BYTE *)rpath, (uaetcslen(rpath) + 1) * sizeof (TCHAR));
RegCloseKey (key1);
SHChangeNotify (SHCNE_ASSOCCHANGED, 0, 0, 0);

View File

@ -1137,7 +1137,7 @@ void S2X_render(int monid, int y_start, int y_end)
if (usedfilter->type == UAE_FILTER_SCALE2X) { /* 16+32/2X */
if (dptr + pitch * ah * 2 >= enddptr)
ah = (enddptr - dptr) / (pitch * 2);
ah = (int)((enddptr - dptr) / (pitch * 2));
if (amiga_depth == 16 && dst_depth == 16) {
AdMame2x (sptr, vb->rowbytes, dptr, pitch, aw, ah);
@ -1193,7 +1193,7 @@ void S2X_render(int monid, int y_start, int y_end)
} else if (usedfilter->type == UAE_FILTER_SUPEREAGLE) { /* 16/32/2X */
if (dptr + pitch * ah * 2 >= enddptr)
ah = (enddptr - dptr) / (pitch * 2);
ah = (int)((enddptr - dptr) / (pitch * 2));
if (scale == 2 && amiga_depth == 16) {
if (dst_depth == 16) {
@ -1208,7 +1208,7 @@ void S2X_render(int monid, int y_start, int y_end)
} else if (usedfilter->type == UAE_FILTER_SUPER2XSAI) { /* 16/32/2X */
if (dptr + pitch * ah * 2 >= enddptr)
ah = (enddptr - dptr) / (pitch * 2);
ah = (int)((enddptr - dptr) / (pitch * 2));
if (scale == 2 && amiga_depth == 16) {
if (dst_depth == 16) {
@ -1223,7 +1223,7 @@ void S2X_render(int monid, int y_start, int y_end)
} else if (usedfilter->type == UAE_FILTER_2XSAI) { /* 16/32/2X */
if (dptr + pitch * ah * 2 >= enddptr)
ah = (enddptr - dptr) / (pitch * 2);
ah = (int)((enddptr - dptr) / (pitch * 2));
if (scale == 2 && amiga_depth == 16) {
if (dst_depth == 16) {

File diff suppressed because it is too large Load Diff

View File

@ -21,6 +21,8 @@ void write_disk_history (void);
#define MAX_GUIIDPARAMS 16
#define MAX_DLGID 100
#define xSendDlgItemMessage(a, b, c, d, e) (int)SendDlgItemMessage(a, b, c, (WPARAM)d, (LPARAM)e)
struct dlgstore
{
RECT r;

View File

@ -327,7 +327,7 @@ static int tape_read (struct scsi_data_tape *tape, uae_u8 *scsi_data, int len, b
if (tape->zf) {
zfile_fseek(tape->zf, tape->file_offset, SEEK_SET);
if (scsi_data) {
got = zfile_fread(scsi_data, 1, len, tape->zf);
got = (int)zfile_fread(scsi_data, 1, len, tape->zf);
uae_s64 pos = zfile_ftell(tape->zf);
if (log_tapeemu)
write_log(_T("TAPEEMU READ: Requested %ld, read %ld, pos %lld, %lld remaining.\n"), len, got, pos, zfile_size(tape->zf) - pos);
@ -336,7 +336,7 @@ static int tape_read (struct scsi_data_tape *tape, uae_u8 *scsi_data, int len, b
if (len > 0) {
uae_u8 *data = xmalloc(uae_u8, len);
if (data) {
got = zfile_fread(data, 1, len, tape->zf);
got = (int)zfile_fread(data, 1, len, tape->zf);
xfree(data);
}
}
@ -364,7 +364,7 @@ static int tape_write (struct scsi_data_tape *tape, uae_u8 *scsi_data, int len)
if (!zf)
return -1;
zfile_fseek (zf, 0, SEEK_END);
len = zfile_fwrite (scsi_data, 1, len, zf);
len = (int)zfile_fwrite (scsi_data, 1, len, zf);
zfile_fclose (zf);
if (!exists) {
if (tape->index) {

View File

@ -218,7 +218,7 @@ static void bootp_reply(struct bootp_t *bp)
q += 4;
if (*slirp_hostname) {
val = strlen(slirp_hostname);
val = uaestrlen(slirp_hostname);
*q++ = RFC1533_HOSTNAME;
*q++ = val;
memcpy(q, slirp_hostname, val);

View File

@ -44,7 +44,7 @@
#define ADDCARRY(x) (x > 65535 ? x -= 65535 : x)
#define REDUCE {l_util.l = sum; sum = l_util.s[0] + l_util.s[1]; ADDCARRY(sum);}
int cksum(struct mbuf *m, int len)
u_short cksum(struct mbuf *m, int len)
{
u_int16_t *w;
int sum = 0;
@ -64,7 +64,7 @@ int cksum(struct mbuf *m, int len)
goto cont;
w = mtod(m, u_int16_t *);
mlen = m->m_len;
mlen = (int)m->m_len;
if (len < mlen)
mlen = len;

View File

@ -5,7 +5,7 @@
* terms and conditions of the copyright.
*/
#define SLIRP_DEBUG 1
#define SLIRP_DEBUG 0
#define PRN_STDERR 1
#define PRN_SPRINTF 2

View File

@ -306,7 +306,7 @@ if_start(void)
}
/* Encapsulate the packet for sending */
if_encap((uint8_t*)ifm->m_data, ifm->m_len);
if_encap((uint8_t*)ifm->m_data, (int)ifm->m_len);
m_free(ifm);

View File

@ -209,7 +209,7 @@ void icmp_input(struct mbuf *m, int hlen)
addr.sin_addr = so->so_faddr;
}
addr.sin_port = so->so_fport;
if(sendto(so->s, icmp_ping_msg, strlen(icmp_ping_msg), 0,
if(sendto(so->s, icmp_ping_msg, uaestrlen(icmp_ping_msg), 0,
(struct sockaddr *)&addr, sizeof(addr)) == -1) {
DEBUG_MISC(("icmp_input udp sendto tx errno = %d-%s\n",
errno,strerror(errno)));
@ -299,7 +299,7 @@ void icmp_error(struct mbuf *msrc, u_char type, u_char code, int minsize, const
/* make a copy */
if(!(m=m_get())) goto end_error; /* get mbuf */
{ u_int new_m_size;
new_m_size=sizeof(struct ip )+ICMP_MINLEN+msrc->m_len+ICMP_MAXDATALEN;
new_m_size=(u_int)(sizeof(struct ip )+ICMP_MINLEN+msrc->m_len+ICMP_MAXDATALEN);
if(new_m_size>m->m_size) m_inc(m, new_m_size);
}
memcpy(m->m_data, msrc->m_data, msrc->m_len);
@ -337,7 +337,7 @@ void icmp_error(struct mbuf *msrc, u_char type, u_char code, int minsize, const
if(message) { /* DEBUG : append message to ICMP packet */
int message_len;
char *cpnt;
message_len=strlen(message);
message_len=uaestrlen(message);
if(message_len>ICMP_MAXDATALEN) message_len=ICMP_MAXDATALEN;
cpnt=(char *)m->m_data+m->m_len;
memcpy(cpnt, message, message_len);
@ -346,7 +346,7 @@ void icmp_error(struct mbuf *msrc, u_char type, u_char code, int minsize, const
#endif
icp->icmp_cksum = 0;
icp->icmp_cksum = cksum(m, m->m_len);
icp->icmp_cksum = cksum(m, (int)m->m_len);
m->m_data -= hlen;
m->m_len += hlen;

View File

@ -135,7 +135,7 @@ void ip_input(struct mbuf *m)
}
/* Should drop packet if mbuf too long? hmmm... */
if (m->m_len > ip->ip_len)
m_adj(m, ip->ip_len - m->m_len);
m_adj(m, (int)(ip->ip_len - m->m_len));
/* check ip_ttl for a correct ICMP reply */
if(ip->ip_ttl==0 || ip->ip_ttl==1) {
@ -371,7 +371,7 @@ insert:
*/
if (m->m_flags & M_EXT) {
int delta;
delta = (char *)q - m->m_dat;
delta = (int)((char *)q - m->m_dat);
q = (struct ipasfrag *)(m->m_ext + delta);
}
@ -685,7 +685,7 @@ void ip_stripoptions(struct mbuf *m, struct mbuf *mopt)
olen = (ip->ip_hl<<2) - sizeof (struct ip);
opts = (caddr_t)(ip + 1);
i = m->m_len - (sizeof (struct ip) + olen);
i = (int)(m->m_len - (sizeof (struct ip) + olen));
memcpy(opts, opts + olen, (unsigned)i);
m->m_len -= olen;

View File

@ -146,7 +146,7 @@ void m_cat(struct mbuf *m, struct mbuf *n)
* If there's no room, realloc
*/
if (M_FREEROOM(m) < n->m_len)
m_inc(m,m->m_size+MINCSIZE);
m_inc(m,(int)(m->m_size+MINCSIZE));
memcpy(m->m_data+m->m_len, n->m_data, n->m_len);
m->m_len += n->m_len;
@ -164,7 +164,7 @@ void m_inc(struct mbuf *m, int size)
if(m->m_size>size) return;
if (m->m_flags & M_EXT) {
datasize = m->m_data - m->m_ext;
datasize = (int)(m->m_data - m->m_ext);
m->m_ext = (char *)realloc(m->m_ext,size);
/* if (m->m_ext == NULL)
* return (struct mbuf *)NULL;
@ -172,7 +172,7 @@ void m_inc(struct mbuf *m, int size)
m->m_data = m->m_ext + datasize;
} else {
char *dat;
datasize = m->m_data - m->m_dat;
datasize = (int)(m->m_data - m->m_dat);
dat = (char *)malloc(size);
/* if (dat == NULL)
* return (struct mbuf *)NULL;

View File

@ -575,7 +575,7 @@ void lprint(const char *format, ...)
* Remove \r's
* otherwise you'll get ^M all over the file
*/
int len = strlen(format);
int len = uaestrlen(format);
char *bptr1, *bptr2;
bptr1 = bptr2 = strdup(format);

View File

@ -96,7 +96,7 @@ void sbappend(struct socket *so, struct mbuf *m)
* ottherwise it'll arrive out of order, and hence corrupt
*/
if (!so->so_rcv.sb_cc)
ret = send(so->s, m->m_data, m->m_len, 0);
ret = send(so->s, m->m_data, (int)m->m_len, 0);
if (ret <= 0) {
/*
@ -127,21 +127,21 @@ void sbappendsb(struct sbuf *sb, struct mbuf *m)
{
int len, n, nn;
len = m->m_len;
len = (int)m->m_len;
if (sb->sb_wptr < sb->sb_rptr) {
n = sb->sb_rptr - sb->sb_wptr;
n = (int)(sb->sb_rptr - sb->sb_wptr);
if (n > len) n = len;
memcpy(sb->sb_wptr, m->m_data, n);
} else {
/* Do the right edge first */
n = sb->sb_data + sb->sb_datalen - sb->sb_wptr;
n = (int)(sb->sb_data + sb->sb_datalen - sb->sb_wptr);
if (n > len) n = len;
memcpy(sb->sb_wptr, m->m_data, n);
len -= n;
if (len) {
/* Now the left edge */
nn = sb->sb_rptr - sb->sb_data;
nn = (int)(sb->sb_rptr - sb->sb_data);
if (nn > len) nn = len;
memcpy(sb->sb_data,m->m_data+n,nn);
n += nn;
@ -172,7 +172,7 @@ void sbcopy(struct sbuf *sb, int off, int len, char *to)
memcpy(to,from,len);
} else {
/* re-use off */
off = (sb->sb_data + sb->sb_datalen) - from;
off = (int)((sb->sb_data + sb->sb_datalen) - from);
if (off > len) off = len;
memcpy(to,from,off);
len -= off;

View File

@ -3,7 +3,7 @@
#define CONFIG_QEMU
#define DEBUG 1
//#define DEBUG 1
#ifndef CONFIG_QEMU
#include "version.h"
@ -306,7 +306,7 @@ void lprint(const char *, ...);
#define DEFAULT_BAUD 115200
/* cksum.c */
int cksum(struct mbuf *m, int len);
u_short cksum(struct mbuf *m, int len);
/* if.c */
void if_init(void);

View File

@ -121,20 +121,20 @@ int soread(struct socket *so)
iov[0].iov_len = (sb->sb_data + sb->sb_datalen) - sb->sb_wptr;
/* Should never succeed, but... */
if (iov[0].iov_len > len) iov[0].iov_len = len;
len -= iov[0].iov_len;
len -= (int)iov[0].iov_len;
if (len) {
iov[1].iov_base = sb->sb_data;
iov[1].iov_len = sb->sb_rptr - sb->sb_data;
if(iov[1].iov_len > len)
iov[1].iov_len = len;
total = iov[0].iov_len + iov[1].iov_len;
total = (int)(iov[0].iov_len + iov[1].iov_len);
if (total > mss) {
lss = total%mss;
if (iov[1].iov_len > lss) {
iov[1].iov_len -= lss;
n = 2;
} else {
lss -= iov[1].iov_len;
lss -= (int)iov[1].iov_len;
iov[0].iov_len -= lss;
n = 1;
}
@ -151,7 +151,7 @@ int soread(struct socket *so)
nn = readv(so->s, (struct iovec *)iov, n);
DEBUG_MISC((" ... read nn = %d bytes\n", nn));
#else
nn = recv(so->s, iov[0].iov_base, iov[0].iov_len,0);
nn = recv(so->s, iov[0].iov_base, (int)iov[0].iov_len,0);
#endif
if (nn <= 0) {
int error = WSAGetLastError();
@ -177,7 +177,7 @@ int soread(struct socket *so)
*/
if (n == 2 && nn == iov[0].iov_len) {
int ret;
ret = recv(so->s, iov[1].iov_base, iov[1].iov_len,0);
ret = recv(so->s, iov[1].iov_base, (int)iov[1].iov_len,0);
if (ret > 0)
nn += ret;
}
@ -252,12 +252,12 @@ int sosendoob(struct socket *so)
* we must copy all data to a linear buffer then
* send it all
*/
len = (sb->sb_data + sb->sb_datalen) - sb->sb_rptr;
len = (int)((sb->sb_data + sb->sb_datalen) - sb->sb_rptr);
if (len > so->so_urgc) len = so->so_urgc;
memcpy(buff, sb->sb_rptr, len);
so->so_urgc -= len;
if (so->so_urgc) {
n = sb->sb_wptr - sb->sb_data;
n = (int)(sb->sb_wptr - sb->sb_data);
if (n > so->so_urgc) n = so->so_urgc;
memcpy((buff + len), sb->sb_data, n);
so->so_urgc -= n;
@ -315,7 +315,7 @@ int sowrite(struct socket *so)
} else {
iov[0].iov_len = (sb->sb_data + sb->sb_datalen) - sb->sb_rptr;
if (iov[0].iov_len > len) iov[0].iov_len = len;
len -= iov[0].iov_len;
len -= (int)iov[0].iov_len;
if (len) {
iov[1].iov_base = sb->sb_data;
iov[1].iov_len = sb->sb_wptr - sb->sb_data;
@ -331,7 +331,7 @@ int sowrite(struct socket *so)
DEBUG_MISC((" ... wrote nn = %d bytes\n", nn));
#else
nn = send(so->s, iov[0].iov_base, iov[0].iov_len,0);
nn = send(so->s, iov[0].iov_base, (int)iov[0].iov_len,0);
#endif
/* This should never happen, but people tell me it does *shrug* */
if (nn < 0) {
@ -351,7 +351,7 @@ int sowrite(struct socket *so)
#ifndef HAVE_READV
if (n == 2 && nn == iov[0].iov_len) {
int ret;
ret = send(so->s, iov[1].iov_base, iov[1].iov_len,0);
ret = send(so->s, iov[1].iov_base, (int)iov[1].iov_len,0);
if (ret > 0)
nn += ret;
}
@ -421,14 +421,14 @@ void sorecvfrom(struct socket *so)
* XXX Shouldn't FIONREAD packets destined for port 53,
* but I don't know the max packet size for DNS lookups
*/
len = M_FREEROOM(m);
len = (int)M_FREEROOM(m);
/* if (so->so_fport != htons(53)) { */
ioctlsocket(so->s, FIONREAD, &n);
if (n > len) {
n = (m->m_data - m->m_dat) + m->m_len + n + 1;
n = (int)((m->m_data - m->m_dat) + m->m_len + n + 1);
m_inc(m, n);
len = M_FREEROOM(m);
len = (int)M_FREEROOM(m);
}
/* } */
@ -503,12 +503,12 @@ int sosendto(struct socket *so, struct mbuf *m)
addr.sin_addr = so->so_faddr;
addr.sin_port = so->so_fport;
char addrstr[INET_ADDRSTRLEN];
//char addrstr[INET_ADDRSTRLEN];
DEBUG_MISC((" sendto()ing, addr.sin_port=%d, addr.sin_addr.s_addr=%.16s\n",
ntohs(addr.sin_port), inet_ntop(AF_INET, &addr.sin_addr, addrstr, sizeof(addrstr))));
/* Don't care what port we get */
ret = sendto(so->s, m->m_data, m->m_len, 0,
ret = sendto(so->s, m->m_data, (int)m->m_len, 0,
(struct sockaddr *)&addr, sizeof (struct sockaddr));
if (ret < 0)
return -1;

View File

@ -394,8 +394,8 @@ findso:
goto dropwithreset;
}
sbreserve(&so->so_snd, tcp_sndspace);
sbreserve(&so->so_rcv, tcp_rcvspace);
sbreserve(&so->so_snd, (int)tcp_sndspace);
sbreserve(&so->so_rcv, (int)tcp_rcvspace);
/* tcp_last_so = so; */ /* XXX ? */
/* tp = sototcpcb(so); */
@ -1694,7 +1694,7 @@ u_int tcp_mss(struct tcpcb *tp, u_int offer)
DEBUG_ARG("tp = %p", tp);
DEBUG_ARG("offer = %d", offer);
mss = min(if_mtu, if_mru) - sizeof(struct tcpiphdr);
mss = (u_int)(min(if_mtu, if_mru) - sizeof(struct tcpiphdr));
if (offer)
mss = min(mss, offer);
mss = max(mss, 32);
@ -1703,8 +1703,8 @@ u_int tcp_mss(struct tcpcb *tp, u_int offer)
tp->snd_cwnd = mss;
sbreserve(&so->so_snd, tcp_sndspace+((tcp_sndspace%mss)?(mss-(tcp_sndspace%mss)):0));
sbreserve(&so->so_rcv, tcp_rcvspace+((tcp_rcvspace%mss)?(mss-(tcp_rcvspace%mss)):0));
sbreserve(&so->so_snd, (int)(tcp_sndspace+((tcp_sndspace%mss)?(mss-(tcp_sndspace%mss)):0)));
sbreserve(&so->so_rcv, (int)(tcp_rcvspace+((tcp_rcvspace%mss)?(mss-(tcp_rcvspace%mss)):0)));
DEBUG_MISC((" returning mss = %d\n", mss));

View File

@ -414,7 +414,7 @@ int tcp_fconnect(struct socket *so)
addr.sin_addr = so->so_faddr;
addr.sin_port = so->so_fport;
char addrstr[INET_ADDRSTRLEN];
//char addrstr[INET_ADDRSTRLEN];
DEBUG_MISC((" connect()ing, addr.sin_port=%d, addr.sin_addr.s_addr=%.16s\n",
ntohs(addr.sin_port), inet_ntop(AF_INET, &addr.sin_addr,
addrstr, sizeof(addrstr))));

View File

@ -241,7 +241,7 @@ static void tftp_handle_rrq(struct tftp_t *tp, int pktlen)
src = tp->x.tp_buf;
dst = (u_int8_t *)spt->filename;
n = pktlen - ((uint8_t *)&tp->x.tp_buf[0] - (uint8_t *)tp);
n = (int)(pktlen - ((uint8_t *)&tp->x.tp_buf[0] - (uint8_t *)tp));
/* get name */
@ -324,11 +324,11 @@ void tftp_input(struct mbuf *m)
switch(ntohs(tp->tp_op)) {
case TFTP_RRQ:
tftp_handle_rrq(tp, m->m_len);
tftp_handle_rrq(tp, (int)m->m_len);
break;
case TFTP_ACK:
tftp_handle_ack(tp, m->m_len);
tftp_handle_ack(tp, (int)m->m_len);
break;
}
}

View File

@ -291,7 +291,7 @@ int udp_output2(struct socket *so, struct mbuf *m,
*/
ui->ui_sum = 0;
if (udpcksum) {
if ((ui->ui_sum = cksum(m, /* sizeof (struct udpiphdr) + */ m->m_len)) == 0)
if ((ui->ui_sum = cksum(m, /* sizeof (struct udpiphdr) + */ (int)m->m_len)) == 0)
ui->ui_sum = 0xffff;
}
((struct ip *)ui)->ip_len = (u_int16_t)m->m_len;

View File

@ -642,7 +642,7 @@ static bool audio_state_sndboard_uae(int streamid, void *params)
if (!s)
return false;
int highestch = s->ch;
int streamnum = s - data->stream;
int streamnum = (int)(s - data->stream);
if (s->play && (data->streammask & (1 << streamnum))) {
uaecptr addr;
int len;
@ -851,7 +851,7 @@ static void uaesnd_timer(uae_u32 v)
if (s->timer_cnt > 0 && data->enabled) {
s->timer_event_time = uaesnd_timer_period(s->timer_cnt);
if (s->timer_event_time > 0) {
event2_newevent_xx(-1, s->timer_event_time, s - &data->stream[0], uaesnd_timer);
event2_newevent_xx(-1, s->timer_event_time, (int)(s - &data->stream[0]), uaesnd_timer);
uaesnd_irq(s, 0x10);
}
}
@ -880,7 +880,7 @@ static void uaesnd_put(struct uaesndboard_data *data, struct uaesndboard_stream
s->timer_event_time = uaesnd_timer_period(timer_cnt);
if (s->timer_event_time > 0) {
s->timer_cnt = timer_cnt;
event2_newevent_xx(-1, s->timer_event_time, ((data - &uaesndboard[0]) << 16) | (s - &data->stream[0]), uaesnd_timer);
event2_newevent_xx(-1, s->timer_event_time, (((int)(data - &uaesndboard[0])) << 16) | ((int)(s - &data->stream[0])), uaesnd_timer);
}
}
}

View File

@ -3488,7 +3488,7 @@ static void load_vga_bios(void)
return;
struct zfile *zf = read_device_rom(&currprefs, ROMTYPE_x86_VGA, 0, NULL);
if (zf) {
int size = zfile_fread(romext, 1, 32768, zf);
int size = (int)zfile_fread(romext, 1, 32768, zf);
write_log(_T("X86 VGA BIOS '%s' loaded, %08x %d bytes\n"), zfile_getname(zf), 0xc0000, size);
zfile_fclose(zf);
mem_mapping_add(&bios_mapping[4], 0xc0000, 0x8000, mem_read_romext, mem_read_romextw, mem_read_romextl, mem_write_null, mem_write_nullw, mem_write_nulll, romext, MEM_MAPPING_EXTERNAL | MEM_MAPPING_ROM, 0);

View File

@ -612,7 +612,7 @@ static struct zfile *zfile_gunzip (struct zfile *z, int *retcode)
ret = Z_STREAM_ERROR;
do {
zs.next_in = buffer;
zs.avail_in = zfile_fread (buffer, 1, sizeof (buffer), z);
zs.avail_in = (uInt)zfile_fread (buffer, 1, sizeof (buffer), z);
if (first) {
if (inflateInit2_ (&zs, -MAX_WBITS, ZLIB_VERSION, sizeof (z_stream)) != Z_OK)
break;
@ -1174,7 +1174,7 @@ static struct zfile *xz (struct zfile *z, int *retcode)
int towrite = 0;
bool first = true;
for (;;) {
int read = zfile_fread (in, 1, XZ_IN_SIZE, z);
int read = (int)zfile_fread (in, 1, XZ_IN_SIZE, z);
if (first) {
if (!(in[0] == 0xfd && in[1] == 0x37 && in[2] == 0x7a && in[3] == 0x58 && in[4] == 0x5a && in[5] == 0))
break;
@ -1211,7 +1211,7 @@ static struct zfile *xz (struct zfile *z, int *retcode)
if (srclen == read)
break;
inp += srclen;
read -= srclen;
read -= (int)srclen;
}
}
XzUnpacker_Free (&cx);
@ -2102,11 +2102,13 @@ struct zfile *zfile_fopen_data (const TCHAR *name, uae_u64 size, const uae_u8 *d
return NULL;
}
l = zfile_create (NULL, name);
l->name = my_strdup (name ? name : _T(""));
l->data = xmalloc (uae_u8, (size_t)size);
l->size = size;
l->datasize = size;
memcpy (l->data, data, (size_t)size);
if (l) {
l->name = my_strdup(name ? name : _T(""));
l->data = xmalloc(uae_u8, (size_t)size);
l->size = size;
l->datasize = size;
memcpy(l->data, data, (size_t)size);
}
return l;
}
@ -2115,7 +2117,7 @@ uae_u8 *zfile_get_data_pointer(struct zfile *z, size_t *len)
{
if (!z->data)
return NULL;
*len = z->size;
*len = (size_t)z->size;
return z->data;
}
@ -2242,7 +2244,7 @@ uae_s64 zfile_fseek (struct zfile *z, uae_s64 offset, int mode)
return 1;
}
size_t zfile_fread (void *b, size_t l1, size_t l2, struct zfile *z)
size_t zfile_fread(void *b, size_t l1, size_t l2, struct zfile *z)
{
if (z->zfileread)
return (size_t)z->zfileread(b, l1, l2, z);
@ -2288,7 +2290,7 @@ size_t zfile_fread (void *b, size_t l1, size_t l2, struct zfile *z)
return fread (b, l1, l2, z->f);
}
size_t zfile_fwrite (const void *b, size_t l1, size_t l2, struct zfile *z)
size_t zfile_fwrite(const void *b, size_t l1, size_t l2, struct zfile *z)
{
if (z->archiveparent)
return 0;
@ -2476,7 +2478,7 @@ int zfile_zuncompress (void *dst, int dstsize, struct zfile *src, int srcsize)
if (left > sizeof (inbuf))
left = sizeof (inbuf);
zs.next_in = inbuf;
zs.avail_in = zfile_fread (inbuf, 1, left, src);
zs.avail_in = (uInt)zfile_fread (inbuf, 1, left, src);
incnt += left;
}
v = inflate (&zs, 0);
@ -2495,7 +2497,7 @@ int zfile_zcompress(struct zfile *f, void *src, size_t size)
if (deflateInit_ (&zs, Z_DEFAULT_COMPRESSION, ZLIB_VERSION, sizeof (z_stream)) != Z_OK)
return 0;
zs.next_in = (Bytef*)src;
zs.avail_in = size;
zs.avail_in = (uInt)size;
v = Z_OK;
while (v == Z_OK) {
zs.next_out = outbuf;
@ -3481,9 +3483,9 @@ uae_s64 zfile_fsize_archive (struct zfile *d)
return zfile_size (d);
}
unsigned int zfile_read_archive (struct zfile *d, void *b, unsigned int size)
int zfile_read_archive (struct zfile *d, void *b, unsigned int size)
{
return zfile_fread (b, 1, size, d);
return (int)zfile_fread (b, 1, size, d);
}
void zfile_close_archive (struct zfile *d)