Signed comparison warning fixes.

This commit is contained in:
Fyren
2015-03-06 08:08:41 +00:00
parent 782eee3c58
commit d3da389f9f
16 changed files with 44 additions and 39 deletions
-1
View File
@@ -53,7 +53,6 @@ compiler.sourcedeps += packed_includes
if compiler.cc.behavior == 'gcc':
compiler.cflags += ['-Wno-format']
compiler.cflags += ['-Wno-error=sign-compare']
compiler.c_only_flags += ['-std=c99']
if builder.target_platform == 'linux':
compiler.postlink += ['-lm']
+6 -6
View File
@@ -565,12 +565,12 @@ typedef enum s_optmark {
#define suSLEEP_INSTR 0x01 /* the "sleep" instruction was used */
#define FIXEDTAG 0x40000000Lu
#define FUNCTAG 0x20000000Lu
#define OBJECTTAG 0x10000000Lu
#define ENUMTAG 0x08000000Lu
#define METHODMAPTAG 0x04000000Lu
#define STRUCTTAG 0x02000000Lu
#define FIXEDTAG 0x40000000
#define FUNCTAG 0x20000000
#define OBJECTTAG 0x10000000
#define ENUMTAG 0x08000000
#define METHODMAPTAG 0x04000000
#define STRUCTTAG 0x02000000
#define TAGTYPEMASK (FUNCTAG | OBJECTTAG | ENUMTAG | METHODMAPTAG | STRUCTTAG)
#define TAGFLAGMASK (FIXEDTAG | TAGTYPEMASK)
#define TAGID(tag) ((tag) & ~(TAGFLAGMASK))
+11 -9
View File
@@ -150,7 +150,7 @@ int plungequalifiedfile(char *name)
void *fp;
char *ext;
int ext_idx;
size_t ext_idx;
ext_idx=0;
do {
@@ -258,7 +258,8 @@ static void doinclude(int silent)
{
char name[_MAX_PATH];
char c;
int i, result;
size_t i;
int result;
while (*lptr<=' ' && *lptr!='\0') /* skip leading whitespace */
lptr++;
@@ -276,7 +277,7 @@ static void doinclude(int silent)
name[i++]=*lptr++;
while (i>0 && name[i-1]<=' ')
i--; /* strip trailing whitespace */
assert(i>=0 && i<sizeof name);
assert(i<sizeof name);
name[i]='\0'; /* zero-terminate the string */
if (*lptr!=c) { /* verify correct string termination */
@@ -1029,7 +1030,7 @@ static int command(void)
if (*lptr=='"') {
lptr=getstring((unsigned char*)name,sizeof name,lptr);
} else {
int i;
size_t i;
for (i=0; i<sizeof name && alphanum(*lptr); i++,lptr++)
name[i]=*lptr;
name[i]='\0';
@@ -1058,7 +1059,7 @@ static int command(void)
} else if (strcmp(str,"rational")==0) {
char name[sNAMEMAX+1];
cell digits=0;
int i;
size_t i;
/* first gather all information, start with the tag name */
while (*lptr<=' ' && *lptr!='\0')
lptr++;
@@ -1078,9 +1079,9 @@ static int command(void)
lptr++;
} /* if */
/* add the tag (make it public) and check the values */
i=pc_addtag(name);
if (sc_rationaltag==0 || (sc_rationaltag==i && rational_digits==(int)digits)) {
sc_rationaltag=i;
int tag=pc_addtag(name);
if (sc_rationaltag==0 || (sc_rationaltag==tag && rational_digits==(int)digits)) {
sc_rationaltag=tag;
rational_digits=(int)digits;
} else {
error(69); /* rational number format already set, can only be set once */
@@ -1107,7 +1108,8 @@ static int command(void)
sc_alignnext=TRUE;
} else if (strcmp(str,"unused")==0) {
char name[sNAMEMAX+1];
int i,comma;
size_t i;
int comma;
symbol *sym;
do {
/* get the name */
+2 -1
View File
@@ -128,7 +128,8 @@ int check_userop(void (*oper)(void),int tag1,int tag2,int numparam,
static void (*unopers[])(void) = { lneg, neg, user_inc, user_dec };
char opername[4] = "", symbolname[sNAMEMAX+1];
int i,swapparams,savepri,savealt;
size_t i;
int swapparams,savepri,savealt;
int paramspassed;
symbol *sym;
+2 -1
View File
@@ -365,7 +365,8 @@ void alignframe(int numbytes)
{
#if !defined NDEBUG
/* "numbytes" should be a power of 2 for this code to work */
int i,count=0;
size_t i;
int count=0;
for (i=0; i<sizeof numbytes*8; i++)
if (numbytes & (1 << i))
count++;
+1 -1
View File
@@ -21,7 +21,7 @@
* Version: $Id$
*/
int strexpand(char *dest, unsigned char *source, int maxlen, unsigned char pairtable[128][2]);
size_t strexpand(char *dest, unsigned char *source, size_t maxlen, unsigned char pairtable[128][2]);
#ifndef SCPACK
# define SCPACK
+1 -1
View File
@@ -49,7 +49,7 @@
#pragma warning(pop)
#endif
#define NUM_WARNINGS (sizeof warnmsg / sizeof warnmsg[0])
#define NUM_WARNINGS (int)(sizeof warnmsg / sizeof warnmsg[0])
static unsigned char warndisable[(NUM_WARNINGS + 7) / 8]; /* 8 flags in a char */
static int errflag;
+1 -1
View File
@@ -598,7 +598,7 @@ class VerifyOpcodeSorting
public:
VerifyOpcodeSorting() {
assert(opcodelist[1].name!=NULL);
for (int i = 2; i<(sizeof opcodelist / sizeof opcodelist[0]); i++) {
for (size_t i = 2; i<(sizeof opcodelist / sizeof opcodelist[0]); i++) {
assert(opcodelist[i].name!=NULL);
assert(stricmp(opcodelist[i].name,opcodelist[i-1].name)>0);
} /* for */
+1 -1
View File
@@ -22,7 +22,7 @@
* Version: $Id$
*/
int strexpand(char *dest, unsigned char *source, int maxlen, unsigned char pairtable[128][2]);
size_t strexpand(char *dest, unsigned char *source, size_t maxlen, unsigned char pairtable[128][2]);
#define SCPACK_TERMINATOR , /* end each section with a comma */
+3 -3
View File
@@ -400,7 +400,7 @@ static SEQUENCE *sequences;
int phopt_init(void)
{
int number, i, len;
size_t number, i, len;
char str[160];
/* count number of sequences */
@@ -422,13 +422,13 @@ int phopt_init(void)
for (i=0; i<number-1; i++) {
len = strexpand(str,(unsigned char*)sequences_cmp[i].find,sizeof str,SCPACK_TABLE);
assert(len<=sizeof str);
assert(len==(int)strlen(str)+1);
assert(len==strlen(str)+1);
sequences[i].find=(char*)malloc(len);
if (sequences[i].find!=NULL)
strcpy(sequences[i].find,str);
len = strexpand(str,(unsigned char*)sequences_cmp[i].replace,sizeof str,SCPACK_TABLE);
assert(len<=sizeof str);
assert(len==(int)strlen(str)+1);
assert(len==strlen(str)+1);
sequences[i].replace=(char*)malloc(len);
if (sequences[i].replace!=NULL)
strcpy(sequences[i].replace,str);
+2 -2
View File
@@ -16,11 +16,11 @@
#define STACKSIZE 16
int strexpand(char *dest, unsigned char *source, int maxlen, unsigned char pairtable[128][2])
size_t strexpand(char *dest, unsigned char *source, size_t maxlen, unsigned char pairtable[128][2])
{
unsigned char stack[STACKSIZE];
short c, top = 0;
int len;
size_t len;
assert(maxlen > 0);
len = 1; /* already 1 byte for '\0' */
+1 -1
View File
@@ -359,7 +359,7 @@ int delete_subst(char *name,int length)
void delete_substtable(void)
{
int i;
size_t i;
delete_stringpairtable(&substpair);
for (i=0; i<sizeof substindex/sizeof substindex[0]; i++)
substindex[i]=NULL;