Skip to content

Commit

Permalink
Merge pull request #124 from z33ky/mb/gcc11
Browse files Browse the repository at this point in the history
Fix memory errors
  • Loading branch information
Blixibon committed May 27, 2021
2 parents be71cb4 + 78ef9f2 commit 764f0c0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion sp/src/game/client/clientmode_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,7 @@ void ClientModeShared::FireGameEvent( IGameEvent *event )
}
}

if ( team == 0 && GetLocalTeam() > 0 )
if ( team == 0 && GetLocalTeam() )
{
bValidTeam = false;
}
Expand Down
7 changes: 1 addition & 6 deletions sp/src/game/shared/mapbase/MapEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ class CMapEdit : public CAutoGameSystemPerFrame

pkvClassname = pkvClassname->GetNextKey();
}
pkvClassname->deleteThis();
}
else if (FStrEq(pNodeName, "edit"))
{
Expand All @@ -432,7 +431,6 @@ class CMapEdit : public CAutoGameSystemPerFrame

pName = pName->GetNextKey();
}
pName->deleteThis();
}
else if (FStrEq(pNodeName, "delete"))
{
Expand All @@ -455,7 +453,6 @@ class CMapEdit : public CAutoGameSystemPerFrame

pName = pName->GetNextKey();
}
pName->deleteThis();
}
else if (FStrEq(pNodeName, "fire"))
{
Expand Down Expand Up @@ -525,12 +522,10 @@ class CMapEdit : public CAutoGameSystemPerFrame

pkvNodeData = pkvNodeData->GetNextKey();
}
pkvNodeData->deleteThis();
}

pkvNode = pkvNode->GetNextKey();
}
pkvNode->deleteThis();
}

void SpawnMapEdit(const char *pFile = NULL)
Expand Down Expand Up @@ -889,8 +884,8 @@ void CC_MapEdit_Print( const CCommand& args )
pkvNode = pkvNode->GetNextKey();
}

pkvNode->deleteThis();
}
pkvFile->deleteThis();
}
}
static ConCommand mapedit_print("mapedit_print", CC_MapEdit_Print, "Prints a mapedit file in the console.");
Expand Down
8 changes: 4 additions & 4 deletions sp/src/tier1/strtools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ int V_UCS2ToUnicode( const ucs2 *pUCS2, wchar_t *pUnicode, int cubDestSizeInByte
size_t nMaxUTF8 = cubDestSizeInBytes;
char *pIn = (char *)pUCS2;
char *pOut = (char *)pUnicode;
if ( conv_t > 0 )
if ( conv_t )
{
cchResult = 0;
cchResult = iconv( conv_t, &pIn, &nLenUnicde, &pOut, &nMaxUTF8 );
Expand Down Expand Up @@ -1461,7 +1461,7 @@ int V_UnicodeToUCS2( const wchar_t *pUnicode, int cubSrcInBytes, char *pUCS2, in
size_t nMaxUCS2 = cubDestSizeInBytes;
char *pIn = (char*)pUnicode;
char *pOut = pUCS2;
if ( conv_t > 0 )
if ( conv_t )
{
cchResult = 0;
cchResult = iconv( conv_t, &pIn, &nLenUnicde, &pOut, &nMaxUCS2 );
Expand Down Expand Up @@ -1508,7 +1508,7 @@ int V_UCS2ToUTF8( const ucs2 *pUCS2, char *pUTF8, int cubDestSizeInBytes )
size_t nMaxUTF8 = cubDestSizeInBytes - 1;
char *pIn = (char *)pUCS2;
char *pOut = (char *)pUTF8;
if ( conv_t > 0 )
if ( conv_t )
{
cchResult = 0;
const size_t nBytesToWrite = nMaxUTF8;
Expand Down Expand Up @@ -1554,7 +1554,7 @@ int V_UTF8ToUCS2( const char *pUTF8, int cubSrcInBytes, ucs2 *pUCS2, int cubDest
size_t nMaxUTF8 = cubDestSizeInBytes;
char *pIn = (char *)pUTF8;
char *pOut = (char *)pUCS2;
if ( conv_t > 0 )
if ( conv_t )
{
cchResult = 0;
cchResult = iconv( conv_t, &pIn, &nLenUnicde, &pOut, &nMaxUTF8 );
Expand Down

0 comments on commit 764f0c0

Please sign in to comment.