Merge pull request #598 from LegalizeAdulthood/cppcheck-null
Fix char buffer issues found by cppcheckpull/587/head
commit
cf4cb6caef
|
@ -677,16 +677,26 @@ void WriteBinaryDump(const aiScene* scene, FILE* _out, const char* src, const ch
|
|||
Write<uint16_t>(compressed);
|
||||
// == 20 bytes
|
||||
|
||||
char buff[256];
|
||||
strncpy(buff,src,256);
|
||||
fwrite(buff,256,1,out);
|
||||
{
|
||||
char buff[256] = { 0 };
|
||||
strncpy(buff,src,256);
|
||||
buff[255] = 0;
|
||||
fwrite(buff,256,1,out);
|
||||
}
|
||||
|
||||
strncpy(buff,cmd,128);
|
||||
fwrite(buff,128,1,out);
|
||||
{
|
||||
char buff[128] = { 0 };
|
||||
strncpy(buff,cmd,128);
|
||||
buff[127] = 0;
|
||||
fwrite(buff,128,1,out);
|
||||
}
|
||||
|
||||
// leave 64 bytes free for future extensions
|
||||
memset(buff,0xcd,64);
|
||||
fwrite(buff,64,1,out);
|
||||
{
|
||||
char buff[64];
|
||||
memset(buff,0xcd,64);
|
||||
fwrite(buff,64,1,out);
|
||||
}
|
||||
// == 435 bytes
|
||||
|
||||
// ==== total header size: 512 bytes
|
||||
|
|
|
@ -1320,8 +1320,10 @@ int CDisplay::HandleTreeViewPopup2(WPARAM wParam,LPARAM lParam)
|
|||
{
|
||||
// need to remove the file name
|
||||
char* sz = strrchr(szFileName,'\\');
|
||||
if (!sz)sz = strrchr(szFileName,'/');
|
||||
if (!sz)*sz = 0;
|
||||
if (!sz)
|
||||
sz = strrchr(szFileName,'/');
|
||||
if (sz)
|
||||
*sz = 0;
|
||||
}
|
||||
OPENFILENAME sFilename1 = {
|
||||
sizeof(OPENFILENAME),
|
||||
|
@ -1353,8 +1355,10 @@ int CDisplay::HandleTreeViewPopup2(WPARAM wParam,LPARAM lParam)
|
|||
{
|
||||
// need to remove the file name
|
||||
char* sz = strrchr(szFileName,'\\');
|
||||
if (!sz)sz = strrchr(szFileName,'/');
|
||||
if (!sz)*sz = 0;
|
||||
if (!sz)
|
||||
sz = strrchr(szFileName,'/');
|
||||
if (sz)
|
||||
*sz = 0;
|
||||
}
|
||||
OPENFILENAME sFilename1 = {
|
||||
sizeof(OPENFILENAME),
|
||||
|
|
|
@ -168,8 +168,10 @@ void CLogWindow::Save()
|
|||
{
|
||||
// need to remove the file name
|
||||
char* sz = strrchr(szFileName,'\\');
|
||||
if (!sz)sz = strrchr(szFileName,'/');
|
||||
if (!sz)*sz = 0;
|
||||
if (!sz)
|
||||
sz = strrchr(szFileName,'/');
|
||||
if (sz)
|
||||
*sz = 0;
|
||||
}
|
||||
OPENFILENAME sFilename1 = {
|
||||
sizeof(OPENFILENAME),
|
||||
|
|
|
@ -474,8 +474,10 @@ void LoadBGTexture()
|
|||
{
|
||||
// need to remove the file name
|
||||
char* sz = strrchr(szFileName,'\\');
|
||||
if (!sz)sz = strrchr(szFileName,'/');
|
||||
if (!sz)*sz = 0;
|
||||
if (!sz)
|
||||
sz = strrchr(szFileName,'/');
|
||||
if (sz)
|
||||
*sz = 0;
|
||||
}
|
||||
OPENFILENAME sFilename1 = {
|
||||
sizeof(OPENFILENAME),
|
||||
|
@ -597,8 +599,10 @@ void LoadSkybox()
|
|||
{
|
||||
// need to remove the file name
|
||||
char* sz = strrchr(szFileName,'\\');
|
||||
if (!sz)sz = strrchr(szFileName,'/');
|
||||
if (!sz)*sz = 0;
|
||||
if (!sz)
|
||||
sz = strrchr(szFileName,'/');
|
||||
if (sz)
|
||||
*sz = 0;
|
||||
}
|
||||
OPENFILENAME sFilename1 = {
|
||||
sizeof(OPENFILENAME),
|
||||
|
@ -639,8 +643,10 @@ void SaveScreenshot()
|
|||
{
|
||||
// need to remove the file name
|
||||
char* sz = strrchr(szFileName,'\\');
|
||||
if (!sz)sz = strrchr(szFileName,'/');
|
||||
if (!sz)*sz = 0;
|
||||
if (!sz)
|
||||
sz = strrchr(szFileName,'/');
|
||||
if (sz)
|
||||
*sz = 0;
|
||||
}
|
||||
OPENFILENAME sFilename1 = {
|
||||
sizeof(OPENFILENAME),
|
||||
|
@ -938,8 +944,10 @@ void OpenAsset()
|
|||
{
|
||||
// need to remove the file name
|
||||
char* sz = strrchr(szFileName,'\\');
|
||||
if (!sz)sz = strrchr(szFileName,'/');
|
||||
if (!sz)*sz = 0;
|
||||
if (!sz)
|
||||
sz = strrchr(szFileName,'/');
|
||||
if (sz)
|
||||
*sz = 0;
|
||||
}
|
||||
|
||||
// get a list of all file extensions supported by ASSIMP
|
||||
|
|
Loading…
Reference in New Issue