From 490fec6653463cd07cab4d3fd54117d09c5e8fea Mon Sep 17 00:00:00 2001 From: tsdima Date: Fri, 9 Nov 2018 18:21:10 +0000 Subject: [PATCH] Bugfix for linux port git-svn-id: svn://kolibrios.org@7545 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/cmm/main.cpp | 42 +++-------------------------------- programs/develop/cmm/port.h | 11 +++++---- programs/develop/cmm/tokb.cpp | 6 ++--- programs/develop/cmm/tokc.cpp | 6 +++++ 4 files changed, 17 insertions(+), 48 deletions(-) diff --git a/programs/develop/cmm/main.cpp b/programs/develop/cmm/main.cpp index c41ee29351..0c0f4f29fc 100644 --- a/programs/develop/cmm/main.cpp +++ b/programs/develop/cmm/main.cpp @@ -222,45 +222,6 @@ int MakePE(); int MakeObj(); 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) { @@ -1175,6 +1136,9 @@ void * MALLOC (unsigned long size) void *mem; mem=malloc(size); if(mem==NULL)OutMemory(); +#ifdef _UNIX_ + else memset(mem,0,size); +#endif // if(((unsigned long)mem+size)>maxusedmem)maxusedmem=(unsigned long)mem+size; diff --git a/programs/develop/cmm/port.h b/programs/develop/cmm/port.h index 328787a03a..c260e724ef 100644 --- a/programs/develop/cmm/port.h +++ b/programs/develop/cmm/port.h @@ -92,18 +92,17 @@ int MultiByteToWideChar(unsigned int,unsigned int,char*,int,wchar_t *,int); #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_ long lseek (int, long, int); char tolower(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); int stat (const char*, struct _stat*); diff --git a/programs/develop/cmm/tokb.cpp b/programs/develop/cmm/tokb.cpp index b15ec75ebe..9eadb3ecd8 100644 --- a/programs/develop/cmm/tokb.cpp +++ b/programs/develop/cmm/tokb.cpp @@ -9081,7 +9081,7 @@ COM_MOD *bmod; if(itok.type==tp_opperand)operand=tok; else{ i++; - if(bufrm)free(bufrm); + if(bufrm){ free(bufrm); bufrm=NULL; } if(strinf.bufstr)free(strinf.bufstr); switch(operand){ case tk_div: @@ -9136,7 +9136,7 @@ COM_MOD *bmod; cha2=ocha; endoffile=0; // 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); bufrm=obuf; strinf=ostr; @@ -9746,7 +9746,7 @@ newloop: else{ if(tok!=tk_number&&tok!=tk_postnumber&&tok!=tk_undefofs){ if(j>1)j=0; - if(bufrm)free(bufrm); + if(bufrm){ free(bufrm); bufrm=NULL; } if(strinf.bufstr)free(strinf.bufstr); } else if(j>1)j--; diff --git a/programs/develop/cmm/tokc.cpp b/programs/develop/cmm/tokc.cpp index 87f3327e76..18c79f9b08 100644 --- a/programs/develop/cmm/tokc.cpp +++ b/programs/develop/cmm/tokc.cpp @@ -178,6 +178,9 @@ int hold; for(int i=0;i<=numfindpath;i++){ 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(firstflag==2||(firstflag==0&&(i+1)==numfindpath))break; } @@ -8600,6 +8603,9 @@ long filesize; stringexpected(); return(0); } +#ifndef _WIN32_ + for(char* p=(char *)string3; *p; ++p) if(*p=='\\') *p='/'; +#endif filehandle=open((char *)string3,O_BINARY|O_RDONLY); if(filehandle==-1){ unableopenfile((char *)string3);