diff options
| author | Kris De Gussem <kris.degussem@gmail.com> | 2011-11-10 22:23:06 +0000 |
|---|---|---|
| committer | Kris <Kris.De.Gussem@hotmail.com> | 2011-11-10 22:23:06 +0000 |
| commit | 57558641a9819e4da97bc014ac35f9323306ae1f (patch) | |
| tree | 4ef9ae0a5cea8376a1750f58e167088e4629ca6d | |
| parent | lpe: add slider to scalar param optionally (does not work very well yet) (diff) | |
| download | inkscape-57558641a9819e4da97bc014ac35f9323306ae1f.tar.gz inkscape-57558641a9819e4da97bc014ac35f9323306ae1f.zip | |
cppcheck: initialization / warning cleanup
(bzr r10736)
| -rw-r--r-- | src/util/units.cpp | 37 | ||||
| -rw-r--r-- | src/widgets/ege-paint-def.cpp | 10 | ||||
| -rw-r--r-- | src/widgets/sp-color-icc-selector.cpp | 3 | ||||
| -rw-r--r-- | src/xml/repr-css.cpp | 2 |
4 files changed, 29 insertions, 23 deletions
diff --git a/src/util/units.cpp b/src/util/units.cpp index a251dc5db..b79bbc9cc 100644 --- a/src/util/units.cpp +++ b/src/util/units.cpp @@ -17,7 +17,7 @@ namespace Util { class UnitsSAXHandler : public Inkscape::IO::FlatSaxHandler { public: - UnitsSAXHandler(UnitTable *table) : FlatSaxHandler(), tbl(table) {} + UnitsSAXHandler(UnitTable *table); virtual ~UnitsSAXHandler() {} virtual void _startElement(xmlChar const *name, xmlChar const **attrs); @@ -29,6 +29,14 @@ public: Unit unit; }; +UnitsSAXHandler::UnitsSAXHandler(UnitTable *table) : + FlatSaxHandler(), + tbl(table), + primary(0), + skip(0), + unit() +{ +} #define BUFSIZE (255) @@ -70,8 +78,7 @@ UnitTable::~UnitTable() { } /** Add a new unit to the table */ -void -UnitTable::addUnit(Unit const &u, bool primary) { +void UnitTable::addUnit(Unit const &u, bool primary) { _unit_map[u.abbr] = new Unit(u); if (primary) { _primary_unit[u.type] = u.abbr; @@ -79,8 +86,7 @@ UnitTable::addUnit(Unit const &u, bool primary) { } /** Retrieve a given unit based on its string identifier */ -Unit -UnitTable::getUnit(Glib::ustring const &unit_abbr) const { +Unit UnitTable::getUnit(Glib::ustring const &unit_abbr) const { UnitMap::const_iterator iter = _unit_map.find(unit_abbr); if (iter != _unit_map.end()) { return *((*iter).second); @@ -90,8 +96,7 @@ UnitTable::getUnit(Glib::ustring const &unit_abbr) const { } /** Remove a unit definition from the given unit type table */ -bool -UnitTable::deleteUnit(Unit const &u) { +bool UnitTable::deleteUnit(Unit const &u) { if (u.abbr == _primary_unit[u.type]) { // Cannot delete the primary unit type since it's // used for conversions @@ -108,15 +113,13 @@ UnitTable::deleteUnit(Unit const &u) { } /** Returns true if the given string 'name' is a valid unit in the table */ -bool -UnitTable::hasUnit(Glib::ustring const &unit) const { +bool UnitTable::hasUnit(Glib::ustring const &unit) const { UnitMap::const_iterator iter = _unit_map.find(unit); return (iter != _unit_map.end()); } /** Provides an iteratable list of items in the given unit table */ -UnitTable::UnitMap -UnitTable::units(UnitType type) const +UnitTable::UnitMap UnitTable::units(UnitType type) const { UnitMap submap; for (UnitMap::const_iterator iter = _unit_map.begin(); @@ -130,16 +133,14 @@ UnitTable::units(UnitType type) const } /** Returns the default unit abbr for the given type */ -Glib::ustring -UnitTable::primary(UnitType type) const { +Glib::ustring UnitTable::primary(UnitType type) const { return _primary_unit[type]; } /** Merges the contents of the given file into the UnitTable, possibly overwriting existing unit definitions. This loads from a text file */ -bool -UnitTable::loadText(Glib::ustring const &filename) { +bool UnitTable::loadText(Glib::ustring const &filename) { char buf[BUFSIZE]; // Open file for reading @@ -221,8 +222,7 @@ UnitTable::loadText(Glib::ustring const &filename) { return true; } -bool -UnitTable::load(Glib::ustring const &filename) { +bool UnitTable::load(Glib::ustring const &filename) { UnitsSAXHandler handler(this); int result = handler.parseFile( filename.c_str() ); @@ -237,8 +237,7 @@ UnitTable::load(Glib::ustring const &filename) { } /** Saves the current UnitTable to the given file. */ -bool -UnitTable::save(Glib::ustring const &filename) { +bool UnitTable::save(Glib::ustring const &filename) { // open file for writing FILE *f = fopen(filename.c_str(), "w"); diff --git a/src/widgets/ege-paint-def.cpp b/src/widgets/ege-paint-def.cpp index c4325659d..542205b53 100644 --- a/src/widgets/ege-paint-def.cpp +++ b/src/widgets/ege-paint-def.cpp @@ -69,7 +69,8 @@ PaintDef::PaintDef() : r(0), g(0), b(0), - editable(false) + editable(false), + _listeners() { } @@ -79,7 +80,8 @@ PaintDef::PaintDef( ColorType type ) : r(0), g(0), b(0), - editable(false) + editable(false), + _listeners() { switch (type) { case CLEAR: @@ -100,7 +102,8 @@ PaintDef::PaintDef( unsigned int r, unsigned int g, unsigned int b, const std::s r(r), g(g), b(b), - editable(false) + editable(false), + _listeners() { } @@ -125,6 +128,7 @@ PaintDef& PaintDef::operator=( PaintDef const &other ) b = other.b; descr = other.descr; editable = other.editable; + //TODO: _listeners should be assigned a value } return *this; } diff --git a/src/widgets/sp-color-icc-selector.cpp b/src/widgets/sp-color-icc-selector.cpp index 888cc2629..28a317717 100644 --- a/src/widgets/sp-color-icc-selector.cpp +++ b/src/widgets/sp-color-icc-selector.cpp @@ -129,6 +129,8 @@ ColorICCSelector::ColorICCSelector( SPColorSelector* csel ) _updating( FALSE ), _dragging( FALSE ), _fixupNeeded(0), + _fixupBtn(0), + _profileSel(0), _fooCount(0), _fooScales(0), _fooAdj(0), @@ -137,6 +139,7 @@ ColorICCSelector::ColorICCSelector( SPColorSelector* csel ) _fooLabel(0), _fooMap(0), _adj(0), + _slider(0), _sbtn(0), _label(0) #if ENABLE_LCMS diff --git a/src/xml/repr-css.cpp b/src/xml/repr-css.cpp index 8de85c36d..ced4f5da4 100644 --- a/src/xml/repr-css.cpp +++ b/src/xml/repr-css.cpp @@ -307,7 +307,7 @@ sp_repr_css_merge_from_decl(SPCSSAttr *css, CRDeclaration const *const decl) // the additional benefit of respecting the numerical precission set in the SVG Output // preferences. We assume any numerical part comes first (if not, the whole string is copied). std::stringstream ss( value_unquoted ); - double number; + double number = 0; std::string characters; std::string temp; bool number_valid = !(ss >> number).fail(); |
