summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKris De Gussem <kris.degussem@gmail.com>2011-12-04 10:10:12 +0000
committerKris <Kris.De.Gussem@hotmail.com>2011-12-04 10:10:12 +0000
commit568092089e052882df7f160a3ba8bec9e275c437 (patch)
tree666794c026a0ae898fd3de91ae9c5814848e6c47 /src
parentGerman translation update (diff)
downloadinkscape-568092089e052882df7f160a3ba8bec9e275c437.tar.gz
inkscape-568092089e052882df7f160a3ba8bec9e275c437.zip
cppcheck
(bzr r10759)
Diffstat (limited to 'src')
-rw-r--r--src/dom/css.h4
-rw-r--r--src/dom/lsimpl.h16
-rw-r--r--src/dom/odf/odfdocument.cpp4
-rw-r--r--src/dom/svgreader.h13
-rw-r--r--src/dom/traversal.h13
-rw-r--r--src/dom/util/ziptool.cpp45
-rw-r--r--src/dom/util/ziptool.h2
-rw-r--r--src/dom/xmlreader.cpp30
-rw-r--r--src/dom/xmlreader.h21
-rw-r--r--src/dom/xmlwriter.cpp4
-rw-r--r--src/dom/xmlwriter.h13
-rw-r--r--src/dom/xpathparser.cpp2
-rw-r--r--src/dom/xpathparser.h19
-rw-r--r--src/xml/repr-io.cpp4
14 files changed, 111 insertions, 79 deletions
diff --git a/src/dom/css.h b/src/dom/css.h
index d9c124447..2776b6d20 100644
--- a/src/dom/css.h
+++ b/src/dom/css.h
@@ -1636,6 +1636,10 @@ public:
*/
CSSPrimitiveValue &operator=(const CSSPrimitiveValue &other)
{
+ if(this == &other)
+ {
+ return *this;
+ }
primitiveType = other.primitiveType;
doubleValue = other.doubleValue;
stringValue = other.stringValue;
diff --git a/src/dom/lsimpl.h b/src/dom/lsimpl.h
index 621a5577a..fcfd42a4b 100644
--- a/src/dom/lsimpl.h
+++ b/src/dom/lsimpl.h
@@ -100,13 +100,18 @@ public:
/**
*
*/
- LSParserImpl()
+ LSParserImpl() :
+ reader(),
+ filter(0)
{}
/**
*
*/
- LSParserImpl(const LSParserImpl &other) : LSParser(other)
+ LSParserImpl(const LSParserImpl &other) :
+ LSParser(other),
+ reader(),
+ filter(0)
{}
/**
@@ -214,9 +219,12 @@ public:
/**
*
*/
- LSSerializerImpl()
+ LSSerializerImpl() :
+ outbuf(),
+ indent(0),
+ domConfig(0),
+ filter(0)
{
- indent = 0;
}
/**
diff --git a/src/dom/odf/odfdocument.cpp b/src/dom/odf/odfdocument.cpp
index 50af90f6c..1e7a61e4e 100644
--- a/src/dom/odf/odfdocument.cpp
+++ b/src/dom/odf/odfdocument.cpp
@@ -110,7 +110,9 @@ void ImageData::setData(const std::vector<unsigned char> &buf)
/**
*
*/
-OdfDocument::OdfDocument()
+OdfDocument::OdfDocument() :
+ content(0),
+ images()
{
}
diff --git a/src/dom/svgreader.h b/src/dom/svgreader.h
index 3d66ce507..3178293fd 100644
--- a/src/dom/svgreader.h
+++ b/src/dom/svgreader.h
@@ -65,14 +65,11 @@ public:
/**
*
*/
- SVGReader()
- {
- }
-
- /**
- *
- */
- SVGReader(const SVGReader &/*other*/)
+ SVGReader() :
+ parsebuf(),
+ parselen(0),
+ lastPosition(0),
+ doc(0)
{
}
diff --git a/src/dom/traversal.h b/src/dom/traversal.h
index 0cade9576..13850f78e 100644
--- a/src/dom/traversal.h
+++ b/src/dom/traversal.h
@@ -286,7 +286,11 @@ public:
/**
*
*/
- NodeIterator() {}
+ NodeIterator() :
+ whatToShow(0),
+ filter(),
+ expandEntityReferences(0)
+ {}
/**
*
@@ -485,7 +489,12 @@ public:
/**
*
*/
- TreeWalker() {}
+ TreeWalker() :
+ whatToShow(0),
+ filter(),
+ expandEntityReferences(0),
+ currentNode(0)
+ {}
/**
*
diff --git a/src/dom/util/ziptool.cpp b/src/dom/util/ziptool.cpp
index 0b13f66ba..081bcbbc4 100644
--- a/src/dom/util/ziptool.cpp
+++ b/src/dom/util/ziptool.cpp
@@ -302,7 +302,12 @@ private:
/**
*
*/
-Inflater::Inflater()
+Inflater::Inflater() :
+ dest(),
+ src(),
+ srcPos(0),
+ bitBuf(0),
+ bitCnt(0)
{
}
@@ -800,7 +805,7 @@ bool Inflater::inflate(std::vector<unsigned char> &destination,
//########################################################################
-
+#define DEFLATER_BUF_SIZE 32768
class Deflater
{
public:
@@ -862,14 +867,14 @@ private:
bool compress();
+ std::vector<unsigned char> compressed;
+
std::vector<unsigned char> uncompressed;
std::vector<unsigned char> window;
unsigned int windowPos;
- std::vector<unsigned char> compressed;
-
//#### Output
unsigned int outputBitBuf;
unsigned int outputNrBits;
@@ -887,9 +892,9 @@ private:
//#### Huffman Encode
void encodeLiteralStatic(unsigned int ch);
- unsigned char windowBuf[32768];
+ unsigned char windowBuf[DEFLATER_BUF_SIZE];
//assume 32-bit ints
- unsigned int windowHashBuf[32768];
+ unsigned int windowHashBuf[DEFLATER_BUF_SIZE];
};
@@ -919,11 +924,17 @@ Deflater::~Deflater()
*/
void Deflater::reset()
{
- outputBitBuf = 0;
- outputNrBits = 0;
- window.clear();
compressed.clear();
uncompressed.clear();
+ window.clear();
+ windowPos = 0;
+ outputBitBuf = 0;
+ outputNrBits = 0;
+ for (int k=0; k<DEFLATER_BUF_SIZE; k++)
+ {
+ windowBuf[k]=0;
+ windowHashBuf[k]=0;
+ }
}
/**
@@ -1415,7 +1426,12 @@ bool Deflater::compress()
/**
* Constructor
*/
-GzipFile::GzipFile()
+GzipFile::GzipFile() :
+ data(),
+ fileName(),
+ fileBuf(),
+ fileBufPos(0),
+ compressionMethod(0)
{
}
@@ -1883,6 +1899,7 @@ ZipEntry::ZipEntry()
{
crc = 0L;
compressionMethod = 8;
+ position = 0;
}
/**
@@ -1895,6 +1912,7 @@ ZipEntry::ZipEntry(const std::string &fileNameArg,
compressionMethod = 8;
fileName = fileNameArg;
comment = commentArg;
+ position = 0;
}
/**
@@ -2124,9 +2142,12 @@ unsigned long ZipEntry::getPosition()
/**
* Constructor
*/
-ZipFile::ZipFile()
+ZipFile::ZipFile() :
+ entries(),
+ fileBuf(),
+ fileBufPos(0),
+ comment()
{
-
}
/**
diff --git a/src/dom/util/ziptool.h b/src/dom/util/ziptool.h
index 47e669962..dbae8ac60 100644
--- a/src/dom/util/ziptool.h
+++ b/src/dom/util/ziptool.h
@@ -216,8 +216,6 @@ private:
#endif
;
- unsigned long crc;
-
std::vector<unsigned char> fileBuf;
unsigned long fileBufPos;
diff --git a/src/dom/xmlreader.cpp b/src/dom/xmlreader.cpp
index 501da6193..29519d592 100644
--- a/src/dom/xmlreader.cpp
+++ b/src/dom/xmlreader.cpp
@@ -950,25 +950,31 @@ XmlReader::loadFile(const DOMString &fileName)
/**
*
*/
-XmlReader::XmlReader()
+XmlReader::XmlReader() :
+ document(),
+ parsebuf(),
+ keepGoing(false),
+ parseAsData(false),
+ pos(0),
+ len(0),
+ lineNr(1),
+ colNr(0)
{
- len = 0;
- lineNr = 1;
- colNr = 0;
- parseAsData = false;
- keepGoing = false;
}
/**
*
*/
-XmlReader::XmlReader(bool parseAsDataArg)
+XmlReader::XmlReader(bool parseAsDataArg) :
+ document(),
+ parsebuf(),
+ keepGoing(false),
+ parseAsData(parseAsDataArg),
+ pos(0),
+ len(0),
+ lineNr(1),
+ colNr(0)
{
- len = 0;
- lineNr = 1;
- colNr = 0;
- parseAsData = parseAsDataArg;
- keepGoing = false;
}
diff --git a/src/dom/xmlreader.h b/src/dom/xmlreader.h
index 7ab6de826..f45601d33 100644
--- a/src/dom/xmlreader.h
+++ b/src/dom/xmlreader.h
@@ -100,30 +100,23 @@ private:
int parseVersion(int pos);
int parseDoctype(int pos);
-
int parseCDATA (int pos, CDATASectionPtr cdata);
int parseComment(int pos, CommentPtr comment);
int parseText(int pos, TextPtr text);
-
int parseEntity(int pos, DOMString &buf);
-
int parseAttributes(int p0, NodePtr node, bool *quickClose);
-
int parseNode(int p0, NodePtr node, int depth);
- bool keepGoing;
- bool parseAsData;
- int pos; //current parse position
- int len; //length of parsed region
- DOMString parsebuf;
-
DOMString loadFile(const DOMString &fileName);
- int lineNr;
- int colNr;
-
DocumentPtr document;
-
+ DOMString parsebuf;
+ bool keepGoing;
+ bool parseAsData;
+ int pos; //current parse position
+ int len; //length of parsed region
+ int lineNr;
+ int colNr;
};
} //namespace dom
diff --git a/src/dom/xmlwriter.cpp b/src/dom/xmlwriter.cpp
index a25dbe0b1..4fda5b5fe 100644
--- a/src/dom/xmlwriter.cpp
+++ b/src/dom/xmlwriter.cpp
@@ -175,7 +175,9 @@ void XmlWriter::writeFile(FILE *f, const NodePtr node)
/**
*
*/
-XmlWriter::XmlWriter()
+XmlWriter::XmlWriter() :
+ indent(0),
+ buf()
{
}
diff --git a/src/dom/xmlwriter.h b/src/dom/xmlwriter.h
index f50c91bc4..ada0be04c 100644
--- a/src/dom/xmlwriter.h
+++ b/src/dom/xmlwriter.h
@@ -50,30 +50,19 @@ namespace dom
class XmlWriter
{
public:
-
XmlWriter();
-
virtual ~XmlWriter();
-
-
void write(const NodePtr node);
-
void writeFile(FILE *f, const NodePtr node);
protected:
-
- int indent;
-
void spaces();
-
void po(const char *str, ...) G_GNUC_PRINTF(2,3);
-
void pos(const DOMString &str);
+ int indent;
DOMString buf;
-
-
};
diff --git a/src/dom/xpathparser.cpp b/src/dom/xpathparser.cpp
index 5fd31c12a..f0e929687 100644
--- a/src/dom/xpathparser.cpp
+++ b/src/dom/xpathparser.cpp
@@ -467,7 +467,7 @@ int XPathParser::lexicalScan()
{
long op = (long)entry->ival;
//according to the disambiguating rule for * in the spec
- if (op == MULTIPLY && lexicalTokens.size() > 0)
+ if (op == MULTIPLY && !lexicalTokens.empty())
{
int ltyp = lexTokType(lexicalTokens.size()-1);
if (ltyp != AMPR && ltyp != DOUBLE_COLON &&
diff --git a/src/dom/xpathparser.h b/src/dom/xpathparser.h
index 041564e21..7e5f774f1 100644
--- a/src/dom/xpathparser.h
+++ b/src/dom/xpathparser.h
@@ -371,9 +371,16 @@ public:
/**
*
*/
- XPathParser()
+ XPathParser() :
+ debug(false),
+ parsebuf(0),
+ parselen(0),
+ position(0),
+ numberString(),
+ number(0),
+ lexicalTokens(),
+ tokens()
{
- debug = false;
}
/**
@@ -781,17 +788,9 @@ private:
* this is executable via execute()
*/
TokenList tokens;
-
-
-
-
};
-
-
-
-
} // namespace xpath
} // namespace dom
} // namespace w3c
diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp
index 39eb2637a..7252845b1 100644
--- a/src/xml/repr-io.cpp
+++ b/src/xml/repr-io.cpp
@@ -82,6 +82,10 @@ public:
instr(0),
gzin(0)
{
+ for (int k=0;k<4;k++)
+ {
+ firstFew[k]=0;
+ }
}
virtual ~XmlSource()
{