Skip to content

Commit

Permalink
Silence cppcheck warnings in mythgame (minor)
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartm committed Aug 23, 2011
1 parent 68a3ebc commit 54a6066
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 37 deletions.
8 changes: 7 additions & 1 deletion mythplugins/mythgame/mythgame/gamedetails.cpp
Expand Up @@ -12,7 +12,13 @@

GameDetailsPopup::GameDetailsPopup(MythScreenStack *parent,
const RomInfo *romInfo)
: MythScreenType (parent, "gamedetailspopup")
: MythScreenType (parent, "gamedetailspopup"),
m_romInfo(romInfo), m_id(""), m_retObject(NULL),
m_gameName(NULL), m_gameType(NULL), m_romName(NULL),
m_crc(NULL), m_romPath(NULL), m_genre(NULL),
m_year(NULL), m_country(NULL), m_plot(NULL),
m_publisher(NULL), m_allSystems(NULL), m_fanartImage(NULL),
m_boxImage(NULL), m_playButton(NULL), m_doneButton(NULL)
{
m_romInfo = romInfo;
}
Expand Down
45 changes: 21 additions & 24 deletions mythplugins/mythgame/mythgame/gamehandler.cpp
Expand Up @@ -318,12 +318,12 @@ static void UpdateGameCounts(QStringList updatelist)
QString System = query.value(1).toString();
int spandisks = query.value(2).toInt();
QString GameName = query.value(3).toString();
int extlength = 0;

basename = RomName;

if (spandisks)
{
int extlength = 0;
pos = RomName.lastIndexOf(".");
if (pos > 1)
{
Expand Down Expand Up @@ -517,38 +517,35 @@ void GameHandler::VerifyGameDB(GameHandler *handler)
m_progressDlg->SetTotal(query.size());

// For every file we know about, check to see if it still exists.
if (query.isActive() && query.size() > 0)
while (query.next())
{
while (query.next())
QString RomName = query.value(0).toString();
QString RomPath = query.value(1).toString();
QString GameName = query.value(2).toString();
if (RomName != QString::null)
{
QString RomName = query.value(0).toString();
QString RomPath = query.value(1).toString();
QString GameName = query.value(2).toString();
if (RomName != QString::null)
if ((iter = m_GameMap.find(RomName)) != m_GameMap.end())
{
if ((iter = m_GameMap.find(RomName)) != m_GameMap.end())
{
// If it's both on disk and in the database we're done with it.
m_GameMap.erase(iter);
}
else
{
// If it's only in the database add it to our list and mark it for
// removal.
m_GameMap[RomName] = GameScan(RomName,RomPath + "/" + RomName,inDatabase,
GameName,RomPath);
}
// If it's both on disk and in the database we're done with it.
m_GameMap.erase(iter);
}
else
{
// If it's only in the database add it to our list and mark it for
// removal.
m_GameMap[RomName] = GameScan(RomName,RomPath + "/" + RomName,inDatabase,
GameName,RomPath);
}
if (m_progressDlg)
m_progressDlg->SetProgress(++counter);
}
if (m_progressDlg)
m_progressDlg->SetProgress(++counter);
}

if (m_progressDlg)
{
m_progressDlg->Close();
m_progressDlg = NULL;
}
}
}

// Recurse through the directory and gather a count on how many files there are to process.
Expand Down Expand Up @@ -722,7 +719,7 @@ void GameHandler::processGames(GameHandler *handler)
if (busyDialog->Create())
popupStack->AddScreen(busyDialog, false);
else
delete m_progressDlg;
delete busyDialog;

m_GameMap[handler->SystemCmdLine()] =
GameScan(handler->SystemCmdLine(),
Expand All @@ -739,7 +736,7 @@ void GameHandler::processGames(GameHandler *handler)
}
else
{
QString message = QObject::tr("Scanning for %1 game(s)...")
QString message = QObject::tr("Scanning for %1 games...")
.arg(handler->SystemName());
CreateProgress(message);

Expand Down
1 change: 0 additions & 1 deletion mythplugins/mythgame/mythgame/gamescan.h
Expand Up @@ -86,7 +86,6 @@ class GameScanner : public QObject

private:
GameScannerThread *m_scanThread;
bool m_cancel;
};

