Skip to content

Commit abd092c

Browse files
authored
refactor: Apply clang-tidy fixes for generals-use-is-empty (#2018)
1 parent b878990 commit abd092c

File tree

25 files changed

+40
-40
lines changed

25 files changed

+40
-40
lines changed

Core/GameEngine/Source/Common/System/ArchiveFile.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@
3939
// and ? is used to denote a single wildcard character.
4040
static Bool SearchStringMatches(AsciiString str, AsciiString searchString)
4141
{
42-
if (str.getLength() == 0) {
43-
if (searchString.getLength() == 0) {
42+
if (str.isEmpty()) {
43+
if (searchString.isEmpty()) {
4444
return TRUE;
4545
}
4646
return FALSE;
4747
}
48-
if (searchString.getLength() == 0) {
48+
if (searchString.isEmpty()) {
4949
return FALSE;
5050
}
5151

@@ -103,7 +103,7 @@ void ArchiveFile::addFile(const AsciiString& path, const ArchivedFileInfo *fileI
103103
tokenizer.toLower();
104104
tokenizer.nextToken(&token, "\\/");
105105

106-
while (token.getLength() > 0)
106+
while (!token.isEmpty())
107107
{
108108
DetailedArchivedDirectoryInfoMap::iterator tempiter = dirInfo->m_directories.find(token);
109109
if (tempiter == dirInfo->m_directories.end())
@@ -131,7 +131,7 @@ void ArchiveFile::getFileListInDirectory(const AsciiString& currentDirectory, co
131131
tokenizer.toLower();
132132
tokenizer.nextToken(&token, "\\/");
133133

134-
while (token.getLength() > 0) {
134+
while (!token.isEmpty()) {
135135

136136
DetailedArchivedDirectoryInfoMap::const_iterator it = dirInfo->m_directories.find(token);
137137
if (it != dirInfo->m_directories.end())
@@ -157,7 +157,7 @@ void ArchiveFile::getFileListInDirectory(const DetailedArchivedDirectoryInfo *di
157157
const DetailedArchivedDirectoryInfo *tempDirInfo = &(diriter->second);
158158
AsciiString tempdirname;
159159
tempdirname = currentDirectory;
160-
if ((tempdirname.getLength() > 0) && (!tempdirname.endsWith("\\"))) {
160+
if ((!tempdirname.isEmpty()) && (!tempdirname.endsWith("\\"))) {
161161
tempdirname.concat('\\');
162162
}
163163
tempdirname.concat(tempDirInfo->m_directoryName);
@@ -170,7 +170,7 @@ void ArchiveFile::getFileListInDirectory(const DetailedArchivedDirectoryInfo *di
170170
if (SearchStringMatches(fileiter->second.m_filename, searchName)) {
171171
AsciiString tempfilename;
172172
tempfilename = currentDirectory;
173-
if ((tempfilename.getLength() > 0) && (!tempfilename.endsWith("\\"))) {
173+
if ((!tempfilename.isEmpty()) && (!tempfilename.endsWith("\\"))) {
174174
tempfilename.concat('\\');
175175
}
176176
tempfilename.concat(fileiter->second.m_filename);

Core/GameEngine/Source/Common/System/ArchiveFileSystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ Bool ArchiveFileSystem::getFileInfo(const AsciiString& filename, FileInfo *fileI
305305
return FALSE;
306306
}
307307

308-
if (filename.getLength() <= 0) {
308+
if (filename.isEmpty()) {
309309
return FALSE;
310310
}
311311

Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1714,7 +1714,7 @@ PlayerLeaveCode ConnectionManager::disconnectPlayer(Int slot) {
17141714

17151715
UnicodeString unicodeName;
17161716
unicodeName = getPlayerName(slot);
1717-
if (unicodeName.getLength() > 0 && m_connections[slot]) {
1717+
if (!unicodeName.isEmpty() && m_connections[slot]) {
17181718
TheInGameUI->message("Network:PlayerLeftGame", unicodeName.str());
17191719

17201720
// People are boneheads. Also play a sound

Core/GameEngine/Source/GameNetwork/GameInfo.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ void GameInfo::setMap( AsciiString mapName )
525525
}
526526

527527
AsciiString newMapName;
528-
if (mapName.getLength() > 0)
528+
if (!mapName.isEmpty())
529529
{
530530
AsciiString token;
531531
mapName.nextToken(&token, "\\/");
@@ -536,7 +536,7 @@ void GameInfo::setMap( AsciiString mapName )
536536
// added onto it.
537537
while (mapName.find('\\') != NULL)
538538
{
539-
if (newMapName.getLength() > 0)
539+
if (!newMapName.isEmpty())
540540
{
541541
newMapName.concat('/');
542542
}
@@ -896,7 +896,7 @@ AsciiString GameInfoToAsciiString( const GameInfo *game )
896896
AsciiString mapName = game->getMap();
897897
mapName = TheGameState->realMapPathToPortableMapPath(mapName);
898898
AsciiString newMapName;
899-
if (mapName.getLength() > 0)
899+
if (!mapName.isEmpty())
900900
{
901901
AsciiString token;
902902
mapName.nextToken(&token, "\\/");
@@ -907,7 +907,7 @@ AsciiString GameInfoToAsciiString( const GameInfo *game )
907907
// added onto it.
908908
while (mapName.find('\\') != NULL)
909909
{
910-
if (newMapName.getLength() > 0)
910+
if (!newMapName.isEmpty())
911911
{
912912
newMapName.concat('/');
913913
}
@@ -1073,7 +1073,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options)
10731073
AsciiString token;
10741074
tempstr = val.str()+2;
10751075
tempstr.nextToken(&token, "\\/");
1076-
while (tempstr.getLength() > 0)
1076+
while (!tempstr.isEmpty())
10771077
{
10781078
mapName.concat(token);
10791079
mapName.concat('\\');

Core/GameEngine/Source/GameNetwork/NetworkUtil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ UnsignedInt ResolveIP(AsciiString host)
8484
struct hostent *hostStruct;
8585
struct in_addr *hostNode;
8686

87-
if (host.getLength() == 0)
87+
if (host.isEmpty())
8888
{
8989
DEBUG_LOG(("ResolveIP(): Can't resolve NULL"));
9090
return 0;

Core/GameEngineDevice/Source/Win32Device/Common/Win32LocalFileSystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ Bool Win32LocalFileSystem::getFileInfo(const AsciiString& filename, FileInfo *fi
206206

207207
Bool Win32LocalFileSystem::createDirectory(AsciiString directory)
208208
{
209-
if ((directory.getLength() > 0) && (directory.getLength() < _MAX_DIR)) {
209+
if ((!directory.isEmpty()) && (directory.getLength() < _MAX_DIR)) {
210210
return (CreateDirectory(directory.str(), NULL) != 0);
211211
}
212212
return FALSE;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ Build_List_From_String
164164
//
165165
// Add this entry to our list
166166
//
167-
if ((entry_string.Get_Length () > 0) || (count == 0)) {
167+
if ((!entry_string.Is_Empty()) || (count == 0)) {
168168
(*string_list)[count++] = entry_string;
169169
}
170170
}

Core/Libraries/Source/WWVegas/WWAudio/AudibleSound.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1780,7 +1780,7 @@ AudibleSoundClass::Load (ChunkLoadClass &cload)
17801780
//
17811781
// Reconstruct the sound buffer we had before we saved
17821782
//
1783-
if (filename.Get_Length () > 0) {
1783+
if (!filename.Is_Empty()) {
17841784
bool is_3d = (As_Sound3DClass () != NULL);
17851785
SoundBufferClass *buffer = WWAudioClass::Get_Instance ()->Get_Sound_Buffer (filename, is_3d);
17861786
Set_Buffer (buffer);

Core/Libraries/Source/WWVegas/WWAudio/WWAudio.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2267,7 +2267,7 @@ WWAudioClass::UnRegister_Text_Callback (LPFNTEXTCALLBACK callback)
22672267
void
22682268
WWAudioClass::Fire_Text_Callback (AudibleSoundClass *sound_obj, const StringClass &text)
22692269
{
2270-
if (text.Get_Length () > 0) {
2270+
if (!text.Is_Empty()) {
22712271

22722272
//
22732273
// Loop over all the text-callbacks that have been registered

Core/Libraries/Source/WWVegas/WWDebug/wwprofile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ void WWProfileHierachyNodeClass::Add_To_String_Compact(StringClass& string,int r
221221
if (Child) {
222222
StringClass work;
223223
Child->Add_To_String_Compact(work,recursion+1);
224-
if (work.Get_Length()!=0) {
224+
if (!work.Is_Empty()) {
225225
string+="{";
226226
string+=work;
227227
string+="}";

0 commit comments

Comments
 (0)