Minor code cleanup.

This commit is contained in:
Jim Evins
2017-11-25 16:54:37 -05:00
parent ae76470ea9
commit c6c52a8895
11 changed files with 24 additions and 16 deletions
+10 -1
View File
@@ -60,6 +60,16 @@ find_package (LibZint 2.6 QUIET)
find_package (Qt5Test 5.4 QUIET) find_package (Qt5Test 5.4 QUIET)
#=======================================
# Global compiler options
#=======================================
#
# Uncomment to compile everything with aggressively pedantic options
# (not recommended -- only for testing -- also not portable)
#
#add_compile_options("-Wall" "-Werror" "-Wpedantic")
#======================================= #=======================================
# Unit Testing # Unit Testing
#======================================= #=======================================
@@ -67,7 +77,6 @@ if (Qt5Test_FOUND)
enable_testing () enable_testing ()
endif () endif ()
#======================================= #=======================================
# Subdirectories # Subdirectories
#======================================= #=======================================
+1 -1
View File
@@ -40,7 +40,7 @@ namespace glabels
/// ///
/// Merge Object /// Merge Object
/// ///
struct Merge : QObject class Merge : public QObject
{ {
Q_OBJECT Q_OBJECT
+1 -1
View File
@@ -34,7 +34,7 @@ namespace glabels
/// ///
/// Merge Record /// Merge Record
/// ///
struct Record : public QMap<QString,QString> class Record : public QMap<QString,QString>
{ {
///////////////////////////////// /////////////////////////////////
+1 -1
View File
@@ -35,7 +35,7 @@ namespace glabels
/// ///
/// UndoRedoModel /// UndoRedoModel
/// ///
struct UndoRedoModel : QObject class UndoRedoModel : public QObject
{ {
Q_OBJECT Q_OBJECT
+1
View File
@@ -24,6 +24,7 @@
#include "DrawingPrimitives.h" #include "DrawingPrimitives.h"
#include <list> #include <list>
#include <algorithm>
using namespace glbarcode::Constants; using namespace glbarcode::Constants;
+3 -3
View File
@@ -142,12 +142,12 @@ namespace glbarcode
int sum = 0; int sum = 0;
for ( unsigned int i=0; i < cookedData.size(); i++ ) for ( unsigned int i=0; i < cookedData.size(); i++ )
{ {
int cValue = alphabet.find( toupper( cookedData[i] ) ); size_t cValue = alphabet.find( toupper( cookedData[i] ) );
code += symbols[cValue]; code += symbols[cValue];
code += "i"; code += "i";
sum += cValue; sum += int(cValue);
} }
if ( checksum() ) if ( checksum() )
@@ -190,7 +190,7 @@ namespace glbarcode
{ {
/* determine width and establish horizontal scale, based on original cooked data */ /* determine width and establish horizontal scale, based on original cooked data */
double dataSize = cookedData.size(); double dataSize = double( cookedData.size() );
double minL; double minL;
if ( !checksum() ) if ( !checksum() )
{ {
+1 -1
View File
@@ -294,7 +294,7 @@ namespace
} }
} }
return codewords.size(); return int( codewords.size() );
} }
+2 -2
View File
@@ -216,7 +216,7 @@ namespace glbarcode
double& h ) double& h )
{ {
/* determine width and establish horizontal scale */ /* determine width and establish horizontal scale */
int nModules = 7*(cookedData.size()+1) + 11; int nModules = 7*int(cookedData.size()+1) + 11;
double scale; double scale;
if ( w == 0 ) if ( w == 0 )
@@ -256,7 +256,7 @@ namespace glbarcode
/* now traverse the code string and draw each bar */ /* now traverse the code string and draw each bar */
int nBarsSpaces = codedData.size() - 1; /* coded data has dummy "0" on end. */ int nBarsSpaces = int( codedData.size() - 1 ); /* coded data has dummy "0" on end. */
double xModules = 0; double xModules = 0;
for ( int i = 0; i < nBarsSpaces; i += 2 ) for ( int i = 0; i < nBarsSpaces; i += 2 )
+1 -1
View File
@@ -38,7 +38,7 @@ namespace glabels
/// ///
/// Color Node Type /// Color Node Type
/// ///
struct ColorNode class ColorNode
{ {
///////////////////////////////// /////////////////////////////////
+1 -1
View File
@@ -35,7 +35,7 @@ namespace glabels
/// ///
/// Label Region Type /// Label Region Type
/// ///
struct Region class Region
{ {
///////////////////////////////// /////////////////////////////////
+2 -4
View File
@@ -29,13 +29,13 @@ namespace glabels
{ {
SubstitutionField::SubstitutionField() SubstitutionField::SubstitutionField()
: mNewLine(false), mFormatType(0) : mFormatType(0), mNewLine(false)
{ {
} }
SubstitutionField::SubstitutionField( const QString& string ) SubstitutionField::SubstitutionField( const QString& string )
: mNewLine(false), mFormatType(0) : mFormatType(0), mNewLine(false)
{ {
QStringRef s(&string); QStringRef s(&string);
parse( s, *this ); parse( s, *this );
@@ -197,8 +197,6 @@ namespace glabels
bool SubstitutionField::parseFormatModifier( QStringRef& s, SubstitutionField& field ) bool SubstitutionField::parseFormatModifier( QStringRef& s, SubstitutionField& field )
{ {
bool success = false;
field.mFormat = "%"; field.mFormat = "%";
parseFormatFlags( s, field ); parseFormatFlags( s, field );