X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fpic16%2Fpcodepeep.c;h=fd009a333d664de123b426407ecb27811cfdb71b;hb=195ee3f3ee25ce2c5f2a59fbd2779c4cb80527c3;hp=ecd6e11d8ee8aaef3eb591b8e18b46297e108987;hpb=38a121fe1ef6d45686ebe7a07e71eadcba5145b9;p=fw%2Fsdcc diff --git a/src/pic16/pcodepeep.c b/src/pic16/pcodepeep.c index ecd6e11d..fd009a33 100644 --- a/src/pic16/pcodepeep.c +++ b/src/pic16/pcodepeep.c @@ -276,7 +276,7 @@ static int cvt_extract_destination(parsedPattern *pp) // just check first letter for now - if(toupper(*pp->pct[0].tok.s) == 'F') + if(toupper((unsigned char)*pp->pct[0].tok.s) == 'F') return 1; } else if (pp->pct[0].tt == PCT_NUMBER) { @@ -307,14 +307,14 @@ static pCodeOp *cvt_extract_status(char *reg, char *bit) if(len == 1) { // check C,Z - if(toupper(*bit) == 'C') + if(toupper((unsigned char)*bit) == 'C') return PCOP(pic16_popCopyGPR2Bit(&pic16_pc_status,PIC_C_BIT)); - if(toupper(*bit) == 'Z') + if(toupper((unsigned char)*bit) == 'Z') return PCOP(pic16_popCopyGPR2Bit(&pic16_pc_status,PIC_Z_BIT)); } // Check DC - if(len ==2 && toupper(bit[0]) == 'D' && toupper(bit[1]) == 'C') + if(len ==2 && toupper((unsigned char)bit[0]) == 'D' && toupper((unsigned char)bit[1]) == 'C') return PCOP(pic16_popCopyGPR2Bit(&pic16_pc_status,PIC_DC_BIT)); return NULL; @@ -962,15 +962,15 @@ static void tokenizeLineNode(char *ln) // fprintf(stderr, "%s:%d: processing %s\n", __FILE__, __LINE__, ln); while(*ln) { - if(isspace(*ln)) { + if(isspace((unsigned char)*ln)) { // add a SPACE token and eat the extra spaces. tokArr[tokIdx++].tt = PCT_SPACE; - while (isspace (*ln)) + while (isspace ((unsigned char)*ln)) ln++; continue; } - if(isdigit(*ln)) { + if(isdigit((unsigned char)*ln)) { tokArr[tokIdx].tt = PCT_NUMBER; tokArr[tokIdx++].tok.n = strtol(ln, &ln, 0); @@ -1003,11 +1003,11 @@ static void tokenizeLineNode(char *ln) default: // hack to allow : goto $ - if(isalpha(*ln) || (*ln == '_') || (!parsing_peeps && (*ln == '$'))) { + if(isalpha((unsigned char)*ln) || (*ln == '_') || (!parsing_peeps && (*ln == '$'))) { char buffer[50]; int i=0; - while( (isalpha(*ln) || isdigit(*ln) || (*ln == '_') || (*ln == '$')) && i<49) + while( (isalpha((unsigned char)*ln) || isdigit((unsigned char)*ln) || (*ln == '_') || (*ln == '$')) && i<49) buffer[i++] = *ln++; ln--; @@ -1739,7 +1739,7 @@ int pic16_pCodeSearchCondition(pCode *pc, unsigned int cond) *-----------------------------------------------------------------*/ static int pCodeOpCompare(pCodeOp *pcops, pCodeOp *pcopd) { - char b[128], *n2; + char b[1024], *n2; if(!pcops || !pcopd) return 0; @@ -1765,8 +1765,8 @@ static int pCodeOpCompare(pCodeOp *pcops, pCodeOp *pcopd) return 0; } - b[0]=0; - pic16_get_op(pcops,b,128); + memset(b, 0, sizeof(b) ); //b[0]=0; + pic16_get_op(pcops,b, sizeof(b) ); n2 = pic16_get_op(pcopd,NULL,0); @@ -2438,16 +2438,16 @@ int pic16_pCodePeepMatchRule(pCode *pc) pcin->prev = pc->prev; -#if 0 +#if 1 { /* DEBUG */ /* Converted the deleted pCodes into comments */ - char buf[256]; + char buf[1024]; pCodeCSource *pc_cline2=NULL; - buf[0] = ';'; - buf[1] = '#'; +// buf[0] = ';'; + buf[0] = '#'; while(pc && pc!=pcin) { @@ -2461,7 +2461,7 @@ int pic16_pCodePeepMatchRule(pCode *pc) } } - pic16_pCode2str(&buf[2], 254, pc); + pic16_pCode2str(&buf[1], sizeof( buf )-1, pc); pic16_pCodeInsertAfter(pcprev, pic16_newpCodeCharP(buf)); pcprev = pcprev->next; pc = pc->next;