Skip to content

Commit 6a81b52

Browse files
committed
address PR comments
1 parent 696bcea commit 6a81b52

File tree

5 files changed

+10
-24
lines changed

5 files changed

+10
-24
lines changed

Core/Libraries/Source/WWVegas/WW3D2/hmdldef.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ int HModelDefClass::Load_W3D(ChunkLoadClass & cload)
148148
/*
149149
** process the header info
150150
*/
151-
strlcpy(ModelName,header.Name,W3D_NAME_LEN);
152-
strlcpy(BasePoseName,header.HierarchyName,W3D_NAME_LEN);
153-
strcpy(Name,ModelName);
151+
strlcpy(ModelName,header.Name,W3D_NAME_LEN);
152+
strlcpy(BasePoseName,header.HierarchyName,W3D_NAME_LEN);
153+
strcpy(Name,ModelName);
154154

155155
/*
156156
** Just allocate a node for the number of sub objects we're expecting

Generals/Code/Tools/WorldBuilder/src/OpenMap.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,18 +115,11 @@ void OpenMap::populateMapListbox( Bool systemMaps )
115115
char fileBuf[_MAX_PATH];
116116

117117
if (systemMaps)
118-
strlcpy(dirBuf, "Maps\\", ARRAY_SIZE(dirBuf));
118+
strcpy(dirBuf, "Maps\\");
119119
else
120120
{
121121
snprintf(dirBuf, ARRAY_SIZE(dirBuf), "%sMaps\\", TheGlobalData->getPath_UserData().str());
122122
}
123-
124-
int len = strlen(dirBuf);
125-
126-
if (len > 0 && dirBuf[len - 1] != '\\') {
127-
dirBuf[len++] = '\\';
128-
dirBuf[len] = 0;
129-
}
130123
CListBox *pList = (CListBox *)this->GetDlgItem(IDC_OPEN_LIST);
131124
if (pList == NULL) return;
132125
pList->ResetContent();
@@ -139,9 +132,9 @@ void OpenMap::populateMapListbox( Bool systemMaps )
139132
do {
140133
if (strcmp(findData.cFileName, ".") == 0 || strcmp(findData.cFileName, "..") == 0)
141134
continue;
142-
if ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) {
143-
continue;
144-
}
135+
if ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) {
136+
continue;
137+
}
145138

146139
snprintf(fileBuf, ARRAY_SIZE(fileBuf), "%s%s\\%s.map", dirBuf, findData.cFileName, findData.cFileName);
147140
try {

Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ void WorldHeightMapEdit::loadDirectoryOfImages(const char *pFilePath)
433433
FilenameList::iterator it = filenameList.begin();
434434
do {
435435
AsciiString filename = *it;
436-
strlcpy(fileBuf, filename.str(), ARRAY_SIZE(fileBuf));
436+
snprintf(fileBuf, ARRAY_SIZE(fileBuf), "%s%s", dirBuf, filename.str());
437437
loadBitmap(fileBuf, filename.str());
438438

439439
++it;

GeneralsMD/Code/Tools/WorldBuilder/src/OpenMap.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,18 +115,11 @@ void OpenMap::populateMapListbox( Bool systemMaps )
115115
char fileBuf[_MAX_PATH];
116116

117117
if (systemMaps)
118-
strlcpy(dirBuf, "Maps\\", ARRAY_SIZE(dirBuf));
118+
strcpy(dirBuf, "Maps\\");
119119
else
120120
{
121121
snprintf(dirBuf, ARRAY_SIZE(dirBuf), "%sMaps\\", TheGlobalData->getPath_UserData().str());
122122
}
123-
124-
int len = strlen(dirBuf);
125-
126-
if (len > 0 && dirBuf[len - 1] != '\\') {
127-
dirBuf[len++] = '\\';
128-
dirBuf[len] = 0;
129-
}
130123
CListBox *pList = (CListBox *)this->GetDlgItem(IDC_OPEN_LIST);
131124
if (pList == NULL) return;
132125
pList->ResetContent();

GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ void WorldHeightMapEdit::loadDirectoryOfImages(const char *pFilePath)
434434
FilenameList::iterator it = filenameList.begin();
435435
do {
436436
AsciiString filename = *it;
437-
strlcpy(fileBuf, filename.str(), ARRAY_SIZE(fileBuf));
437+
snprintf(fileBuf, ARRAY_SIZE(fileBuf), "%s%s", dirBuf, filename.str());
438438
loadBitmap(fileBuf, filename.str());
439439

440440
++it;

0 commit comments

Comments
 (0)