diff --git a/CMakeLists.txt b/CMakeLists.txt index d79bbbc..9e5aa9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,7 +140,17 @@ find_package (Qt5Test 5.6 QUIET) if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") # # Uncomment to compile everything with aggressively pedantic options - # (not recommended -- only for testing -- also not portable) + # (not recommended -- only for testing) + # + #add_compile_options("-Wall" "-Wextra" "-Wpedantic" "-Wno-unused-parameter" "-Werror") + + # Uncomment to always compile with debug symbols + add_compile_options("-g") +endif () +if (${CMAKE_CXX_COMPILER_ID} MATCHES "^.*Clang$") # "Clang", "AppleClang", etc. + # + # Uncomment to compile everything with aggressively pedantic options + # (not recommended -- only for testing) # #add_compile_options("-Wall" "-Wextra" "-Wpedantic" "-Wno-unused-parameter" "-Werror") diff --git a/backends/barcode/Zint.cpp b/backends/barcode/Zint.cpp index bcfc62d..c6f8b31 100644 --- a/backends/barcode/Zint.cpp +++ b/backends/barcode/Zint.cpp @@ -28,9 +28,6 @@ namespace { - const double FONT_SCALE = 0.9; - const int W_PTS_DEFAULT = 144; - const int H_PTS_DEFAULT = 72; const double TWO_DIVIDED_BY_SQRT3 = 1.15470053837925152902; } diff --git a/glabels/ColorPaletteItem.cpp b/glabels/ColorPaletteItem.cpp index 7b4e4f8..e62c8df 100644 --- a/glabels/ColorPaletteItem.cpp +++ b/glabels/ColorPaletteItem.cpp @@ -36,8 +36,6 @@ namespace glabels const int wSwatch = 25; const int hSwatch = 25; - const int hoverBgOutlineWidthPixels = 1; - const int outlineWidthPixels = 1; } diff --git a/glabels/LabelEditor.cpp b/glabels/LabelEditor.cpp index 8c8db9d..34e8ad1 100644 --- a/glabels/LabelEditor.cpp +++ b/glabels/LabelEditor.cpp @@ -823,7 +823,8 @@ namespace glabels /* * Calculate new size */ - double w, h; + double w = 0.0; + double h = 0.0; switch ( mResizeHandleLocation ) { case model::Handle::NW: diff --git a/glabels/TemplatePicker.cpp b/glabels/TemplatePicker.cpp index bc90f96..4fa3791 100644 --- a/glabels/TemplatePicker.cpp +++ b/glabels/TemplatePicker.cpp @@ -130,7 +130,7 @@ namespace glabels { model::Settings::setTemplatePickerMode( mode ); - for ( unsigned int i = 0; i < count(); i++ ) + for ( int i = 0; i < count(); i++ ) { if (auto* tItem = dynamic_cast(item(i))) { @@ -182,7 +182,7 @@ namespace glabels bool isoMask, bool usMask, bool otherMask, bool anyCategory, const QStringList& categoryIds ) { - for ( unsigned int i = 0; i < count(); i++ ) + for ( int i = 0; i < count(); i++ ) { if (auto* tItem = dynamic_cast(item(i))) { @@ -232,7 +232,7 @@ namespace glabels /// void TemplatePicker::applyFilter( const QStringList& names ) { - for ( unsigned int i = 0; i < count(); i++ ) + for ( int i = 0; i < count(); i++ ) { if (auto *tItem = dynamic_cast(item(i))) { diff --git a/model/Distance.cpp b/model/Distance.cpp index aa46073..e7c631e 100644 --- a/model/Distance.cpp +++ b/model/Distance.cpp @@ -149,6 +149,9 @@ namespace glabels case Units::PC: d = pc(); break; + default: + d = mDPts; + break; } return d; @@ -176,6 +179,9 @@ namespace glabels case Units::PC: d = pc(); break; + default: + d = mDPts; + break; } return d; diff --git a/model/ParserState.cpp b/model/ParserState.cpp index 725eef0..2e3dbe4 100644 --- a/model/ParserState.cpp +++ b/model/ParserState.cpp @@ -30,7 +30,7 @@ namespace glabels { ParserState::ParserState( const QString& string, - unsigned int pos ) + qsizetype pos ) : mString(&string), mPos( pos ) { @@ -38,7 +38,7 @@ namespace glabels QChar - ParserState::operator[]( unsigned int i ) const + ParserState::operator[]( qsizetype i ) const { auto ii = mPos + i; if ( ii < mString->size() ) @@ -55,7 +55,7 @@ namespace glabels bool ParserState::isNextSubString( const QString& s ) const { - for ( unsigned int i = 0; i < s.size(); i++ ) + for ( qsizetype i = 0; i < s.size(); i++ ) { if ( operator[](i) != s[i] ) return false; } @@ -78,7 +78,7 @@ namespace glabels void - ParserState::advanceChars( unsigned int i ) + ParserState::advanceChars( qsizetype i ) { mPos = std::min( mPos + i, mString->size() ); } diff --git a/model/ParserState.h b/model/ParserState.h index d1c15d5..c74a0df 100644 --- a/model/ParserState.h +++ b/model/ParserState.h @@ -35,15 +35,15 @@ namespace glabels public: ParserState() = default; ParserState( const QString& string, - unsigned int pos = 0 ); + qsizetype pos = 0 ); ~ParserState() = default; - QChar operator[]( unsigned int i ) const; + QChar operator[]( qsizetype i ) const; bool isNextSubString( const QString& s ) const; qsizetype pos() const; qsizetype charsLeft() const; - void advanceChars( unsigned int i ); + void advanceChars( qsizetype i ); private: diff --git a/model/Units.cpp b/model/Units.cpp index 2085f30..fb4cc76 100644 --- a/model/Units.cpp +++ b/model/Units.cpp @@ -142,6 +142,8 @@ namespace glabels case Units::PC: idString = "pc"; break; + default: + idString = "pt"; } return idString; @@ -169,6 +171,8 @@ namespace glabels case Units::PC: nameString = tr("picas"); break; + default: + nameString = tr("points"); } return nameString; @@ -196,6 +200,9 @@ namespace glabels case Units::PC: value = 0.01; break; + default: + value = 0.01; + break; } return value; @@ -223,6 +230,9 @@ namespace glabels case Units::PC: digits = 2; break; + default: + digits = 2; + break; } return digits; diff --git a/model/Variables.cpp b/model/Variables.cpp index 401da56..3bfdf93 100644 --- a/model/Variables.cpp +++ b/model/Variables.cpp @@ -31,7 +31,8 @@ namespace glabels /// Copy constructor /// Variables::Variables( const Variables& other ) - : QMap(other) + : QObject(), + QMap(other) { }