Warning fixes.

This commit is contained in:
Toni Wilen 2022-04-29 21:17:21 +03:00
parent 852145db72
commit 189c83566c
13 changed files with 48 additions and 40 deletions

View File

@ -53,7 +53,7 @@ bool astring::ensure_room(int length)
// swap in the new buffer and free the old one
char *oldbuf = (m_text == m_smallbuf) ? NULL : m_text;
m_text = strcpy(newbuf, m_text);
m_len = strlen(m_text);
m_len = uaestrlen(m_text);
m_alloclen = alloclen;
delete[] oldbuf;

View File

@ -152,7 +152,7 @@ putbits(n, x) /* Write rightmost n bits of x */
int
fread_crc(unsigned char *p, int n, struct zfile *fp)
{
n = zfile_fread(p, 1, n, fp);
n = (int)zfile_fread(p, 1, n, fp);
calccrc(p, n);
return n;

View File

@ -18,7 +18,7 @@ static char *get_ptr;
/* ------------------------------------------------------------------------ */
int calc_sum(char *p, int len)
{
register int sum;
int sum;
for (sum = 0; len; len--)
sum += *p++;
@ -67,7 +67,7 @@ static void put_longword(long v)
/* ------------------------------------------------------------------------ */
static void msdos_to_unix_filename(char *name, int len)
{
register int i;
int i;
#ifdef MULTIBYTE_CHAR
for (i = 0; i < len; i++) {
@ -92,7 +92,7 @@ static void msdos_to_unix_filename(char *name, int len)
/* ------------------------------------------------------------------------ */
static void generic_to_unix_filename(char *name, int len)
{
register int i;
int i;
boolean lower_case_used = FALSE;
#ifdef MULTIBYTE_CHAR
@ -133,7 +133,7 @@ static void generic_to_unix_filename(char *name, int len)
static void
macos_to_unix_filename(char *name, int len)
{
register int i;
int i;
for (i = 0; i < len; i++) {
if (name[i] == ':')
@ -147,7 +147,7 @@ macos_to_unix_filename(char *name, int len)
static void
unix_to_generic_filename(char *name, int len)
{
register int i;
int i;
for (i = 0; i < len; i++) {
if (name[i] == '/')
@ -539,7 +539,7 @@ boolean get_header(struct zfile *fp, LzHeader *hdr)
hdr->extend_type == EXTEND_HUMAN ||
hdr->extend_type == EXTEND_AMIGAOS ||
hdr->extend_type == EXTEND_GENERIC)
hdr->attribute = get_word ();
hdr->attribute = (unsigned char)get_word ();
break;
case 0x50:
/*
@ -585,8 +585,8 @@ boolean get_header(struct zfile *fp, LzHeader *hdr)
}
}
if (hdr->header_level != 2 && get_ptr - ptr != 2) {
hdr->packed_size -= get_ptr - ptr - 2;
hdr->header_size += get_ptr - ptr - 2;
hdr->packed_size -= (long)(get_ptr - ptr - 2);
hdr->header_size += (unsigned char)(get_ptr - ptr - 2);
}
}
@ -654,7 +654,7 @@ void init_header(char *name, struct stat *v_stat, LzHeader *hdr)
hdr->attribute = GENERIC_ATTRIBUTE;
hdr->header_level = header_level;
strcpy(hdr->name, name);
len = strlen(name);
len = uaestrlen(name);
hdr->crc = 0x0000;
hdr->extend_type = EXTEND_UNIX;
hdr->unix_last_modified_stamp = v_stat->st_mtime;

View File

@ -317,9 +317,9 @@ static void read_pt_len(short nn, short nbit, short i_special)
{
int i, c, n;
n = getbits(nbit);
n = getbits((unsigned char)nbit);
if (n == 0) {
c = getbits(nbit);
c = getbits((unsigned char)nbit);
for (i = 0; i < nn; i++)
pt_len[i] = 0;
for (i = 0; i < 256; i++)

View File

@ -113,7 +113,7 @@ static void read_tree_p(void)
i = 0;
while (i < NP) {
pt_len[i] = getbits(LENFIELD);
pt_len[i] = (unsigned char)getbits(LENFIELD);
if (++i == 3 && pt_len[0] == 1 && pt_len[1] == 1 && pt_len[2] == 1) {
#ifdef SUPPORT_LH7
c = getbits(MAX_DICBIT - 7);

View File

@ -84,7 +84,7 @@ struct zfile *archive_access_lha (struct znode *zn)
lhinterface.dicbit = 13; /* method + 8; -lh5- */
lhinterface.infile = zf;
lhinterface.outfile = out;
lhinterface.original = zn->size;
lhinterface.original = (unsigned long)zn->size;
lhinterface.packed = zn->packedsize;
switch (zn->method) {

View File

@ -493,13 +493,13 @@ static int read_literal_table(struct lzxdata *d)
}
symbol = table_four[d->literal_len[pos] + 17 - symbol];
while((pos < max_symbol) && (count--))
d->literal_len[pos++] = symbol;
d->literal_len[pos++] = (unsigned char)symbol;
break;
}
default:
{
symbol = table_four[d->literal_len[pos] + 17 - symbol];
d->literal_len[pos++] = symbol;
d->literal_len[pos++] = (unsigned char)symbol;
break;
}
}
@ -576,7 +576,7 @@ static void decrunch(struct lzxdata *d)
}
if(symbol < 256)
{
*d->destination++ = symbol;
*d->destination++ = (unsigned char)symbol;
}
else
{
@ -656,12 +656,12 @@ struct zfile *archive_access_lzx (struct znode *zn)
if (!zt || zt->offset != 0)
break;
znfirst = zt;
unpsize += znfirst->size;
unpsize += (unsigned int)znfirst->size;
}
/* find last file in compressed block */
znlast = zn;
while (znlast) {
unpsize += znlast->size;
unpsize += (unsigned int)znlast->size;
if (znlast->offset != 0)
break;
znlast = znlast->next;
@ -765,7 +765,7 @@ struct zvolume *archive_directory_lzx (struct zfile *in_file)
do
{
abort = 1; /* assume an error */
actual = zfile_fread(archive_header, 1, 31, in_file);
actual = (int)zfile_fread(archive_header, 1, 31, in_file);
if(!zfile_ferror(in_file))
{
if(actual) /* 0 is normal and means EOF */
@ -780,7 +780,7 @@ struct zvolume *archive_directory_lzx (struct zfile *in_file)
archive_header[26] = 0;
crc_calc(&d, archive_header, 31);
temp = archive_header[30]; /* filename length */
actual = zfile_fread(header_filename, 1, temp, in_file);
actual = (int)zfile_fread(header_filename, 1, temp, in_file);
if(!zfile_ferror(in_file))
{
if(actual == temp)
@ -788,7 +788,7 @@ struct zvolume *archive_directory_lzx (struct zfile *in_file)
header_filename[temp] = 0;
crc_calc(&d, (unsigned char*)header_filename, temp);
temp = archive_header[14]; /* comment length */
actual = zfile_fread(header_comment, 1, temp, in_file);
actual = (int)zfile_fread(header_comment, 1, temp, in_file);
if(!zfile_ferror(in_file))
{
if(actual == temp)

View File

@ -283,7 +283,7 @@ static const struct quantizer_spec* FASTCALL read_allocation(int sb, int b2_tabl
static void FASTCALL read_samples(const struct quantizer_spec *q, int scalefactor, int *sample) {
int idx, adj, scale;
register int val;
int val;
if (!q) {
// no bits allocated for this subband
sample[0] = sample[1] = sample[2] = 0;

View File

@ -205,7 +205,7 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
}
ret = 0;
if(FSEEKO_FUNC((FILE *)stream, offset, fseek_origin) != 0)
if(FSEEKO_FUNC((FILE *)stream, (long)offset, fseek_origin) != 0)
ret = -1;
return ret;

View File

@ -138,7 +138,7 @@ typedef struct
local int unzlocal_getByte(struct zfile *fin,int *pi)
{
unsigned char c;
int err = zfile_fread(&c, 1, 1, fin);
int err = (int)zfile_fread(&c, 1, 1, fin);
if (err==1)
{
*pi = (int)c;

View File

@ -58,16 +58,19 @@ static void generate_func(void)
printf("uae_u32 dstd=0;\n");
printf("uaecptr dstp = 0;\n");
printf("for (j = 0; j < b->vblitsize; j++) {\n");
printf("\tfor (i = 0; i < b->hblitsize; i++) {\n\t\tuae_u32 bltadat, srca;\n\n");
if (c_is_on) printf("\t\tif (ptc) { srcc = chipmem_wget_indirect (ptc); ptc += 2; }\n");
if (b_is_on) printf("\t\tif (ptb) {\n\t\t\tuae_u32 bltbdat = b->bltbdat = chipmem_wget_indirect (ptb); ptb += 2;\n");
printf("\tfor (i = 0; i < b->hblitsize; i++) {\n");
if (a_is_on) {
printf("\t\tuae_u32 bltadat, srca;\n");
}
if (c_is_on) printf("\t\tif (ptc) { srcc = chipmem_wget_indirect(ptc); ptc += 2; }\n");
if (b_is_on) printf("\t\tif (ptb) {\n\t\t\tuae_u32 bltbdat = b->bltbdat = chipmem_wget_indirect(ptb); ptb += 2;\n");
if (b_is_on) printf("\t\t\tsrcb = (((uae_u32)b->bltbold << 16) | bltbdat) >> bshift;\n");
if (b_is_on) printf("\t\t\tb->bltbold = bltbdat;\n\t\t}\n");
if (a_is_on) printf("\t\tif (pta) { bltadat = b->bltadat = chipmem_wget_indirect (pta); pta += 2; } else { bltadat = b->bltadat; }\n");
if (a_is_on) printf("\t\tif (pta) { bltadat = b->bltadat = chipmem_wget_indirect(pta); pta += 2; } else { bltadat = b->bltadat; }\n");
if (a_is_on) printf("\t\tbltadat &= blit_masktable[i];\n");
if (a_is_on) printf("\t\tsrca = (((uae_u32)b->bltaold << 16) | bltadat) >> ashift;\n");
if (a_is_on) printf("\t\tb->bltaold = bltadat;\n");
printf("\t\tif (dstp) chipmem_wput_indirect (dstp, dstd);\n");
printf("\t\tif (dstp) chipmem_wput_indirect(dstp, dstd);\n");
printf("\t\tdstd = (%s) & 0xFFFF;\n", blitops[blttbl[i]].s);
printf("\t\ttotald |= dstd;\n");
printf("\t\tif (ptd) { dstp = ptd; ptd += 2; }\n");
@ -79,7 +82,7 @@ static void generate_func(void)
printf("}\n");
if (b_is_on) printf("b->bltbhold = srcb;\n");
if (c_is_on) printf("b->bltcdat = srcc;\n");
printf("\t\tif (dstp) chipmem_wput_indirect (dstp, dstd);\n");
printf("\t\tif (dstp) chipmem_wput_indirect(dstp, dstd);\n");
printf("if (totald != 0) b->blitzero = 0;\n");
printf("}\n");
@ -94,16 +97,19 @@ static void generate_func(void)
printf("uae_u32 dstd = 0;\n");
printf("uaecptr dstp = 0;\n");
printf("for (j = 0; j < b->vblitsize; j++) {\n");
printf("\tfor (i = 0; i < b->hblitsize; i++) {\n\t\tuae_u32 bltadat, srca;\n");
if (c_is_on) printf("\t\tif (ptc) { srcc = chipmem_wget_indirect (ptc); ptc -= 2; }\n");
if (b_is_on) printf("\t\tif (ptb) {\n\t\t\tuae_u32 bltbdat = b->bltbdat = chipmem_wget_indirect (ptb); ptb -= 2;\n");
printf("\tfor (i = 0; i < b->hblitsize; i++) {\n");
if (a_is_on) {
printf("\t\tuae_u32 bltadat, srca;\n");
}
if (c_is_on) printf("\t\tif (ptc) { srcc = chipmem_wget_indirect(ptc); ptc -= 2; }\n");
if (b_is_on) printf("\t\tif (ptb) {\n\t\t\tuae_u32 bltbdat = b->bltbdat = chipmem_wget_indirect(ptb); ptb -= 2;\n");
if (b_is_on) printf("\t\t\tsrcb = ((bltbdat << 16) | b->bltbold) >> bshift;\n");
if (b_is_on) printf("\t\t\tb->bltbold = bltbdat;\n\t\t}\n");
if (a_is_on) printf("\t\tif (pta) { bltadat = b->bltadat = chipmem_wget_indirect (pta); pta -= 2; } else { bltadat = b->bltadat; }\n");
if (a_is_on) printf("\t\tif (pta) { bltadat = b->bltadat = chipmem_wget_indirect(pta); pta -= 2; } else { bltadat = b->bltadat; }\n");
if (a_is_on) printf("\t\tbltadat &= blit_masktable[i];\n");
if (a_is_on) printf("\t\tsrca = (((uae_u32)bltadat << 16) | b->bltaold) >> ashift;\n");
if (a_is_on) printf("\t\tb->bltaold = bltadat;\n");
printf("\t\tif (dstp) chipmem_wput_indirect (dstp, dstd);\n");
printf("\t\tif (dstp) chipmem_wput_indirect(dstp, dstd);\n");
printf("\t\tdstd = (%s) & 0xFFFF;\n", blitops[blttbl[i]].s);
printf("\t\ttotald |= dstd;\n");
printf("\t\tif (ptd) { dstp = ptd; ptd -= 2; }\n");
@ -115,7 +121,7 @@ static void generate_func(void)
printf("}\n");
if (b_is_on) printf("b->bltbhold = srcb;\n");
if (c_is_on) printf("b->bltcdat = srcc;\n");
printf("\t\tif (dstp) chipmem_wput_indirect (dstp, dstd);\n");
printf("\t\tif (dstp) chipmem_wput_indirect(dstp, dstd);\n");
printf("if (totald != 0) b->blitzero = 0;\n");
printf("}\n");
}

View File

@ -25,7 +25,9 @@ extern void activate_debugger(void);
typedef unsigned long offs_t;
#define FALSE 0
#ifndef TRUE
#define TRUE 1
#endif
#define TIMER_CALLBACK_MEMBER(x) int x(void *p, int param, int param2)
extern void standard_irq_callback(int);

View File

@ -91,7 +91,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;
@ -102,7 +102,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 void moduleripper_filename(const char *aname, TCHAR *out, bool fullpath)