From 11199da210ee7cbd3c8b188f87c2a046a9dc27d5 Mon Sep 17 00:00:00 2001 From: Zeex Date: Sat, 30 Dec 2017 16:12:33 +0600 Subject: [PATCH] Fix compile warnings in pawnc --- source/compiler/sc1.c | 2 +- source/compiler/sc2.c | 16 ++++++++-------- source/compiler/sc3.c | 2 +- source/compiler/sc6.c | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/source/compiler/sc1.c b/source/compiler/sc1.c index c0a6ed8..61a8b77 100644 --- a/source/compiler/sc1.c +++ b/source/compiler/sc1.c @@ -5234,7 +5234,7 @@ static void statement(int *lastindent,int allow_decl) case tEMIT: case t__EMIT: { extern char *sc_tokens[]; - const char *bck_lptr=lptr-strlen(sc_tokens[tok-tFIRST]); + const unsigned char *bck_lptr=lptr-strlen(sc_tokens[tok-tFIRST]); if (matchtoken('{')) { lexpush(); emit_flags |= efBLOCK; diff --git a/source/compiler/sc2.c b/source/compiler/sc2.c index cb12c54..6766ee1 100644 --- a/source/compiler/sc2.c +++ b/source/compiler/sc2.c @@ -554,7 +554,7 @@ static void stripcom(unsigned char *line) } /* if */ } /* if */ if (*line == '\a') { - memmove(line,line+1,strlen(line+1)+1); + memmove(line,line+1,strlen((char *)line+1)+1); } } /* while */ #if !defined SC_LIGHT @@ -1128,7 +1128,7 @@ static int command(void) lptr++; pc_deprecate=(char*)malloc(strlen((char*)lptr)+1); if (pc_deprecate!=NULL) { - strcpy(pc_deprecate,lptr); + strcpy(pc_deprecate,(const char *)lptr); pc_deprecate[strcspn(pc_deprecate,"\r\n")]='\0'; } /* if */ lptr=(unsigned char*)strchr((char*)lptr,'\0'); /* skip to end (ignore "extra characters on line") */ @@ -1509,9 +1509,9 @@ static int command(void) while (*lptr<=' ' && *lptr!='\0') lptr++; if (!SKIPPING) { - char *usermsg=(char*)malloc(strlen(lptr)+1); + char *usermsg=(char*)malloc(strlen((const char *)lptr)+1); if(usermsg!=NULL) { - strcpy(usermsg,lptr); + strcpy(usermsg,(const char *)lptr); usermsg[strcspn(usermsg,"\r\n")]='\0'; error(237,usermsg); /* user warning */ free(usermsg); @@ -1840,12 +1840,12 @@ static void substallpatterns(unsigned char *line,int buffersize) } /* while */ } -static void ppconcat(const char *line) +static void ppconcat(unsigned char *line) { - const char *c,*p,*b; + unsigned char *c,*p,*b; for (c=line; *c!='\0'; ++c) { if (is_startstring(c)) - c=skipstring(c); + c=(unsigned char *)skipstring(c); if (*c=='#' && *(c+1)=='#') { p=c-1; b=c+2; @@ -1853,7 +1853,7 @@ static void ppconcat(const char *line) p--; while (*b==' ') b++; - strcpy((char*)p+1,b); + strcpy((char *)p+1,(char *)b); } /* if */ } /* for */ } diff --git a/source/compiler/sc3.c b/source/compiler/sc3.c index 2216597..3421f46 100644 --- a/source/compiler/sc3.c +++ b/source/compiler/sc3.c @@ -369,7 +369,7 @@ static int skim(int *opstr,void (*testfunc)(int),int dropval,int endval, foundop=nextop(&opidx,opstr); if ((foundop || hits) && (lval->ident==iARRAY || lval->ident==iREFARRAY)) - error(33, lval->sym ? (lval->sym->name ? lval->sym->name : "-unknown") : "-unknown-"); /* array was not indexed in an expression */ + error(33, lval->sym ? lval->sym->name : "-unknown-"); /* array was not indexed in an expression */ if (foundop) { if (!hits) { /* this is the first operator in the list */ diff --git a/source/compiler/sc6.c b/source/compiler/sc6.c index f9a43af..0216f41 100644 --- a/source/compiler/sc6.c +++ b/source/compiler/sc6.c @@ -1074,7 +1074,7 @@ SC_FUNC int assemble(FILE *fout,FILE *fin) instr=skipwhitespace(line); /* ignore empty lines and labels (labels have a special syntax, so these * must be parsed separately) */ - if (*instr=='\0' || (tolower(*instr)=='l') && *(instr+1)=='.') + if (*instr=='\0' || (tolower(*instr)=='l' && *(instr+1)=='.')) continue; /* get to the end of the instruction (make use of the '\n' that fgets() * added at the end of the line; this way we will *always* drop on a