Commit 0b9bc1225a76ebff5835961bdf8ee621845ba649
1 parent
dfdda2ca
suppress some warning of "deprecated conversion from string constant... [-Wwrite-strings]"
Showing
4 changed files
with
23 additions
and
21 deletions
Show diff stats
anubis_dev/include/DebugLog.h
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | #define __DEBUGLOG_H__ |
| 3 | 3 | |
| 4 | 4 | #include <stdio.h> |
| 5 | +#include <string> | |
| 5 | 6 | //if(DebugLog::Db) |
| 6 | 7 | //{ |
| 7 | 8 | // char prompt[32]; |
| ... | ... | @@ -21,13 +22,13 @@ |
| 21 | 22 | |
| 22 | 23 | |
| 23 | 24 | // void LogCriticalError(const char *format, ...); |
| 24 | - void LogError(const char *format, ...); | |
| 25 | + void LogError(std::string format, ...); | |
| 25 | 26 | // void LogWarning(const char *format, ...); |
| 26 | - void LogInfo(const char *format, ...); | |
| 27 | + void LogInfo( std::string format, ...); | |
| 27 | 28 | // void LogDebug(const char *format, ...); |
| 28 | 29 | // void LogTrace(const char *format, ...); |
| 29 | 30 | |
| 30 | - void Log(FILE *, char *format); | |
| 31 | + void Log(FILE *, std::string format); | |
| 31 | 32 | |
| 32 | 33 | #endif |
| 33 | 34 | ... | ... |
anubis_dev/share/DebugLog.cpp
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | |
| 9 | 9 | #include <stdarg.h> |
| 10 | 10 | #include <stdio.h> |
| 11 | -#include <string.h> | |
| 11 | +#include <string> | |
| 12 | 12 | #include <stdlib.h> |
| 13 | 13 | #include "DebugLog.h" |
| 14 | 14 | #include <time.h> |
| ... | ... | @@ -19,16 +19,16 @@ |
| 19 | 19 | |
| 20 | 20 | |
| 21 | 21 | |
| 22 | -void LogInfo(const char *format, ...) | |
| 22 | +void LogInfo(std::string format, ...) | |
| 23 | 23 | { |
| 24 | 24 | char buf[32768]; |
| 25 | 25 | va_list ap; |
| 26 | 26 | va_start (ap, format); |
| 27 | 27 | |
| 28 | 28 | #ifdef WIN32 |
| 29 | - int ret = _vsnprintf(buf, 32768, format, ap); | |
| 29 | + int ret = _vsnprintf(buf, 32768, format.c_str(), ap); | |
| 30 | 30 | #else |
| 31 | - int ret = vsnprintf(buf, 32768, format, ap); | |
| 31 | + int ret = vsnprintf(buf, 32768, format.c_str(), ap); | |
| 32 | 32 | #endif |
| 33 | 33 | |
| 34 | 34 | if (ret < 0) |
| ... | ... | @@ -39,16 +39,16 @@ void LogInfo(const char *format, ...) |
| 39 | 39 | Log(stdout, buf); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | -void LogError(const char *format, ...) | |
| 42 | +void LogError(std::string format, ...) | |
| 43 | 43 | { |
| 44 | 44 | char buf[32768]; |
| 45 | 45 | va_list ap; |
| 46 | 46 | va_start (ap, format); |
| 47 | 47 | |
| 48 | 48 | #ifdef WIN32 |
| 49 | - int ret = _vsnprintf(buf, 32768, format, ap); | |
| 49 | + int ret = _vsnprintf(buf, 32768, format.c_str(), ap); | |
| 50 | 50 | #else |
| 51 | - int ret = vsnprintf(buf, 32768, format, ap); | |
| 51 | + int ret = vsnprintf(buf, 32768, format.c_str(), ap); | |
| 52 | 52 | #endif |
| 53 | 53 | |
| 54 | 54 | if (ret < 0) |
| ... | ... | @@ -59,11 +59,11 @@ void LogError(const char *format, ...) |
| 59 | 59 | Log(stderr, buf); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | -void Log(FILE * output, char *logString) | |
| 62 | +void Log(FILE * output, std::string logString) | |
| 63 | 63 | { |
| 64 | 64 | //Ecris sur la console fenetre |
| 65 | 65 | #if defined (__BEOS__) || (_LINUX_) || (WIN32) |
| 66 | - fprintf(output, "%s", logString); | |
| 66 | + fprintf(output, "%s", logString.c_str()); | |
| 67 | 67 | //if(output == stderr) |
| 68 | 68 | fflush(output); |
| 69 | 69 | #endif | ... | ... |
anubis_dev/share/FileIO.cpp
| ... | ... | @@ -138,8 +138,8 @@ String GetProgramRootDir(const char * argv) |
| 138 | 138 | strncpy(argv0, argv, 1023); |
| 139 | 139 | argv0[1023] = '\0'; |
| 140 | 140 | #ifdef WIN32 |
| 141 | - if(strncmp(argv0 + (strlen(argv) - 4) ,".exe",4) != NULL && | |
| 142 | - strncmp(argv0 + (strlen(argv) - 4) ,".EXE",4) != NULL) | |
| 141 | + if(strncmp(argv0 + (strlen(argv) - 4) ,".exe",4) != 0 && | |
| 142 | + strncmp(argv0 + (strlen(argv) - 4) ,".EXE",4) != 0) | |
| 143 | 143 | { |
| 144 | 144 | strcat(argv0,".exe"); |
| 145 | 145 | } |
| ... | ... | @@ -446,7 +446,7 @@ int CM_CopyFile(const String& srcFile, const String& desFile) |
| 446 | 446 | #define BUFFER_SIZE 65536 |
| 447 | 447 | |
| 448 | 448 | int32 readByte; |
| 449 | -bool mustDoSha1 = false; | |
| 449 | +//bool mustDoSha1 = false; | |
| 450 | 450 | int ret = COPY_OK; |
| 451 | 451 | String hashKey = ""; |
| 452 | 452 | |
| ... | ... | @@ -608,10 +608,10 @@ bool CM_SetModificationTime(const char * file_name, const time_t aModificationTi |
| 608 | 608 | |
| 609 | 609 | BOOL result = ::SetFileTime(hFile, 0, 0, &modificationTime); |
| 610 | 610 | |
| 611 | - if (result == false) | |
| 611 | + /* if (result == false) | |
| 612 | 612 | { |
| 613 | 613 | int err = GetLastError(); |
| 614 | - } | |
| 614 | + } */ | |
| 615 | 615 | |
| 616 | 616 | CloseHandle(hFile); |
| 617 | 617 | return result ? true : false; |
| ... | ... | @@ -629,10 +629,10 @@ bool CM_SetAccessTime(const char *file_name, const time_t aAccessTime) |
| 629 | 629 | |
| 630 | 630 | BOOL result = ::SetFileTime(hFile, 0, &accessTime, 0); |
| 631 | 631 | |
| 632 | - if (result == false) | |
| 632 | + /*if (result == false) | |
| 633 | 633 | { |
| 634 | 634 | int err = GetLastError(); |
| 635 | - } | |
| 635 | + }*/ | |
| 636 | 636 | |
| 637 | 637 | CloseHandle(hFile); |
| 638 | 638 | return result ? true : false; | ... | ... |
anubis_dev/share/win32stuff.cpp
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | #include "AnubisSupport.h" |
| 3 | 3 | #include "DebugLog.h" |
| 4 | 4 | #include <assert.h> |
| 5 | +#include <string> | |
| 5 | 6 | |
| 6 | 7 | int kernelInit(void) |
| 7 | 8 | { |
| ... | ... | @@ -21,9 +22,9 @@ int kernelInit(void) |
| 21 | 22 | return 1; |
| 22 | 23 | } |
| 23 | 24 | |
| 24 | -char * getpass(char * in) | |
| 25 | +std::string getpass(std::string in) | |
| 25 | 26 | { |
| 26 | - return ""; | |
| 27 | + return std::string(""); | |
| 27 | 28 | } |
| 28 | 29 | |
| 29 | 30 | ... | ... |