diff --git a/source/compiler/memfile.c b/source/compiler/memfile.c
index e67884f..4b57615 100644
--- a/source/compiler/memfile.c
+++ b/source/compiler/memfile.c
@@ -76,7 +76,7 @@ size_t memfile_read(memfile_t *mf, void *buffer, size_t maxsize)
memcpy(buffer, mf->base + mf->offs, maxsize);
- mf->offs += maxsize;
+ mf->offs += (long)maxsize;
return maxsize;
}
@@ -98,7 +98,7 @@ int memfile_write(memfile_t *mf, const void *buffer, size_t size)
mf->size = newsize;
}
memcpy(mf->base + mf->offs, buffer, size);
- mf->offs += size;
+ mf->offs += (long)size;
if (mf->offs > mf->usedoffs)
{
diff --git a/source/compiler/sc1.c b/source/compiler/sc1.c
index 97f1fd6..d3fa3fd 100644
--- a/source/compiler/sc1.c
+++ b/source/compiler/sc1.c
@@ -1043,7 +1043,7 @@ static void parseoptions(int argc,char **argv,char *oname,char *ename,char *pnam
#endif
case 'i':
strlcpy(str,option_value(ptr),sizeof str); /* set name of include directory */
- i=strlen(str);
+ i=(int)strlen(str);
if (i>0) {
if (str[i-1]!=DIRSEP_CHAR) {
str[i]=DIRSEP_CHAR;
@@ -1316,7 +1316,7 @@ static void setconfig(char *root)
*(ptr+1)='\0';
base=ptr;
strcat(path,"include");
- len=strlen(path);
+ len=(int)strlen(path);
path[len]=DIRSEP_CHAR;
path[len+1]='\0';
/* see if it exists */
@@ -1329,7 +1329,7 @@ static void setconfig(char *root)
if ((ptr=strrchr(path,DIRSEP_CHAR))!=NULL) {
*(ptr+1)='\0';
strcat(path,"include");
- len=strlen(path);
+ len=(int)strlen(path);
path[len]=DIRSEP_CHAR;
path[len+1]='\0';
} else {
@@ -4008,9 +4008,9 @@ static int find_xmltag(char *source,char *xmltag,char *xmlparam,char *xmlvalue,
/* both NULL or both non-NULL */
assert(xmlvalue!=NULL && xmlparam!=NULL || xmlvalue==NULL && xmlparam==NULL);
- xmltag_len=strlen(xmltag);
- xmlparam_len= (xmlparam!=NULL) ? strlen(xmlparam) : 0;
- xmlvalue_len= (xmlvalue!=NULL) ? strlen(xmlvalue) : 0;
+ xmltag_len=(int)strlen(xmltag);
+ xmlparam_len= (xmlparam!=NULL) ? (int)strlen(xmlparam) : 0;
+ xmlvalue_len= (xmlvalue!=NULL) ? (int)strlen(xmlvalue) : 0;
ptr=source;
/* find an opening '<' */
while ((ptr=strchr(ptr,'<'))!=NULL) {
@@ -5924,10 +5924,10 @@ static void dostate(void)
listid=-1;
} /* if */
listindex=0;
- length=strlen(name)+70; /* +70 for the fixed part "\n" */
+ length=(int)strlen(name)+70; /* +70 for the fixed part "\n" */
/* see if there are any condition strings to attach */
for (index=0; (str=get_autolist(index))!=NULL; index++)
- length+=strlen(str);
+ length+=(int)strlen(str);
if ((doc=(char*)malloc(length*sizeof(char)))!=NULL) {
do {
sprintf(doc,"=0 && arg<=9);
if (args[arg]!=NULL)
- len+=strlen((char*)args[arg]);
+ len+=(int)strlen((char*)args[arg]);
else
len+=2; /* copy '%' plus digit */
e++; /* skip %, digit is skipped later */
@@ -2699,7 +2699,7 @@ SC_FUNC void delete_symbols(symbol *root,int level,int delete_labels,int delete_
SC_FUNC uint32_t namehash(const char *name)
{
const unsigned char *ptr=(const unsigned char *)name;
- int len=strlen(name);
+ int len=(int)strlen(name);
if (len==0)
return 0L;
assert(len<256);
diff --git a/source/compiler/sc3.c b/source/compiler/sc3.c
index fa2f771..8294cd2 100644
--- a/source/compiler/sc3.c
+++ b/source/compiler/sc3.c
@@ -1310,7 +1310,7 @@ static int hier2(value *lval)
if (sym!=NULL && sym->ident!=iFUNCTN && sym->ident!=iREFFUNC && (sym->usage & uDEFINE)==0)
sym=NULL; /* symbol is not a function, it is in the table, but not "defined" */
val= (sym!=NULL);
- if (!val && find_subst(st,strlen(st))!=NULL)
+ if (!val && find_subst(st,(int)strlen(st))!=NULL)
val=1;
clear_value(lval);
lval->ident=iCONSTEXPR;
diff --git a/source/compiler/sc6.c b/source/compiler/sc6.c
index df6b61a..c5e2b68 100644
--- a/source/compiler/sc6.c
+++ b/source/compiler/sc6.c
@@ -755,7 +755,7 @@ SC_FUNC int assemble(FILE *fout,FILE *fin)
assert(strlen(sym->name)<=sNAMEMAX);
strcpy(alias,sym->name);
} /* if */
- nametablesize+=strlen(alias)+1;
+ nametablesize+=(int)strlen(alias)+1;
} /* if */
} /* for */
assert(numnatives==ntv_funcid);
@@ -767,7 +767,7 @@ SC_FUNC int assemble(FILE *fout,FILE *fin)
if (constptr->value>0) {
assert(strlen(constptr->name)>0);
numlibraries++;
- nametablesize+=strlen(constptr->name)+1;
+ nametablesize+=(int)strlen(constptr->name)+1;
} /* if */
} /* for */
} /* if */
@@ -778,7 +778,7 @@ SC_FUNC int assemble(FILE *fout,FILE *fin)
if ((constptr->value & PUBLICTAG)!=0) {
assert(strlen(constptr->name)>0);
numtags++;
- nametablesize+=strlen(constptr->name)+1;
+ nametablesize+=(int)strlen(constptr->name)+1;
} /* if */
} /* for */
@@ -841,8 +841,8 @@ SC_FUNC int assemble(FILE *fout,FILE *fin)
pc_resetbin(fout,hdr.publics+count*sizeof(AMX_FUNCSTUBNT));
pc_writebin(fout,&func,sizeof func);
pc_resetbin(fout,nameofs);
- pc_writebin(fout,sym->name,strlen(sym->name)+1);
- nameofs+=strlen(sym->name)+1;
+ pc_writebin(fout,sym->name,(int)strlen(sym->name)+1);
+ nameofs+=(int)strlen(sym->name)+1;
count++;
} /* if */
} /* for */
@@ -890,8 +890,8 @@ SC_FUNC int assemble(FILE *fout,FILE *fin)
pc_resetbin(fout,hdr.natives+count*sizeof(AMX_FUNCSTUBNT));
pc_writebin(fout,&func,sizeof func);
pc_resetbin(fout,nameofs);
- pc_writebin(fout,alias,strlen(alias)+1);
- nameofs+=strlen(alias)+1;
+ pc_writebin(fout,alias,(int)strlen(alias)+1);
+ nameofs+=(int)strlen(alias)+1;
count++;
} /* for */
free(nativelist);
@@ -912,8 +912,8 @@ SC_FUNC int assemble(FILE *fout,FILE *fin)
pc_resetbin(fout,hdr.libraries+count*sizeof(AMX_FUNCSTUBNT));
pc_writebin(fout,&func,sizeof func);
pc_resetbin(fout,nameofs);
- pc_writebin(fout,constptr->name,strlen(constptr->name)+1);
- nameofs+=strlen(constptr->name)+1;
+ pc_writebin(fout,constptr->name,(int)strlen(constptr->name)+1);
+ nameofs+=(int)strlen(constptr->name)+1;
count++;
} /* if */
} /* for */
@@ -934,8 +934,8 @@ SC_FUNC int assemble(FILE *fout,FILE *fin)
pc_resetbin(fout,hdr.pubvars+count*sizeof(AMX_FUNCSTUBNT));
pc_writebin(fout,&func,sizeof func);
pc_resetbin(fout,nameofs);
- pc_writebin(fout,sym->name,strlen(sym->name)+1);
- nameofs+=strlen(sym->name)+1;
+ pc_writebin(fout,sym->name,(int)strlen(sym->name)+1);
+ nameofs+=(int)strlen(sym->name)+1;
count++;
} /* if */
} /* for */
@@ -954,8 +954,8 @@ SC_FUNC int assemble(FILE *fout,FILE *fin)
pc_resetbin(fout,hdr.tags+count*sizeof(AMX_FUNCSTUBNT));
pc_writebin(fout,&func,sizeof func);
pc_resetbin(fout,nameofs);
- pc_writebin(fout,constptr->name,strlen(constptr->name)+1);
- nameofs+=strlen(constptr->name)+1;
+ pc_writebin(fout,constptr->name,(int)strlen(constptr->name)+1);
+ nameofs+=(int)strlen(constptr->name)+1;
count++;
} /* if */
} /* for */
@@ -1119,7 +1119,7 @@ static void append_dbginfo(FILE *fout)
if (prevstr!=NULL) {
assert(prevname!=NULL);
dbghdr.files++;
- dbghdr.size+=sizeof(cell)+strlen(prevname)+1;
+ dbghdr.size+=(int)(sizeof(cell)+strlen(prevname)+1);
} /* if */
previdx=codeidx;
} /* if */
@@ -1130,7 +1130,7 @@ static void append_dbginfo(FILE *fout)
if (prevstr!=NULL) {
assert(prevname!=NULL);
dbghdr.files++;
- dbghdr.size+=sizeof(cell)+strlen(prevname)+1;
+ dbghdr.size+=(int)(sizeof(cell)+strlen(prevname)+1);
} /* if */
/* line number table */
@@ -1151,7 +1151,7 @@ static void append_dbginfo(FILE *fout)
dbghdr.symbols++;
name=strchr(str+2,':');
assert(name!=NULL);
- dbghdr.size+=sizeof(AMX_DBG_SYMBOL)+strlen(skipwhitespace(name+1));
+ dbghdr.size+=(int)(sizeof(AMX_DBG_SYMBOL)+strlen(skipwhitespace(name+1)));
if ((prevstr=strchr(name,'['))!=NULL)
while ((prevstr=strchr(prevstr+1,':'))!=NULL)
dbghdr.size+=sizeof(AMX_DBG_SYMDIM);
@@ -1162,21 +1162,21 @@ static void append_dbginfo(FILE *fout)
for (constptr=tagname_tab.next; constptr!=NULL; constptr=constptr->next) {
assert(strlen(constptr->name)>0);
dbghdr.tags++;
- dbghdr.size+=sizeof(AMX_DBG_TAG)+strlen(constptr->name);
+ dbghdr.size+=(int)(sizeof(AMX_DBG_TAG)+strlen(constptr->name));
} /* for */
/* automaton table */
for (constptr=sc_automaton_tab.next; constptr!=NULL; constptr=constptr->next) {
assert(constptr->index==0 && strlen(constptr->name)==0 || strlen(constptr->name)>0);
dbghdr.automatons++;
- dbghdr.size+=sizeof(AMX_DBG_MACHINE)+strlen(constptr->name);
+ dbghdr.size+=(int)(sizeof(AMX_DBG_MACHINE)+strlen(constptr->name));
} /* for */
/* state table */
for (constptr=sc_state_tab.next; constptr!=NULL; constptr=constptr->next) {
assert(strlen(constptr->name)>0);
dbghdr.states++;
- dbghdr.size+=sizeof(AMX_DBG_STATE)+strlen(constptr->name);
+ dbghdr.size+=(int)(sizeof(AMX_DBG_STATE)+strlen(constptr->name));
} /* for */
@@ -1210,7 +1210,7 @@ static void append_dbginfo(FILE *fout)
aligncell(&previdx);
#endif
writeerror |= !pc_writebin(fout,&previdx,sizeof previdx);
- writeerror |= !pc_writebin(fout,prevname,strlen(prevname)+1);
+ writeerror |= !pc_writebin(fout,prevname,(int)strlen(prevname)+1);
} /* if */
previdx=codeidx;
} /* if */
@@ -1224,7 +1224,7 @@ static void append_dbginfo(FILE *fout)
aligncell(&previdx);
#endif
writeerror |= !pc_writebin(fout,&previdx,sizeof previdx);
- writeerror |= !pc_writebin(fout,prevname,strlen(prevname)+1);
+ writeerror |= !pc_writebin(fout,prevname,(int)strlen(prevname)+1);
} /* if */
/* line number table */
@@ -1280,7 +1280,7 @@ static void append_dbginfo(FILE *fout)
align16(&dbgsym.dim);
#endif
writeerror |= !pc_writebin(fout,&dbgsym,offsetof(AMX_DBG_SYMBOL, name));
- writeerror |= !pc_writebin(fout,symname,strlen(symname)+1);
+ writeerror |= !pc_writebin(fout,symname,(int)strlen(symname)+1);
for (dim=0; dimname,strlen(constptr->name)+1);
+ writeerror |= !pc_writebin(fout,constptr->name,(int)strlen(constptr->name)+1);
} /* for */
/* automaton table */
@@ -1313,7 +1313,7 @@ static void append_dbginfo(FILE *fout)
#endif
writeerror |= !pc_writebin(fout,&id1,sizeof id1);
writeerror |= !pc_writebin(fout,&address,sizeof address);
- writeerror |= !pc_writebin(fout,constptr->name,strlen(constptr->name)+1);
+ writeerror |= !pc_writebin(fout,constptr->name,(int)strlen(constptr->name)+1);
} /* for */
/* state table */
@@ -1328,7 +1328,7 @@ static void append_dbginfo(FILE *fout)
#endif
writeerror |= !pc_writebin(fout,&id1,sizeof id1);
writeerror |= !pc_writebin(fout,&id2,sizeof id2);
- writeerror |= !pc_writebin(fout,constptr->name,strlen(constptr->name)+1);
+ writeerror |= !pc_writebin(fout,constptr->name,(int)strlen(constptr->name)+1);
} /* for */
delete_dbgstringtable();
diff --git a/source/compiler/sc7.c b/source/compiler/sc7.c
index e460b45..8978b31 100644
--- a/source/compiler/sc7.c
+++ b/source/compiler/sc7.c
@@ -203,10 +203,10 @@ SC_FUNC void stgwrite(const char *st)
CHECK_STGBUFFER(stgidx);
stgbuf[stgidx++]='\0';
} else {
- len=(stgbuf!=NULL) ? strlen(stgbuf) : 0;
- CHECK_STGBUFFER(len+strlen(st)+1);
+ len=(stgbuf!=NULL) ? (int)strlen(stgbuf) : 0;
+ CHECK_STGBUFFER(len+(int)strlen(st)+1);
strcat(stgbuf,st);
- len=strlen(stgbuf);
+ len=(int)strlen(stgbuf);
if (len>0 && stgbuf[len-1]=='\n') {
filewrite(stgbuf);
stgbuf[0]='\0';
@@ -246,7 +246,7 @@ SC_FUNC void stgout(int index)
/* there is no sense in re-optimizing if the order of the sub-expressions
* did not change; so output directly
*/
- for (idx=0; idx=0 && varsecond)<=sNAMEMAX);
strcpy(target,cur->second);
diff --git a/source/compiler/scmemfil.c b/source/compiler/scmemfil.c
index 4cc667d..69efaad 100644
--- a/source/compiler/scmemfil.c
+++ b/source/compiler/scmemfil.c
@@ -113,7 +113,7 @@ unsigned int mfwrite(MEMFILE *mf,const unsigned char *buffer,unsigned int size)
unsigned int mfread(MEMFILE *mf,unsigned char *buffer,unsigned int size)
{
- return memfile_read(mf, buffer, size);
+ return (unsigned int)memfile_read(mf, buffer, size);
}
char *mfgets(MEMFILE *mf,char *string,unsigned int size)
@@ -159,7 +159,7 @@ int mfputs(MEMFILE *mf,const char *string)
assert(mf!=NULL);
- length=strlen(string);
+ length=(unsigned int)strlen(string);
written=mfwrite(mf,(unsigned char *)string,length);
return written==length;
}