-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
SFMpqGetVersionString2 takes a LPCSTR (const char*) and writes to it.
SFMpqGetVersionString2(LPCSTR lpBuffer, DWORD dwBufferLength)
...
if (dwBufferLength>=slen) memcpy((void *)lpBuffer,SFMpqVersionString,slen);
else memcpy((void *)lpBuffer,SFMpqVersionString,dwBufferLength);
The cast hides this.
GCC warns about this and similar problems with -Wcast-qual:
SFmpqapi.cpp: In function 'DWORD SFMpqGetVersionString2(LPCSTR, DWORD)':
SFmpqapi.cpp:263:43: warning: cast from type 'LPCSTR {aka const char*}' to type 'void*' casts away qualifiers [-Wcast-qual]
if (dwBufferLength>=slen) memcpy((void *)lpBuffer,SFMpqVersionString,slen);
^
SFmpqapi.cpp:264:22: warning: cast from type 'LPCSTR {aka const char*}' to type 'void*' casts away qualifiers [-Wcast-qual]
else memcpy((void *)lpBuffer,SFMpqVersionString,dwBufferLength);
^
SFmpqapi.cpp: In function 'BOOL SFileGetArchiveName(MPQHANDLE, LPCSTR, DWORD)':
SFmpqapi.cpp:761:43: warning: cast from type 'LPCSTR {aka const char*}' to type 'void*' casts away qualifiers [-Wcast-qual]
if (dwBufferLength>=slen) memcpy((void *)lpBuffer,lpFileName,slen);
^
SFmpqapi.cpp:762:22: warning: cast from type 'LPCSTR {aka const char*}' to type 'void*' casts away qualifiers [-Wcast-qual]
else memcpy((void *)lpBuffer,lpFileName,dwBufferLength);
^
SFmpqapi.cpp: In function 'BOOL SFileOpenFileEx(MPQHANDLE, LPCSTR, DWORD, void**)':
SFmpqapi.cpp:916:121: warning: cast from type 'CHAR** {aka char**}' to type 'const CHAR** {aka const char**}' casts away qualifiers [-Wcast-qual]
mpqOpenFile->dwCryptKey = DetectFileSeedEx(mpqOpenFile->lpParentArc,mpqOpenFile->lpHashEntry,(LPCSTR *)&mpqOpenFile->lpFileName);
^
SFmpqapi.cpp: In function 'BOOL SFileGetBasePath(LPCSTR, DWORD)':
SFmpqapi.cpp:1411:43: warning: cast from type 'LPCSTR {aka const char*}' to type 'void*' casts away qualifiers [-Wcast-qual]
if (dwBufferLength>=slen) memcpy((void *)lpBuffer,StormBasePath,slen);
^
SFmpqapi.cpp:1412:22: warning: cast from type 'LPCSTR {aka const char*}' to type 'void*' casts away qualifiers [-Wcast-qual]
else memcpy((void *)lpBuffer,StormBasePath,dwBufferLength);
^
SFmpqapi.cpp: In function 'int StringICompare(const void*, const void*)':
SFmpqapi.cpp:1476:27: warning: cast from type 'const void*' to type 'char**' casts away qualifiers [-Wcast-qual]
return stricmp(*(char **)arg1,*(char **)arg2);
^
SFmpqapi.cpp:1476:42: warning: cast from type 'const void*' to type 'char**' casts away qualifiers [-Wcast-qual]
return stricmp(*(char **)arg1,*(char **)arg2);
^
SFmpqapi.cpp: In function 'BOOL SFileListFiles(MPQHANDLE, LPCSTR, FILELISTENTRY*, DWORD)':
SFmpqapi.cpp:1534:21: warning: cast from type 'LPCSTR {aka const char*}' to type 'char*' casts away qualifiers [-Wcast-qual]
lpFLCopy = (char *)lpFileLists;
^ ^
SFmpqapi.cpp: In function 'BOOL RemoveFromInternalListing(MPQHANDLE, LPCSTR)':
SFmpqapi.cpp:3335:40: warning: cast from type 'const char*' to type 'LPVOID {aka void*}' casts away qualifiers [-Wcast-qual]
MpqAddFileFromBuffer(hMPQ,(LPVOID)"\x00",0,INTERNAL_LISTFILE,MAFA_COMPRESS|MAFA_ENCRYPT|MAFA_MODCRYPTKEY|MAFA_REPLACE_EXISTING);
^
SFmpqapi.cpp: In function 'DWORD DetectFileSeedEx(MPQARCHIVE*, HASHTABLEENTRY*, const CHAR**)':
SFmpqapi.cpp:3406:20: warning: cast from type 'LPCSTR {aka const char*}' to type 'LPSTR {aka char*}' casts away qualifiers [-Wcast-qual]
strcpy((LPSTR)*lplpFileName,INTERNAL_LISTFILE);
^
SFmpqapi.cpp:3448:25: warning: cast from type 'LPCSTR {aka const char*}' to type 'LPSTR {aka char*}' casts away qualifiers [-Wcast-qual]
strcpy((LPSTR)*lplpFileName,listline);
Metadata
Metadata
Assignees
Labels
No labels