diff options
| author | fusion32 <marcopuzziello@gmail.com> | 2025-05-25 22:37:57 -0300 |
|---|---|---|
| committer | fusion32 <marcopuzziello@gmail.com> | 2025-05-25 22:37:57 -0300 |
| commit | ad8213f35523cbb07f418ae275af448a47cc0288 (patch) | |
| tree | 4d77b8ff2b44461734b5a2cbaad5402b4a94736f /src/util.cc | |
| parent | 5f883a80175a4cc9abda9d647a6a0d73bda84878 (diff) | |
| download | game-ad8213f35523cbb07f418ae275af448a47cc0288.tar.gz game-ad8213f35523cbb07f418ae275af448a47cc0288.zip | |
linux Makefile + fix most compilation problems
I wanted to see if the compiler had any problems with the code
so far and added a few stub definitions so that each file would
properly compile. We still fail when linking but we're able to to
find and fix compile time errors.
Diffstat (limited to 'src/util.cc')
| -rw-r--r-- | src/util.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/util.cc b/src/util.cc index 017e98b..418fb98 100644 --- a/src/util.cc +++ b/src/util.cc @@ -11,7 +11,7 @@ void SetPrintFunction(TPrintFunction *Function){ PrintFunction = Function; } -void error(char *Text, ...){ +void error(const char *Text, ...){ char s[1024]; va_list ap; @@ -26,7 +26,7 @@ void error(char *Text, ...){ } } -void print(int Level, char *Text, ...){ +void print(int Level, const char *Text, ...){ char s[1024]; va_list ap; @@ -109,8 +109,8 @@ char *strUpper(char *s){ return s; } -int stricmp(const char *s1, const char *s2, int Pos){ - for(int i = 0; i < Pos; i += 1){ +int stricmp(const char *s1, const char *s2, int Max /*= INT_MAX*/){ + for(int i = 0; i < Max; i += 1){ int c1 = toLower(s1[i]); int c2 = toLower(s2[i]); if(c1 > c2){ @@ -120,10 +120,11 @@ int stricmp(const char *s1, const char *s2, int Pos){ }else{ ASSERT(c1 == c2); if(c1 == 0){ - return 0; + break; } } } + return 0; } char *findFirst(char *s, char c){ @@ -179,7 +180,7 @@ void TReadStream::readString(char *Buffer, int MaxLength){ if(Length > 0){ if(MaxLength < 0 || MaxLength > Length){ - this->readBytes(Buffer, Length); + this->readBytes((uint8*)Buffer, Length); Buffer[Length] = 0; }else{ this->readBytes((uint8*)Buffer, MaxLength - 1); @@ -375,7 +376,7 @@ void TWriteBuffer::writeQuad(uint32 Quad){ this->Position += 4; } -void TWriteBuffer::writeBytes(uint8 *Buffer, int Count){ +void TWriteBuffer::writeBytes(const uint8 *Buffer, int Count){ if((this->Size - this->Position) < Count){ throw "buffer full"; } @@ -436,7 +437,7 @@ void TDynamicWriteBuffer::writeQuad(uint32 Quad){ this->Position += 4; } -void TDynamicWriteBuffer::writeBytes(uint8 *Buffer, int Count){ +void TDynamicWriteBuffer::writeBytes(const uint8 *Buffer, int Count){ while((this->Size - this->Position) < Count){ this->resizeBuffer(); } |
