Skip to content

Commit

Permalink
More automated fixes by clang-tidy
Browse files Browse the repository at this point in the history
Checking for unnecessary use of c_str(), unused const
possibilities, and unnecessary null checking before
delete.
  • Loading branch information
perim committed May 6, 2017
1 parent 30d5cb5 commit e57b3ab
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/framework/crc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ unsigned long ERR_get_error()
return 1;
}

const char *ERR_error_string(unsigned long e, char *buf)
static const char *ERR_error_string(unsigned long e, const char *buf)
{
(void)buf;
return "";
Expand Down
2 changes: 1 addition & 1 deletion lib/ivis_opengl/piedef.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void pie_setShadows(bool drawShadows);

/** Set light parameters */
void pie_InitLighting();
void pie_Lighting0(LIGHTING_TYPE entry, float value[4]);
void pie_Lighting0(LIGHTING_TYPE entry, const float value[4]);

void pie_RemainingPasses();

Expand Down
2 changes: 1 addition & 1 deletion lib/ivis_opengl/piedraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void pie_InitLighting()
memcpy(lighting0, defaultLight, sizeof(lighting0));
}

void pie_Lighting0(LIGHTING_TYPE entry, float value[4])
void pie_Lighting0(LIGHTING_TYPE entry, const float value[4])
{
lighting0[entry][0] = value[0];
lighting0[entry][1] = value[1];
Expand Down
4 changes: 2 additions & 2 deletions src/design.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ static bool intAddTemplateForm(DROID_TEMPLATE *psSelected);
/* Add the system buttons (weapons, command droid, etc) to the design screen */
static bool intAddSystemButtons(DES_COMPMODE mode);
/* Add the component buttons to the main tab of the system or component form */
static bool intAddComponentButtons(ListTabWidget *compList, COMPONENT_STATS *psStats, unsigned size, UBYTE *aAvailable, unsigned numEntries, unsigned compID);
static bool intAddComponentButtons(ListTabWidget *compList, COMPONENT_STATS *psStats, unsigned size, const UBYTE *aAvailable, unsigned numEntries, unsigned compID);
/* Add the component buttons to the main tab of the component form */
static bool intAddExtraSystemButtons(ListTabWidget *compList, unsigned sensorIndex, unsigned ecmIndex, unsigned constIndex, unsigned repairIndex, unsigned brainIndex);
/* Set the bar graphs for the system clickable */
Expand Down Expand Up @@ -1768,7 +1768,7 @@ static bool intAddSystemButtons(DES_COMPMODE mode)


/* Add the component buttons to the main tab of the component form */
static bool intAddComponentButtons(ListTabWidget *compList, COMPONENT_STATS *psStats, unsigned size, UBYTE *aAvailable, unsigned numEntries, unsigned compID)
static bool intAddComponentButtons(ListTabWidget *compList, COMPONENT_STATS *psStats, unsigned size, const UBYTE *aAvailable, unsigned numEntries, unsigned compID)
{
UDWORD i, maxComponents;
COMPONENT_STATS *psCurrStats;
Expand Down
4 changes: 2 additions & 2 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ static MapFileList listMapFiles()
PHYSFS_freeList(filelist);
if (unsafe < 2)
{
filtered.push_back(realFileName.c_str());
filtered.push_back(realFileName);
}
PHYSFS_removeFromSearchPath(realFilePathAndName.c_str());
}
Expand Down Expand Up @@ -668,7 +668,7 @@ bool buildMapList()
mapmod = CheckInMap(realFilePathAndName.c_str(), "WZMap", "WZMap/multiplay");
}

CurrentMap.MapName = realFileName.c_str();
CurrentMap.MapName = realFileName;
CurrentMap.isMapMod = mapmod;
WZ_Maps.push_back(CurrentMap);
}
Expand Down
5 changes: 1 addition & 4 deletions src/qtscriptdebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,6 @@ bool jsDebugShutdown()

void jsDebugCreate(const MODELMAP &models, QStandardItemModel *triggerModel)
{
if (globalDialog)
{
delete globalDialog;
}
delete globalDialog;
globalDialog = new ScriptDebugger(models, triggerModel);
}

0 comments on commit e57b3ab

Please sign in to comment.