Fix several compile issues (#261)
Fixed several code issues. Mostly pedantic compiler warnings. But also a sign issue exposed by newer compilers (#228, #260)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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() );
|
||||
}
|
||||
|
||||
+3
-3
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
|
||||
+2
-1
@@ -31,7 +31,8 @@ namespace glabels
|
||||
/// Copy constructor
|
||||
///
|
||||
Variables::Variables( const Variables& other )
|
||||
: QMap<QString,Variable>(other)
|
||||
: QObject(),
|
||||
QMap<QString,Variable>(other)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user