c-- cppchecked

git-svn-id: svn://kolibrios.org@7626 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
siemargl 2019-04-11 07:12:30 +00:00
parent 24fde9ea89
commit 01eaae6724
8 changed files with 14 additions and 13 deletions

View File

@ -1152,7 +1152,7 @@ void addr_to_hex(long addr, unsigned char splitup)
{
static char buffer[11];
static char buffer[12]; // fix by cppcheck
WORD32 adr;

View File

@ -915,7 +915,7 @@ nexpardll:
AlignCycle=(unsigned char)1^neg;
if(ptr!=NULL){
aligncycle=getnumber((unsigned char *)ptr);
if(aligncycle<1&&aligncycle>4096)aligncycle=8;
if(aligncycle<1 || aligncycle>4096)aligncycle=8; // fix by cppcheck
}
break;
case c_ws: //dos-stub for windows programs
@ -1664,6 +1664,7 @@ unsigned char typev;
if(am32==FALSE&&((itok.flag&f_far)==0))ssize=2;
else ssize=4;
}
else printf("unexpected condition\n"); // fix by cppcheck
datasize+=initglobalvar(type,ptr->recsize/ssize,ssize,typev);
}
free(input);

View File

@ -33,7 +33,7 @@ int usebracket=FALSE;
if(usebracket){
while(tok==tk_mult){
nexttok();
*pointr++;
(*pointr)++; // fix by cppcheck
}
if(tok!=tk_closebracket)expected(')');
else getoperand(reg);

View File

@ -147,7 +147,7 @@ unsigned short numobj=1;
char *importblock=NULL;
char *relocblock=NULL;
char *exportblock=NULL;
unsigned long psize,vsize=0,sizereloc=0,sizeReloc=0,sizeImport=0,sizeExport=0,
unsigned long psize = 0,vsize=0,sizereloc=0,sizeReloc=0,sizeImport=0,sizeExport=0,
sizebss=0,sizeRes=0;
unsigned long startsec=0,startsecr=0,startsece=0,startsecres=0;
unsigned int posrel=0,sizeimport=0,startimportname=0,sizeexport=0,sizeres=0,

View File

@ -99,7 +99,7 @@ int MultiByteToWideChar(
int cchWideChar // size of buffer
)
{
int i;
int i = 0; // fix by cppcheck
while ((lpMultiByteStr[i*2]!=0) && (lpMultiByteStr[i*2+1]!=0)) i++;
return i/2;
}
@ -147,7 +147,7 @@ int stat (const char* path, struct _stat* buf)
char * getcwd (char *buffer, int size)
{
int len=0;
volatile int len=0; // fix by cppcheck
if (size==0){
if (buffer!=0)
return 0;

View File

@ -675,7 +675,7 @@ void CheckReg(int idx,int base,int *reg1,int *reg2,int razr)
}
if(lreg[*reg1]==0)lreg[*reg1]=1;
else{
for(i=8;i!=0;i--){
for(i=7;i>=0;i--){ // fix by cppcheck, side effect - enable EAX
if(lreg[i]==0){
lreg[i]=1;
*reg1=i;
@ -685,7 +685,7 @@ void CheckReg(int idx,int base,int *reg1,int *reg2,int razr)
}
// printf("\nreg1=%d",*reg1);
if(lreg[*reg2]!=0){
for(i=8;i!=0;i--){
for(i=7;i>=0;i--){ // fix by cppcheck, side effect - enable EAX
if(lreg[i]==0){
*reg2=i;
break;

View File

@ -691,7 +691,7 @@ ITOK posttok;
if(val==0&&rflag==0&&posttok.post==0)next|=8;
switch(next){
case 5: // idx=-1 zoom=-1 Rb+N
if(reg==EAX&&(val>127||val<0xffffff80))goto retfalse;
if(reg==EAX&&(val>127||val<0xffffff80)) { //cppcheck - condition val>127||val<0xffffff80 always true, add diagnostic printf("suspicious instruction compilation\n"); goto retfalse; }
if(val<3||val>0xfffffffd)goto retfalse;
if(base==ESP)goto retfalse;
break;
@ -4154,8 +4154,8 @@ beg1:
break;
case tk_seg:
op66(r16);
op(0x8C); op(0xC0+gstok->number*8); break;
ClearReg(AL);
op(0x8C); op(0xC0+gstok->number*8);
ClearReg(AL); break; // fix by cppcheck
default: bytevalexpected(0); break;
}
}

View File

@ -8183,7 +8183,7 @@ COM_MOD *ocur_mod;
sprintf(itok.name,"%e",itok.dnumber);
break;
case tk_qword:
sprintf(itok.name,"0x%X%08X",itok.lnumber>>16,itok.number);
sprintf(itok.name,"0x%X%08X",itok.lnumber>>16,itok.number);
break;
default:
sprintf(itok.name,"0x%X",itok.number);
@ -9976,7 +9976,7 @@ void unpackteg(structteg *tteg)
int i;
elementteg *bazael;
structteg *newteg;
int ssize,count;
int ssize=4,count; // fix by cppcheck
idrec *newrec,*ptr;
if(alignword){ //âűđîâí˙ňü íŕ ÷ĺňíűé ŕäđĺń
if(am32==0){