mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Consistently use str_copy
instead of mem_copy
for strings
This commit is contained in:
parent
a5ca7c64e0
commit
24d12e4820
|
@ -96,7 +96,7 @@ CSqlExecData::CSqlExecData(
|
||||||
m_pName("add sqlite server")
|
m_pName("add sqlite server")
|
||||||
{
|
{
|
||||||
m_Ptr.m_Sqlite.m_Mode = m;
|
m_Ptr.m_Sqlite.m_Mode = m;
|
||||||
mem_copy(m_Ptr.m_Sqlite.m_FileName, aFileName, sizeof(m_Ptr.m_Sqlite.m_FileName));
|
str_copy(m_Ptr.m_Sqlite.m_FileName, aFileName);
|
||||||
}
|
}
|
||||||
CSqlExecData::CSqlExecData(CDbConnectionPool::Mode m,
|
CSqlExecData::CSqlExecData(CDbConnectionPool::Mode m,
|
||||||
const CMysqlConfig *pMysqlConfig) :
|
const CMysqlConfig *pMysqlConfig) :
|
||||||
|
|
|
@ -186,7 +186,7 @@ void CHud::RenderScoreHud()
|
||||||
if(aRecreateTeamScore[t])
|
if(aRecreateTeamScore[t])
|
||||||
{
|
{
|
||||||
m_aScoreInfo[t].m_ScoreTextWidth = TextRender()->TextWidth(14.0f, aScoreTeam[t == 0 ? TEAM_RED : TEAM_BLUE], -1, -1.0f);
|
m_aScoreInfo[t].m_ScoreTextWidth = TextRender()->TextWidth(14.0f, aScoreTeam[t == 0 ? TEAM_RED : TEAM_BLUE], -1, -1.0f);
|
||||||
mem_copy(m_aScoreInfo[t].m_aScoreText, aScoreTeam[t == 0 ? TEAM_RED : TEAM_BLUE], sizeof(m_aScoreInfo[t].m_aScoreText));
|
str_copy(m_aScoreInfo[t].m_aScoreText, aScoreTeam[t == 0 ? TEAM_RED : TEAM_BLUE]);
|
||||||
RecreateRect = true;
|
RecreateRect = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ void CHud::RenderScoreHud()
|
||||||
const char *pName = m_pClient->m_aClients[Id].m_aName;
|
const char *pName = m_pClient->m_aClients[Id].m_aName;
|
||||||
if(str_comp(pName, m_aScoreInfo[t].m_aPlayerNameText) != 0 || RecreateRect)
|
if(str_comp(pName, m_aScoreInfo[t].m_aPlayerNameText) != 0 || RecreateRect)
|
||||||
{
|
{
|
||||||
mem_copy(m_aScoreInfo[t].m_aPlayerNameText, pName, sizeof(m_aScoreInfo[t].m_aPlayerNameText));
|
str_copy(m_aScoreInfo[t].m_aPlayerNameText, pName);
|
||||||
|
|
||||||
float w = TextRender()->TextWidth(8.0f, pName, -1, -1.0f);
|
float w = TextRender()->TextWidth(8.0f, pName, -1, -1.0f);
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ void CHud::RenderScoreHud()
|
||||||
if(RecreateScores)
|
if(RecreateScores)
|
||||||
{
|
{
|
||||||
m_aScoreInfo[t].m_ScoreTextWidth = TextRender()->TextWidth(14.0f, aScore[t], -1, -1.0f);
|
m_aScoreInfo[t].m_ScoreTextWidth = TextRender()->TextWidth(14.0f, aScore[t], -1, -1.0f);
|
||||||
mem_copy(m_aScoreInfo[t].m_aScoreText, aScore[t], sizeof(m_aScoreInfo[t].m_aScoreText));
|
str_copy(m_aScoreInfo[t].m_aScoreText, aScore[t]);
|
||||||
RecreateRect = true;
|
RecreateRect = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,7 +412,7 @@ void CHud::RenderScoreHud()
|
||||||
const char *pName = m_pClient->m_aClients[Id].m_aName;
|
const char *pName = m_pClient->m_aClients[Id].m_aName;
|
||||||
if(RecreateRect)
|
if(RecreateRect)
|
||||||
{
|
{
|
||||||
mem_copy(m_aScoreInfo[t].m_aPlayerNameText, pName, sizeof(m_aScoreInfo[t].m_aPlayerNameText));
|
str_copy(m_aScoreInfo[t].m_aPlayerNameText, pName);
|
||||||
|
|
||||||
CTextCursor Cursor;
|
CTextCursor Cursor;
|
||||||
float w = TextRender()->TextWidth(8.0f, pName, -1, -1.0f);
|
float w = TextRender()->TextWidth(8.0f, pName, -1, -1.0f);
|
||||||
|
@ -450,7 +450,7 @@ void CHud::RenderScoreHud()
|
||||||
str_format(aBuf, sizeof(aBuf), "%d.", aPos[t]);
|
str_format(aBuf, sizeof(aBuf), "%d.", aPos[t]);
|
||||||
if(RecreateRect)
|
if(RecreateRect)
|
||||||
{
|
{
|
||||||
mem_copy(m_aScoreInfo[t].m_aRankText, aBuf, sizeof(m_aScoreInfo[t].m_aRankText));
|
str_copy(m_aScoreInfo[t].m_aRankText, aBuf);
|
||||||
|
|
||||||
CTextCursor Cursor;
|
CTextCursor Cursor;
|
||||||
TextRender()->SetCursor(&Cursor, m_Width - ScoreWidthMax - ImageSize - Split - PosSize, StartY + t * 20 + (18.f - 10.f) / 2.f, 10.0f, TEXTFLAG_RENDER);
|
TextRender()->SetCursor(&Cursor, m_Width - ScoreWidthMax - ImageSize - Split - PosSize, StartY + t * 20 + (18.f - 10.f) / 2.f, 10.0f, TEXTFLAG_RENDER);
|
||||||
|
|
|
@ -105,7 +105,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
|
||||||
const char *pName = m_pClient->m_aClients[pPlayerInfo->m_ClientId].m_aName;
|
const char *pName = m_pClient->m_aClients[pPlayerInfo->m_ClientId].m_aName;
|
||||||
if(str_comp(pName, m_aNamePlates[ClientId].m_aName) != 0 || FontSize != m_aNamePlates[ClientId].m_NameTextFontSize)
|
if(str_comp(pName, m_aNamePlates[ClientId].m_aName) != 0 || FontSize != m_aNamePlates[ClientId].m_NameTextFontSize)
|
||||||
{
|
{
|
||||||
mem_copy(m_aNamePlates[ClientId].m_aName, pName, sizeof(m_aNamePlates[ClientId].m_aName));
|
str_copy(m_aNamePlates[ClientId].m_aName, pName);
|
||||||
m_aNamePlates[ClientId].m_NameTextFontSize = FontSize;
|
m_aNamePlates[ClientId].m_NameTextFontSize = FontSize;
|
||||||
|
|
||||||
CTextCursor Cursor;
|
CTextCursor Cursor;
|
||||||
|
@ -128,7 +128,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
|
||||||
const char *pClan = m_pClient->m_aClients[ClientId].m_aClan;
|
const char *pClan = m_pClient->m_aClients[ClientId].m_aClan;
|
||||||
if(str_comp(pClan, m_aNamePlates[ClientId].m_aClanName) != 0 || FontSizeClan != m_aNamePlates[ClientId].m_ClanNameTextFontSize)
|
if(str_comp(pClan, m_aNamePlates[ClientId].m_aClanName) != 0 || FontSizeClan != m_aNamePlates[ClientId].m_ClanNameTextFontSize)
|
||||||
{
|
{
|
||||||
mem_copy(m_aNamePlates[ClientId].m_aClanName, pClan, sizeof(m_aNamePlates[ClientId].m_aClanName));
|
str_copy(m_aNamePlates[ClientId].m_aClanName, pClan);
|
||||||
m_aNamePlates[ClientId].m_ClanNameTextFontSize = FontSizeClan;
|
m_aNamePlates[ClientId].m_ClanNameTextFontSize = FontSizeClan;
|
||||||
|
|
||||||
CTextCursor Cursor;
|
CTextCursor Cursor;
|
||||||
|
|
|
@ -64,7 +64,7 @@ CLayerTiles::CLayerTiles(const CLayerTiles &Other) :
|
||||||
m_Switch = Other.m_Switch;
|
m_Switch = Other.m_Switch;
|
||||||
m_Tune = Other.m_Tune;
|
m_Tune = Other.m_Tune;
|
||||||
|
|
||||||
mem_copy(m_aFileName, Other.m_aFileName, IO_MAX_PATH_LENGTH);
|
str_copy(m_aFileName, Other.m_aFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLayerTiles::~CLayerTiles()
|
CLayerTiles::~CLayerTiles()
|
||||||
|
|
|
@ -3250,7 +3250,7 @@ void CGameContext::AddVote(const char *pDescription, const char *pCommand)
|
||||||
m_pVoteOptionFirst = pOption;
|
m_pVoteOptionFirst = pOption;
|
||||||
|
|
||||||
str_copy(pOption->m_aDescription, pDescription, sizeof(pOption->m_aDescription));
|
str_copy(pOption->m_aDescription, pDescription, sizeof(pOption->m_aDescription));
|
||||||
mem_copy(pOption->m_aCommand, pCommand, Len + 1);
|
str_copy(pOption->m_aCommand, pCommand, Len + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameContext::ConRemoveVote(IConsole::IResult *pResult, void *pUserData)
|
void CGameContext::ConRemoveVote(IConsole::IResult *pResult, void *pUserData)
|
||||||
|
@ -3311,7 +3311,7 @@ void CGameContext::ConRemoveVote(IConsole::IResult *pResult, void *pUserData)
|
||||||
pVoteOptionFirst = pDst;
|
pVoteOptionFirst = pDst;
|
||||||
|
|
||||||
str_copy(pDst->m_aDescription, pSrc->m_aDescription, sizeof(pDst->m_aDescription));
|
str_copy(pDst->m_aDescription, pSrc->m_aDescription, sizeof(pDst->m_aDescription));
|
||||||
mem_copy(pDst->m_aCommand, pSrc->m_aCommand, Len + 1);
|
str_copy(pDst->m_aCommand, pSrc->m_aCommand, Len + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
|
@ -4068,7 +4068,7 @@ void CGameContext::OnMapChange(char *pNewMapName, int MapNameSize)
|
||||||
{
|
{
|
||||||
int Length = str_length(pLine) + 1;
|
int Length = str_length(pLine) + 1;
|
||||||
char *pCopy = (char *)malloc(Length);
|
char *pCopy = (char *)malloc(Length);
|
||||||
mem_copy(pCopy, pLine, Length);
|
str_copy(pCopy, pLine, Length);
|
||||||
vLines.push_back(pCopy);
|
vLines.push_back(pCopy);
|
||||||
TotalLength += Length;
|
TotalLength += Length;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue