Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ void BuddyThreadClass::errorCallback( GPConnection *con, GPErrorArg *arg )
static void getNickForMessage( GPConnection *con, GPGetInfoResponseArg *arg, void *param )
{
BuddyResponse *resp = (BuddyResponse *)param;
static_assert(ARRAY_SIZE(resp->arg.message.nick) >= ARRAY_SIZE(arg->nick), "Incorrect array size");
strcpy(resp->arg.message.nick, arg->nick);
}

Expand Down Expand Up @@ -618,6 +619,9 @@ static void getInfoResponseForRequest( GPConnection *con, GPGetInfoResponseArg *
{
BuddyResponse *resp = (BuddyResponse *)param;
resp->profile = arg->profile;
static_assert(ARRAY_SIZE(resp->arg.request.nick) >= ARRAY_SIZE(arg->nick), "Incorrect array size");
static_assert(ARRAY_SIZE(resp->arg.request.email) >= ARRAY_SIZE(arg->email), "Incorrect array size");
static_assert(ARRAY_SIZE(resp->arg.request.countrycode) >= ARRAY_SIZE(arg->countrycode), "Incorrect array size");
strcpy(resp->arg.request.nick, arg->nick);
strcpy(resp->arg.request.email, arg->email);
strcpy(resp->arg.request.countrycode, arg->countrycode);
Expand All @@ -644,6 +648,9 @@ static void getInfoResponseForStatus(GPConnection * connection, GPGetInfoRespons
{
BuddyResponse *resp = (BuddyResponse *)param;
resp->profile = arg->profile;
static_assert(ARRAY_SIZE(resp->arg.status.nick) >= ARRAY_SIZE(arg->nick), "Incorrect array size");
static_assert(ARRAY_SIZE(resp->arg.status.email) >= ARRAY_SIZE(arg->email), "Incorrect array size");
static_assert(ARRAY_SIZE(resp->arg.status.countrycode) >= ARRAY_SIZE(arg->countrycode), "Incorrect array size");
strcpy(resp->arg.status.nick, arg->nick);
strcpy(resp->arg.status.email, arg->email);
strcpy(resp->arg.status.countrycode, arg->countrycode);
Expand All @@ -660,6 +667,8 @@ void BuddyThreadClass::statusCallback( GPConnection *con, GPRecvBuddyStatusArg *
// get user's status
GPBuddyStatus status;
gpGetBuddyStatus( con, arg->index, &status );
static_assert(ARRAY_SIZE(response.arg.status.location) >= ARRAY_SIZE(status.locationString), "Incorrect array size");
static_assert(ARRAY_SIZE(response.arg.status.statusString) >= ARRAY_SIZE(status.statusString), "Incorrect array size");
strcpy(response.arg.status.location, status.locationString);
strcpy(response.arg.status.statusString, status.statusString);
response.arg.status.status = status.status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1718,6 +1718,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S
//onto world geometry.
if (strlen(shadowInfo->m_ShadowName) <= 1) //no texture name given, use same as object
{
static_assert(ARRAY_SIZE(texture_name) >= ARRAY_SIZE(defaultDecalName), "Incorrect array size");
strcpy(texture_name, defaultDecalName);
}
else
Expand Down Expand Up @@ -1894,6 +1895,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::createDecalShadow(Shadow::ShadowT
//onto world geometry.
if (strlen(shadowInfo->m_ShadowName) <= 1) //no texture name given, use same as object
{
static_assert(ARRAY_SIZE(texture_name) >= ARRAY_SIZE(defaultDecalName), "Incorrect array size");
strcpy(texture_name,defaultDecalName);
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,15 @@ char const * GameFileClass::Set_Name( char const *filename )
if( fileType == FILE_TYPE_W3D )
{

static_assert(ARRAY_SIZE(m_filePath) >= ARRAY_SIZE(W3D_DIR_PATH), "Incorrect array size");
strcpy( m_filePath, W3D_DIR_PATH );
strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath));

}
else if( isImageFileType(fileType) )
{

static_assert(ARRAY_SIZE(m_filePath) >= ARRAY_SIZE(TGA_DIR_PATH), "Incorrect array size");
strcpy( m_filePath, TGA_DIR_PATH );
strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath));

Expand All @@ -182,13 +184,15 @@ char const * GameFileClass::Set_Name( char const *filename )
if( fileType == FILE_TYPE_W3D )
{

static_assert(ARRAY_SIZE(m_filePath) >= ARRAY_SIZE(LEGACY_W3D_DIR_PATH), "Incorrect array size");
strcpy( m_filePath, LEGACY_W3D_DIR_PATH );
strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath));

}
else if( isImageFileType(fileType) )
{

static_assert(ARRAY_SIZE(m_filePath) >= ARRAY_SIZE(LEGACY_TGA_DIR_PATH), "Incorrect array size");
strcpy( m_filePath, LEGACY_TGA_DIR_PATH );
strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath));

Expand All @@ -208,13 +212,15 @@ char const * GameFileClass::Set_Name( char const *filename )
if( fileType == FILE_TYPE_W3D )
{

static_assert(ARRAY_SIZE(m_filePath) >= ARRAY_SIZE(TEST_W3D_DIR_PATH), "Incorrect array size");
strcpy( m_filePath, TEST_W3D_DIR_PATH );
strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath));

}
else if( isImageFileType(fileType) )
{

static_assert(ARRAY_SIZE(m_filePath) >= ARRAY_SIZE(TEST_TGA_DIR_PATH), "Incorrect array size");
strcpy( m_filePath, TEST_TGA_DIR_PATH );
strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath));

