Skip to content

Commit ec72413

Browse files
author
Bart Roossien
committed
changing sizeof() back to ARRAY_Size
1 parent 08ee57b commit ec72413

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

Generals/Code/GameEngine/Source/GameNetwork/LANAPI.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ void LANAPI::RequestGameJoin( LANGameInfo *game, UnsignedInt ip /* = 0 */ )
632632

633633
AsciiString s = "";
634634
GetStringFromRegistry("\\ergc", "", s);
635-
strlcpy(msg.GameToJoin.serial, s.str(), sizeof(msg.GameToJoin.serial));
635+
strlcpy(msg.GameToJoin.serial, s.str(), ARRAY_SIZE(msg.GameToJoin.serial));
636636

637637
sendMessage(&msg, ip);
638638

@@ -706,7 +706,7 @@ void LANAPI::RequestGameAnnounce( void )
706706
reply.LANMessageType = LANMessage::MSG_GAME_ANNOUNCE;
707707

708708
AsciiString gameOpts = GameInfoToAsciiString(m_currentGame);
709-
strlcpy(reply.GameInfo.options,gameOpts.str(), sizeof(reply.GameInfo.options));
709+
strlcpy(reply.GameInfo.options,gameOpts.str(), ARRAY_SIZE(reply.GameInfo.options));
710710
wcsncpy(reply.GameInfo.gameName, m_currentGame->getName().str(), g_lanGameNameLength);
711711
reply.GameInfo.gameName[g_lanGameNameLength] = 0;
712712
reply.GameInfo.inProgress = m_currentGame->isGameInProgress();
@@ -838,7 +838,7 @@ void LANAPI::RequestGameOptions( AsciiString gameOptions, Bool isPublic, Unsigne
838838
LANMessage msg;
839839
fillInLANMessage( &msg );
840840
msg.LANMessageType = LANMessage::MSG_GAME_OPTIONS;
841-
strlcpy(msg.GameOptions.options, gameOptions.str(), sizeof(msg.GameOptions.options));
841+
strlcpy(msg.GameOptions.options, gameOptions.str(), ARRAY_SIZE(msg.GameOptions.options));
842842
msg.GameOptions.options[m_lanMaxOptionsLength] = 0;
843843
sendMessage(&msg, ip);
844844

@@ -1074,8 +1074,8 @@ void LANAPI::fillInLANMessage( LANMessage *msg )
10741074

10751075
wcsncpy(msg->name, m_name.str(), g_lanPlayerNameLength);
10761076
msg->name[g_lanPlayerNameLength] = 0;
1077-
strlcpy(msg->userName, m_userName.str(), sizeof(msg->userName));
1078-
strlcpy(msg->hostName, m_hostName.str(), sizeof(msg->hostName));
1077+
strlcpy(msg->userName, m_userName.str(), ARRAY_SIZE(msg->userName));
1078+
strlcpy(msg->hostName, m_hostName.str(), ARRAY_SIZE(msg->hostName));
10791079
}
10801080

10811081
void LANAPI::RequestLobbyLeave( Bool forced )

Generals/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void LANAPI::handleRequestLocations( LANMessage *msg, UnsignedInt senderIP )
6262
fillInLANMessage( &reply );
6363
reply.LANMessageType = LANMessage::MSG_GAME_ANNOUNCE;
6464
AsciiString gameOpts = GenerateGameOptionsString();
65-
strlcpy(reply.GameInfo.options, gameOpts.str(), sizeof(reply.GameInfo.options));
65+
strlcpy(reply.GameInfo.options, gameOpts.str(), ARRAY_SIZE(reply.GameInfo.options));
6666
wcsncpy(reply.GameInfo.gameName, m_currentGame->getName().str(), g_lanGameNameLength);
6767
reply.GameInfo.gameName[g_lanGameNameLength] = 0;
6868
reply.GameInfo.inProgress = m_currentGame->isGameInProgress();
@@ -193,7 +193,7 @@ void LANAPI::handleRequestGameInfo( LANMessage *msg, UnsignedInt senderIP )
193193
reply.LANMessageType = LANMessage::MSG_GAME_ANNOUNCE;
194194

195195
AsciiString gameOpts = GameInfoToAsciiString(m_currentGame);
196-
strlcpy(reply.GameInfo.options,gameOpts.str(),sizeof(reply.GameInfo.options));
196+
strlcpy(reply.GameInfo.options,gameOpts.str(), ARRAY_SIZE(reply.GameInfo.options));
197197
wcsncpy(reply.GameInfo.gameName, m_currentGame->getName().str(), g_lanGameNameLength);
198198
reply.GameInfo.gameName[g_lanGameNameLength] = 0;
199199
reply.GameInfo.inProgress = m_currentGame->isGameInProgress();

GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ void LANAPI::RequestGameJoin( LANGameInfo *game, UnsignedInt ip /* = 0 */ )
632632

633633
AsciiString s = "";
634634
GetStringFromRegistry("\\ergc", "", s);
635-
strlcpy(msg.GameToJoin.serial, s.str(), sizeof(msg.GameToJoin.serial));
635+
strlcpy(msg.GameToJoin.serial, s.str(), ARRAY_SIZE(msg.GameToJoin.serial));
636636

637637
sendMessage(&msg, ip);
638638

@@ -706,7 +706,7 @@ void LANAPI::RequestGameAnnounce( void )
706706
reply.LANMessageType = LANMessage::MSG_GAME_ANNOUNCE;
707707

708708
AsciiString gameOpts = GameInfoToAsciiString(m_currentGame);
709-
strlcpy(reply.GameInfo.options,gameOpts.str(), sizeof(reply.GameOptions.options));
709+
strlcpy(reply.GameInfo.options,gameOpts.str(), ARRAY_SIZE(reply.GameOptions.options));
710710
wcsncpy(reply.GameInfo.gameName, m_currentGame->getName().str(), g_lanGameNameLength);
711711
reply.GameInfo.gameName[g_lanGameNameLength] = 0;
712712
reply.GameInfo.inProgress = m_currentGame->isGameInProgress();
@@ -838,7 +838,7 @@ void LANAPI::RequestGameOptions( AsciiString gameOptions, Bool isPublic, Unsigne
838838
LANMessage msg;
839839
fillInLANMessage( &msg );
840840
msg.LANMessageType = LANMessage::MSG_GAME_OPTIONS;
841-
strlcpy(msg.GameOptions.options, gameOptions.str(), sizeof(msg.GameOptions.options));
841+
strlcpy(msg.GameOptions.options, gameOptions.str(), ARRAY_SIZE(msg.GameOptions.options));
842842
sendMessage(&msg, ip);
843843

844844
m_lastGameopt = gameOptions;
@@ -1073,8 +1073,8 @@ void LANAPI::fillInLANMessage( LANMessage *msg )
10731073

10741074
wcsncpy(msg->name, m_name.str(), g_lanPlayerNameLength);
10751075
msg->name[g_lanPlayerNameLength] = 0;
1076-
strlcpy(msg->userName, m_userName.str(), sizeof(msg->userName));
1077-
strlcpy(msg->hostName, m_hostName.str(), sizeof(msg->hostName));
1076+
strlcpy(msg->userName, m_userName.str(), ARRAY_SIZE(msg->userName));
1077+
strlcpy(msg->hostName, m_hostName.str(), ARRAY_SIZE(msg->hostName));
10781078
}
10791079

10801080
void LANAPI::RequestLobbyLeave( Bool forced )

GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void LANAPI::handleRequestLocations( LANMessage *msg, UnsignedInt senderIP )
6262
fillInLANMessage( &reply );
6363
reply.LANMessageType = LANMessage::MSG_GAME_ANNOUNCE;
6464
AsciiString gameOpts = GenerateGameOptionsString();
65-
strlcpy(reply.GameInfo.options,gameOpts.str(),sizeof(reply.GameInfo.options));
65+
strlcpy(reply.GameInfo.options,gameOpts.str(), ARRAY_SIZE(reply.GameInfo.options));
6666
wcsncpy(reply.GameInfo.gameName, m_currentGame->getName().str(), g_lanGameNameLength);
6767
reply.GameInfo.gameName[g_lanGameNameLength] = 0;
6868
reply.GameInfo.inProgress = m_currentGame->isGameInProgress();
@@ -193,7 +193,7 @@ void LANAPI::handleRequestGameInfo( LANMessage *msg, UnsignedInt senderIP )
193193
reply.LANMessageType = LANMessage::MSG_GAME_ANNOUNCE;
194194

195195
AsciiString gameOpts = GameInfoToAsciiString(m_currentGame);
196-
strlcpy(reply.GameInfo.options,gameOpts.str(), sizeof(reply.GameInfo.options));
196+
strlcpy(reply.GameInfo.options,gameOpts.str(), ARRAY_SIZE(reply.GameInfo.options));
197197
wcsncpy(reply.GameInfo.gameName, m_currentGame->getName().str(), g_lanGameNameLength);
198198
reply.GameInfo.gameName[g_lanGameNameLength] = 0;
199199
reply.GameInfo.inProgress = m_currentGame->isGameInProgress();

0 commit comments

Comments
 (0)