Skip to content

Commit

Permalink
Fix static warnings - no functional change
Browse files Browse the repository at this point in the history
  • Loading branch information
Isarhamster committed Dec 15, 2024
1 parent cf07686 commit d7cc10d
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 53 deletions.
4 changes: 2 additions & 2 deletions src/database/bitboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,7 @@ int BitBoard::chess960Pos() const
bool n0f = false;
bool n1f = false;
int rf = 0;
int n0s[] = { 0,4,7,9 };
const int n0s[] = { 0,4,7,9 };
for (Square square=a1; square<=h1; ++square)
{
if (pieceAt(square) == WhiteQueen)
Expand Down Expand Up @@ -3246,7 +3246,7 @@ QString BitBoard::toHumanFen() const
w.append(charLists[p].join(","));
}
}
for(Piece p = BlackKing; p != Empty; ++p)
for(Piece p = BlackKing; p <= BlackPawn; ++p)
{
if(charLists.contains(p))
{
Expand Down
2 changes: 1 addition & 1 deletion src/database/ecoinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ QString EcoInfo::formattedScore(const int result[4], int count) const
QChar scoresign[4] = {'*', '+', '=', '-'};
QStringList results;
results << "\\*" << "1-0" << "1/2-1/2" << "0-1";
int order[] = { WhiteWin, Draw, BlackWin, ResultUnknown };
const int order[] = { WhiteWin, Draw, BlackWin, ResultUnknown };
QString format = QString("<a href='result:%1'> &nbsp;%2%3</a>");

for(int j=0;j<4;j++)
Expand Down
5 changes: 5 additions & 0 deletions src/database/openingtree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,14 @@ int OpeningTree::columnCount(const QModelIndex&) const

OpeningTree::OpeningTree(QObject* parent) :
QAbstractTableModel(parent),
m_bRequestPending(false),
m_games(0),
m_sortcolumn(1),
m_order(Qt::DescendingOrder),
m_filter(nullptr),
m_updateFilter(false),
m_sourceIsDatabase(false),
m_bEnd(false),
oupd(*new OpeningTreeThread)
{
m_names << tr("Move") << tr("Count") << tr("Score") << tr("Rating") << tr("Year");
Expand Down
2 changes: 1 addition & 1 deletion src/database/pgndatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ void PgnDatabase::splitTokenList(QVector<QStringRef>& list)
if (!c.isLetterOrNumber() && (c!='.'))
{
// It's a token, not part of a move
if (n>1) list.push_back(t);
list.push_back(t);
start += (n-1);
n = 1;
inNag = true;
Expand Down
46 changes: 9 additions & 37 deletions src/database/playerdatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,7 @@ PartialDate PlayerDatabase::dateOfBirth() const
void PlayerDatabase::setDateOfBirth(const PartialDate& date)
{
m_currentPlayer.setDateOfBirth(date);
if(!m_dirty)
{
m_dirty = true;
}
m_dirty = true;
}

PartialDate PlayerDatabase::dateOfDeath() const
Expand All @@ -370,10 +367,7 @@ PartialDate PlayerDatabase::dateOfDeath() const
void PlayerDatabase::setDateOfDeath(const PartialDate & date)
{
m_currentPlayer.setDateOfDeath(date);
if(!m_dirty)
{
m_dirty = true;
}
m_dirty = true;
}

QString PlayerDatabase::country() const
Expand All @@ -383,10 +377,7 @@ QString PlayerDatabase::country() const
void PlayerDatabase::setCountry(const QString& country)
{
m_currentPlayer.setCountry(country);
if(!m_dirty)
{
m_dirty = true;
}
m_dirty = true;
}

QString PlayerDatabase::title() const
Expand All @@ -396,10 +387,7 @@ QString PlayerDatabase::title() const
void PlayerDatabase::setTitle(const QString& title)
{
m_currentPlayer.setTitle(title);
if(!m_dirty)
{
m_dirty = true;
}
m_dirty = true;
}

int PlayerDatabase::firstEloListIndex()
Expand Down Expand Up @@ -442,20 +430,13 @@ int PlayerDatabase::highestElo() const
void PlayerDatabase::setElo(const int year, const int listIndex, const int elo)
{
m_currentPlayer.setElo(eloList(year, listIndex), elo);
if(!m_dirty)
{
m_dirty = true;
}
m_dirty = true;
}


void PlayerDatabase::setEstimatedElo(const int elo)
{
m_currentPlayer.setEstimatedElo(elo);
if(!m_dirty)
{
m_dirty = true;
}
m_dirty = true;
}

bool PlayerDatabase::hasPhoto() const
Expand All @@ -469,10 +450,7 @@ QImage PlayerDatabase::photo() const
void PlayerDatabase::setPhoto(const QImage& img)
{
m_currentPlayer.setPhoto(img);
if(!m_dirty)
{
m_dirty = true;
}
m_dirty = true;
}

bool PlayerDatabase::hasBiography() const
Expand All @@ -486,18 +464,12 @@ QString PlayerDatabase::biography() const
void PlayerDatabase::setBiography(const QString& s)
{
m_currentPlayer.setBiography(s);
if(!m_dirty)
{
m_dirty = true;
}
m_dirty = true;
}
void PlayerDatabase::appendToBiography(const QString& s)
{
m_currentPlayer.appendToBiography(s);
if(!m_dirty)
{
m_dirty = true;
}
m_dirty = true;
}


Expand Down
2 changes: 1 addition & 1 deletion src/database/playerinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ QString PlayerInfo::formattedScore(const int result[4], int count, QString ref,
QString score = "<b>";
QChar scoresign[4] = {'*', '+', '=', '-'};
QString format = "%1%2'>%3%4</a>";
QStringList modes;

score += format.arg(ref, (mode ? "1-0":"0-1")).arg(scoresign[WhiteWin]).arg(result[WhiteWin]);
score += " &nbsp;";
score += format.arg(ref, "1/2-1/2").arg(scoresign[Draw]).arg(result[Draw]);
Expand Down
2 changes: 1 addition & 1 deletion src/database/polyglotdatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ bool PolyglotDatabase::get_move_entry(Move m, book_entry& entry) const
if (m.isNullMove() || !m.isLegal())
return false;
int promote = get_promotion(m);
int move = MoveNone;
int move;
if (m.isCastling())
{
move = make_castling_move(m);
Expand Down
1 change: 0 additions & 1 deletion src/database/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class Settings : public QSettings
{
Q_OBJECT
public:
enum {Show = 1} LayoutFlags;
Settings();
Settings(const QString &fileName);
void initialize();
Expand Down
2 changes: 1 addition & 1 deletion src/guess/guess_position.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static const int Infinity = 32000;
static const int KingValue = 10000;
static const int QueenValue = 900;
static const int RookValue = 500;
static const int BishopValue = 300;
static const int BishopValue = 310;
static const int KnightValue = 300;
static const int PawnValue = 100;

Expand Down
4 changes: 3 additions & 1 deletion src/gui/engineoptionmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
#endif // _MSC_VER

EngineOptionModel::EngineOptionModel(QObject *parent) :
QStandardItemModel(parent)
QStandardItemModel(parent),
m_pValueMap(0),
m_pOptionDataList(0)
{
m_columnNames << tr("Name") << tr("Default") << tr("Min") << tr("Max") << tr("Value");
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2382,7 +2382,7 @@ void MainWindow::slotHttpDone(QNetworkReply *reply)
if(answer.indexOf(rx, 0, &match) >= 0)
{
QStringList list = match.capturedTexts();
if (list.length() >= 3)
if (list.length() > 3)
{
int major = list.at(1).toInt();
int minor = list.at(2).toInt();
Expand Down
2 changes: 1 addition & 1 deletion src/gui/mainwindowactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3069,7 +3069,7 @@ void MainWindow::copyGames(QString destination, QList<GameId> indexes, QString s
if (!pSrcDBInfo || indexes.isEmpty()) return; // Nothing to copy
if (pDestDBInfo == pSrcDBInfo) return; // Do not create local copy

if (pDestDBInfo && pDestDBInfo->isValid() && pSrcDBInfo && pSrcDBInfo->isValid())
if (pDestDBInfo && pDestDBInfo->isValid() && pSrcDBInfo->isValid())
{
if (pDestDBInfo==m_currentDatabase)
{
Expand Down
3 changes: 2 additions & 1 deletion src/gui/ooo/converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ QTextCharFormat Style::textFormat() const {
Converter::Converter() :
m_TextDocument(nullptr),
m_Cursor(nullptr),
m_StyleInformation(nullptr)
m_StyleInformation(nullptr),
firstTime(false)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/gui/testadapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

TestAdapter::TestAdapter(QObject *parent) : QObject(parent)
{

result = 0;
}

bool TestAdapter::dispatchTests()
Expand Down
7 changes: 4 additions & 3 deletions src/gui/textedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -862,10 +862,11 @@ bool PasteTextEdit::eventFilter(QObject *obj, QEvent *event)

void PasteTextEdit::keyPressEvent(QKeyEvent* event)
{
if (!event) return;
// Pressing Return is ignored
if(event && event->type() == QEvent::KeyRelease &&
(event->key() == Qt::Key_Return ||
event->key() == Qt::Key_Enter))
if(event->type() == QEvent::KeyRelease &&
(event->key() == Qt::Key_Return ||
event->key() == Qt::Key_Enter))
{
QKeyEvent event2(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier);
QTextEdit::keyPressEvent(&event2);
Expand Down

0 comments on commit d7cc10d

Please sign in to comment.