#endif
12 changes: 10 additions & 2 deletions mythplugins/mythgame/mythgame/gameui.cpp
Expand Up @@ -42,8 +42,16 @@ class GameTreeInfo
Q_DECLARE_METATYPE(GameTreeInfo *)

GameUI::GameUI(MythScreenStack *parent)
: MythScreenType(parent, "GameUI"), m_busyPopup(0),
m_scanner(NULL)
: MythScreenType(parent, "GameUI"),
m_showHashed(false), m_gameShowFileName(0),
m_gameTree(NULL), m_favouriteNode(NULL),
m_busyPopup(0),
m_gameUITree(NULL), m_gameTitleText(NULL),
m_gameSystemText(NULL), m_gameYearText(NULL),
m_gameGenreText(NULL), m_gamePlotText(NULL),
m_gameFavouriteState(NULL), m_gameImage(NULL),
m_fanartImage(NULL), m_boxImage(NULL),
m_scanner(NULL)
{
m_popupStack = GetMythMainWindow()->GetStack("popup stack");

Expand Down
1 change: 0 additions & 1 deletion mythplugins/mythgame/mythgame/gameui.h
Expand Up @@ -71,7 +71,6 @@ class GameUI : public MythScreenType
private:
bool m_showHashed;
int m_gameShowFileName;
QTimer *timer;

MythGenericTree *m_gameTree;
MythGenericTree *m_favouriteNode;
Expand Down
15 changes: 9 additions & 6 deletions mythplugins/mythgame/mythgame/rom_metadata.cpp
Expand Up @@ -12,16 +12,19 @@ static int calcOffset(QString GameType, uLong filesize) {

result = 0;

if (GameType == "NES") {
if (GameType == "NES")
{
result = 16;
}
else if (GameType == "SNES") {
else if (GameType == "SNES")
{
rom_size = (filesize / 0x2000) * 0x2000;

if (rom_size < filesize)
result = filesize - rom_size;
}
else if (GameType == "PCE") {
else if (GameType == "PCE")
{
if (filesize & 0x0FFF)
result = filesize & 0x0FFF;

Expand All @@ -30,7 +33,8 @@ static int calcOffset(QString GameType, uLong filesize) {
return result;
}

static QString crcStr(uLong crc) {
static QString crcStr(uLong crc)
{
QString tmpcrc("");

tmpcrc = QString("%1").arg( crc, 0, 16 );
Expand All @@ -51,7 +55,6 @@ QString crcinfo(QString romname, QString GameType, QString *key, RomDBMap *romDB
QString crcRes;
char filename_inzip[256];
unz_file_info file_info;
int err;
int offset;
unzFile zf;
int blocksize;
Expand All @@ -70,7 +73,7 @@ QString crcinfo(QString romname, QString GameType, QString *key, RomDBMap *romDB
{
if (unzOpenCurrentFile(zf) == UNZ_OK)
{
err = unzGetCurrentFileInfo(zf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
unzGetCurrentFileInfo(zf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);

offset = calcOffset(GameType, file_info.uncompressed_size);

Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythgame/mythgame/rom_metadata.h
Expand Up @@ -8,7 +8,7 @@

class RomData
{
public:
public:
RomData(QString lgenre = "", QString lyear = "",
QString lcountry = "", QString lgamename = "",
QString ldescription = "", QString lpublisher = "",
Expand All @@ -33,7 +33,7 @@ class RomData
QString Platform() const { return platform; }
QString Version() const { return version; }

private:
private:
QString genre;
QString year;
QString country;
Expand Down

0 comments on commit 54a6066

Please sign in to comment.