Expand Down
2 changes: 2 additions & 0 deletions Generals/Code/Tools/WorldBuilder/src/RoadOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ BOOL RoadOptions::OnInitDialog()
char findBuf[_MAX_PATH];
char fileBuf[_MAX_PATH];

static_assert(ARRAY_SIZE(dirBuf) >= ARRAY_SIZE(ROAD_DIRECTORY), "Incorrect array size");
strcpy(dirBuf, ROAD_DIRECTORY);
int len = strlen(dirBuf);

Expand Down Expand Up @@ -273,6 +274,7 @@ BOOL RoadOptions::OnInitDialog()
++it;
continue;
}
static_assert(ARRAY_SIZE(fileBuf) >= ARRAY_SIZE(TEST_STRING), "Incorrect array size");
strcpy(fileBuf, TEST_STRING);
strlcat(fileBuf, "\\", ARRAY_SIZE(fileBuf));
strlcat(fileBuf, filename.str(), ARRAY_SIZE(fileBuf));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ void BuddyThreadClass::errorCallback( GPConnection *con, GPErrorArg *arg )
static void getNickForMessage( GPConnection *con, GPGetInfoResponseArg *arg, void *param )
{
BuddyResponse *resp = (BuddyResponse *)param;
static_assert(ARRAY_SIZE(resp->arg.message.nick) >= ARRAY_SIZE(arg->nick), "Incorrect array size");
strcpy(resp->arg.message.nick, arg->nick);
}

Expand Down Expand Up @@ -618,6 +619,9 @@ static void getInfoResponseForRequest( GPConnection *con, GPGetInfoResponseArg *
{
BuddyResponse *resp = (BuddyResponse *)param;
resp->profile = arg->profile;
static_assert(ARRAY_SIZE(resp->arg.request.nick) >= ARRAY_SIZE(arg->nick), "Incorrect array size");
static_assert(ARRAY_SIZE(resp->arg.request.email) >= ARRAY_SIZE(arg->email), "Incorrect array size");
static_assert(ARRAY_SIZE(resp->arg.request.countrycode) >= ARRAY_SIZE(arg->countrycode), "Incorrect array size");
strcpy(resp->arg.request.nick, arg->nick);
strcpy(resp->arg.request.email, arg->email);
strcpy(resp->arg.request.countrycode, arg->countrycode);
Expand All @@ -644,6 +648,9 @@ static void getInfoResponseForStatus(GPConnection * connection, GPGetInfoRespons
{
BuddyResponse *resp = (BuddyResponse *)param;
resp->profile = arg->profile;
static_assert(ARRAY_SIZE(resp->arg.status.nick) >= ARRAY_SIZE(arg->nick), "Incorrect array size");
static_assert(ARRAY_SIZE(resp->arg.status.email) >= ARRAY_SIZE(arg->email), "Incorrect array size");
static_assert(ARRAY_SIZE(resp->arg.status.countrycode) >= ARRAY_SIZE(arg->countrycode), "Incorrect array size");
strcpy(resp->arg.status.nick, arg->nick);
strcpy(resp->arg.status.email, arg->email);
strcpy(resp->arg.status.countrycode, arg->countrycode);
Expand All @@ -660,6 +667,8 @@ void BuddyThreadClass::statusCallback( GPConnection *con, GPRecvBuddyStatusArg *
// get user's status
GPBuddyStatus status;
gpGetBuddyStatus( con, arg->index, &status );
static_assert(ARRAY_SIZE(response.arg.status.location) >= ARRAY_SIZE(status.locationString), "Incorrect array size");
static_assert(ARRAY_SIZE(response.arg.status.statusString) >= ARRAY_SIZE(status.statusString), "Incorrect array size");
strcpy(response.arg.status.location, status.locationString);
strcpy(response.arg.status.statusString, status.statusString);
response.arg.status.status = status.status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1718,6 +1718,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::addShadow(RenderObjClass *robj, S
//onto world geometry.
if (strlen(shadowInfo->m_ShadowName) <= 1) //no texture name given, use same as object
{
static_assert(ARRAY_SIZE(texture_name) >= ARRAY_SIZE(defaultDecalName), "Incorrect array size");
strcpy(texture_name, defaultDecalName);
}
else
Expand Down Expand Up @@ -1894,6 +1895,7 @@ W3DProjectedShadow* W3DProjectedShadowManager::createDecalShadow(Shadow::ShadowT
//onto world geometry.
if (strlen(shadowInfo->m_ShadowName) <= 1) //no texture name given, use same as object
{
static_assert(ARRAY_SIZE(texture_name) >= ARRAY_SIZE(defaultDecalName), "Incorrect array size");
strcpy(texture_name, defaultDecalName);
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,15 @@ char const * GameFileClass::Set_Name( char const *filename )
if( fileType == FILE_TYPE_W3D )
{

static_assert(ARRAY_SIZE(m_filePath) >= ARRAY_SIZE(W3D_DIR_PATH), "Incorrect array size");
strcpy( m_filePath, W3D_DIR_PATH );
strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath));

}
else if( isImageFileType(fileType) )
{

static_assert(ARRAY_SIZE(m_filePath) >= ARRAY_SIZE(TGA_DIR_PATH), "Incorrect array size");
strcpy( m_filePath, TGA_DIR_PATH );
strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath));

Expand All @@ -225,13 +227,15 @@ char const * GameFileClass::Set_Name( char const *filename )
if( fileType == FILE_TYPE_W3D )
{

static_assert(ARRAY_SIZE(m_filePath) >= ARRAY_SIZE(LEGACY_W3D_DIR_PATH), "Incorrect array size");
strcpy( m_filePath, LEGACY_W3D_DIR_PATH );
strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath));

}
else if( isImageFileType(fileType) )
{

static_assert(ARRAY_SIZE(m_filePath) >= ARRAY_SIZE(LEGACY_TGA_DIR_PATH), "Incorrect array size");
strcpy( m_filePath, LEGACY_TGA_DIR_PATH );
strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath));

Expand All @@ -253,13 +257,15 @@ char const * GameFileClass::Set_Name( char const *filename )
if( fileType == FILE_TYPE_W3D )
{

static_assert(ARRAY_SIZE(m_filePath) >= ARRAY_SIZE(TEST_W3D_DIR_PATH), "Incorrect array size");
strcpy( m_filePath, TEST_W3D_DIR_PATH );
strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath));

}
else if( isImageFileType(fileType) )
{

static_assert(ARRAY_SIZE(m_filePath) >= ARRAY_SIZE(TEST_TGA_DIR_PATH), "Incorrect array size");
strcpy( m_filePath, TEST_TGA_DIR_PATH );
strlcat(m_filePath, filename, ARRAY_SIZE(m_filePath));

Expand Down
2 changes: 2 additions & 0 deletions GeneralsMD/Code/Tools/WorldBuilder/src/RoadOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ BOOL RoadOptions::OnInitDialog()
char findBuf[_MAX_PATH];
char fileBuf[_MAX_PATH];

static_assert(ARRAY_SIZE(dirBuf) >= ARRAY_SIZE(ROAD_DIRECTORY), "Incorrect array size");
strcpy(dirBuf, ROAD_DIRECTORY);
int len = strlen(dirBuf);

Expand Down Expand Up @@ -273,6 +274,7 @@ BOOL RoadOptions::OnInitDialog()
++it;
continue;
}
static_assert(ARRAY_SIZE(fileBuf) >= ARRAY_SIZE(TEST_STRING), "Incorrect array size");
strcpy(fileBuf, TEST_STRING);
strlcat(fileBuf, "\\", ARRAY_SIZE(fileBuf));
strlcat(fileBuf, filename.str(), ARRAY_SIZE(fileBuf));
Expand Down
Loading