From cc47679b22682465fb5cda305b6d301485944df0 Mon Sep 17 00:00:00 2001 From: joncruz Date: Mon, 2 Oct 2006 08:34:42 +0000 Subject: [PATCH] Cleaned up virtual destructor problem and compile warnings. --- src/extension/internal/libwpg/WPG1Parser.cpp | 7 +++- src/extension/internal/libwpg/WPG2Parser.cpp | 33 ++++++++++++++++--- .../internal/libwpg/WPGPaintInterface.h | 1 + src/extension/internal/libwpg/WPGStream.h | 1 + src/extension/internal/libwpg/WPGXParser.h | 1 + 5 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/extension/internal/libwpg/WPG1Parser.cpp b/src/extension/internal/libwpg/WPG1Parser.cpp index 372aa052c..9f4a05148 100644 --- a/src/extension/internal/libwpg/WPG1Parser.cpp +++ b/src/extension/internal/libwpg/WPG1Parser.cpp @@ -191,6 +191,9 @@ bool WPG1Parser::parse() int recordType = readU8(); int length = readVariableLengthInteger(); long nextPos = m_input->tell() + length; +#if !defined(DEBUG) + (void)recordPos; +#endif // !defined(DEBUG) // search function to handler this record int index = -1; @@ -236,6 +239,8 @@ void WPG1Parser::handleStartWPG() { unsigned char version = readU8(); unsigned char bitFlags = readU8(); + (void)version; + (void)bitFlags; m_width = readU16(); m_height = readU16(); @@ -260,7 +265,7 @@ void WPG1Parser::handleColormap() unsigned numEntries = readU16(); WPG_DEBUG_MSG(("Colormap\n")); - for(int i = 0; i < numEntries; i++) + for(int i = 0; i < static_cast(numEntries); i++) { WPGColor color; color.red = readU8(); diff --git a/src/extension/internal/libwpg/WPG2Parser.cpp b/src/extension/internal/libwpg/WPG2Parser.cpp index 8b6a4a674..e0b642f0e 100644 --- a/src/extension/internal/libwpg/WPG2Parser.cpp +++ b/src/extension/internal/libwpg/WPG2Parser.cpp @@ -181,12 +181,12 @@ public: rotate(false), hasObjectId(false), editLock(false), - objectId(0), - lockFlags(0), windingRule(false), filled(false), closed(false), framed(true), + objectId(0), + lockFlags(0), rotationAngle(0), sxcos(0), sycos(0), @@ -319,6 +319,10 @@ bool WPG2Parser::parse() int extension = readVariableLengthInteger(); int length = readVariableLengthInteger(); long nextPos = m_input->tell() + length; +#if !defined(DEBUG) + (void)recordPos; + (void)recordClass; +#endif // !defined(DEBUG) // inside a subgroup, one less sub record if(!m_groupStack.empty()) @@ -395,6 +399,7 @@ bool WPG2Parser::parse() return m_success; } +#if defined(DEBUG) static const char* describePrecision(unsigned char precision) { const char* result = "Unknown"; @@ -427,6 +432,7 @@ static const char* describeGradient(unsigned char gradientType) } return result; } +#endif // defined(DEBUG) #define TO_DOUBLE(x) ( (m_doublePrecision) ? ((double)(x)/65536.0) : (double)(x) ) #define TRANSFORM_XY(x,y) { m_matrix.transform((x),(y)); (x)-= m_xofs; (y)-= m_yofs; (y)=m_height-(y); } @@ -460,6 +466,12 @@ void WPG2Parser::handleStartWPG() long viewportY1 = (m_doublePrecision) ? readS32() : readS16(); long viewportX2 = (m_doublePrecision) ? readS32() : readS16(); long viewportY2 = (m_doublePrecision) ? readS32() : readS16(); +#if !defined(DEBUG) + (void)viewportX1; + (void)viewportY1; + (void)viewportX2; + (void)viewportY2; +#endif // !defined(DEBUG) long imageX1 = (m_doublePrecision) ? readS32() : readS16(); long imageY1 = (m_doublePrecision) ? readS32() : readS16(); @@ -516,7 +528,7 @@ void WPG2Parser::handleStartWPG() // create default pen styles int styleNo = 0; - for(int i = 0; i < sizeof(WPG2_defaultPenDashes)/sizeof(WPG2_defaultPenDashes[0]);) + for(int i = 0; i < static_cast(sizeof(WPG2_defaultPenDashes)/sizeof(WPG2_defaultPenDashes[0]));) { int segments = 2 * WPG2_defaultPenDashes[i++]; if(segments == 0) break; @@ -624,7 +636,7 @@ void WPG2Parser::handleDPColorPalette() unsigned startIndex = readU16(); unsigned numEntries = readU16(); - for(int i = 0; i < numEntries; i++) + for(int i = 0; i < static_cast(numEntries); i++) { WPGColor color; color.red = readU16() >> 8 ; @@ -730,6 +742,10 @@ void WPG2Parser::handleBrushGradient() unsigned flag = readU16(); bool granular = (flag & (1<<6)) == 1; bool anchor = (flag & (1<<7)) == 1; +#if !defined(DEBUG) + (void)granular; + (void)anchor; +#endif // !defined(DEBUG) // TODO: get gradient extent @@ -752,6 +768,10 @@ void WPG2Parser::handleDPBrushGradient() unsigned flag = readU16(); bool granular = (flag & (1<<6)) == 1; bool anchor = (flag & (1<<7)) == 1; +#if !defined(DEBUG) + (void)granular; + (void)anchor; +#endif // !defined(DEBUG) // TODO: get gradient extent (in double precision) @@ -923,6 +943,9 @@ void WPG2Parser::handleDPBrushBackColor() void WPG2Parser::handleBrushPattern() { unsigned int pattern = readU16(); +#if !defined(DEBUG) + (void)pattern; +#endif // !defined(DEBUG) // TODO @@ -1081,7 +1104,7 @@ void WPG2Parser::handlePolycurve() WPGPointArray vertices; WPGPointArray controlPoints; - for(int i = 0; i < count; i++ ) + for(int i = 0; i < static_cast(count); i++ ) { long ix = (m_doublePrecision) ? readS32() : readS16(); long iy = (m_doublePrecision) ? readS32() : readS16(); diff --git a/src/extension/internal/libwpg/WPGPaintInterface.h b/src/extension/internal/libwpg/WPGPaintInterface.h index 71f4a7adf..7866bd448 100644 --- a/src/extension/internal/libwpg/WPGPaintInterface.h +++ b/src/extension/internal/libwpg/WPGPaintInterface.h @@ -38,6 +38,7 @@ namespace libwpg class WPGPaintInterface { public: + virtual ~WPGPaintInterface() {} // none of the other callback functions will be called before this function is called virtual void startDocument(double width, double height) = 0; diff --git a/src/extension/internal/libwpg/WPGStream.h b/src/extension/internal/libwpg/WPGStream.h index 1b6a46c0a..781c69854 100644 --- a/src/extension/internal/libwpg/WPGStream.h +++ b/src/extension/internal/libwpg/WPGStream.h @@ -32,6 +32,7 @@ namespace libwpg class WPGInputStream { public: + virtual ~WPGInputStream() {} virtual unsigned char getc() = 0; virtual long read(long n, char* buffer) = 0; virtual long tell() = 0; diff --git a/src/extension/internal/libwpg/WPGXParser.h b/src/extension/internal/libwpg/WPGXParser.h index d98fd0ba4..71c78d2c0 100644 --- a/src/extension/internal/libwpg/WPGXParser.h +++ b/src/extension/internal/libwpg/WPGXParser.h @@ -40,6 +40,7 @@ class WPGXParser { public: WPGXParser(WPGInputStream *input, WPGPaintInterface* painter); + virtual ~WPGXParser() {} virtual bool parse() = 0; unsigned char readU8(); -- 2.30.2