Bugfix for linux port

git-svn-id: svn://kolibrios.org@7545 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
tsdima 2018-11-09 18:21:10 +00:00
parent 60e27afe74
commit 490fec6653
4 changed files with 17 additions and 48 deletions

View File

@ -222,45 +222,6 @@ int MakePE();
int MakeObj(); int MakeObj();
void CheckUndefClassProc(); void CheckUndefClassProc();
/*
PAVEL YAKOV
char* strupr(char* s)
{
char* p = s;
while (*p = toupper(*p)) p++;
return s;
}
char* strlwr(char* s)
{
char* p = s;
while (*p = tolower(*p)) p++;
return s;
}
int strnicmp(const char* s1, const char* s2, int len)
{
unsigned char c1,c2;
if(!len)
return 0;
do{
c1 = *s1++;
c2 = *s2++;
if (!c1||!c2)
break;
if (c1 == c2)
continue;
c1 = tolower(c1);
c2 = tolower(c2);
if (c1!=c2)
break;
} while (--len);
return (int)c1 - (int)c2;
}
*/
/* /*
void PrintTegList(structteg *tteg) void PrintTegList(structteg *tteg)
{ {
@ -1175,6 +1136,9 @@ void * MALLOC (unsigned long size)
void *mem; void *mem;
mem=malloc(size); mem=malloc(size);
if(mem==NULL)OutMemory(); if(mem==NULL)OutMemory();
#ifdef _UNIX_
else memset(mem,0,size);
#endif
// if(((unsigned long)mem+size)>maxusedmem)maxusedmem=(unsigned long)mem+size; // if(((unsigned long)mem+size)>maxusedmem)maxusedmem=(unsigned long)mem+size;

View File

@ -92,18 +92,17 @@ int MultiByteToWideChar(unsigned int,unsigned int,char*,int,wchar_t *,int);
#endif #endif
char* strupr(char* s);
char* strlwr(char* s);
int stricmp(const char*, const char*);
int strnicmp(const char*, const char*, int);
#ifdef _PORT_CPP_ #ifdef _PORT_CPP_
long lseek (int, long, int); long lseek (int, long, int);
char tolower(char c); char tolower(char c);
char toupper(char c); char toupper(char c);
char* strupr(char* s);
char* strlwr(char* s);
int stricmp(const char*, const char*);
int strnicmp(const char*, const char*, int);
char * getcwd (char *buffer, int size); char * getcwd (char *buffer, int size);
int stat (const char*, struct _stat*); int stat (const char*, struct _stat*);

View File

@ -9081,7 +9081,7 @@ COM_MOD *bmod;
if(itok.type==tp_opperand)operand=tok; if(itok.type==tp_opperand)operand=tok;
else{ else{
i++; i++;
if(bufrm)free(bufrm); if(bufrm){ free(bufrm); bufrm=NULL; }
if(strinf.bufstr)free(strinf.bufstr); if(strinf.bufstr)free(strinf.bufstr);
switch(operand){ switch(operand){
case tk_div: case tk_div:
@ -9136,7 +9136,7 @@ COM_MOD *bmod;
cha2=ocha; cha2=ocha;
endoffile=0; endoffile=0;
// printf("input=%08X inptr=%08X %s\n",input,inptr2,input+inptr2); // printf("input=%08X inptr=%08X %s\n",input,inptr2,input+inptr2);
// if(bufrm)free(bufrm); // if(bufrm) { free(bufrm); bufrm=NULL; }
// if(strinf.bufstr)free(strinf.bufstr); // if(strinf.bufstr)free(strinf.bufstr);
bufrm=obuf; bufrm=obuf;
strinf=ostr; strinf=ostr;
@ -9746,7 +9746,7 @@ newloop:
else{ else{
if(tok!=tk_number&&tok!=tk_postnumber&&tok!=tk_undefofs){ if(tok!=tk_number&&tok!=tk_postnumber&&tok!=tk_undefofs){
if(j>1)j=0; if(j>1)j=0;
if(bufrm)free(bufrm); if(bufrm){ free(bufrm); bufrm=NULL; }
if(strinf.bufstr)free(strinf.bufstr); if(strinf.bufstr)free(strinf.bufstr);
} }
else if(j>1)j--; else if(j>1)j--;

View File

@ -178,6 +178,9 @@ int hold;
for(int i=0;i<=numfindpath;i++){ for(int i=0;i<=numfindpath;i++){
sprintf((char *)string2,"%s%s",findpath[(firstflag==0?i:numfindpath-i)],filename); sprintf((char *)string2,"%s%s",findpath[(firstflag==0?i:numfindpath-i)],filename);
#ifndef _WIN32_
for(char* p=(char *)string2; *p; ++p) if(*p=='\\') *p='/';
#endif
if((hold=loadinputfile((char *)string2))!=-2)break; if((hold=loadinputfile((char *)string2))!=-2)break;
if(firstflag==2||(firstflag==0&&(i+1)==numfindpath))break; if(firstflag==2||(firstflag==0&&(i+1)==numfindpath))break;
} }
@ -8600,6 +8603,9 @@ long filesize;
stringexpected(); stringexpected();
return(0); return(0);
} }
#ifndef _WIN32_
for(char* p=(char *)string3; *p; ++p) if(*p=='\\') *p='/';
#endif
filehandle=open((char *)string3,O_BINARY|O_RDONLY); filehandle=open((char *)string3,O_BINARY|O_RDONLY);
if(filehandle==-1){ if(filehandle==-1){
unableopenfile((char *)string3); unableopenfile((char *)string3);