From 56f324c297797b41752f0ced24d0c125dc8acfa1 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Mon, 11 Mar 2013 16:57:58 +0100 Subject: fix build warnings / cppcheck ( Bug #1120585 ) (bzr r12191) --- src/extension/internal/odf.cpp | 76 +++++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index 7634c7aa1..47671a8d2 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -4,7 +4,7 @@ * This is an an entry in the extensions mechanism to begin to enable * the inputting and outputting of OpenDocument Format (ODF) files from * within Inkscape. Although the initial implementations will be very lossy - * do to the differences in the models of SVG and ODF, they will hopefully + * due to the differences in the models of SVG and ODF, they will hopefully * improve greatly with time. People should consider this to be a framework * that can be continously upgraded for ever improving fidelity. Potential * developers should especially look in preprocess() and writeTree() to see how @@ -295,11 +295,13 @@ public: @return Structure to access U, S and V. */ - SingularValueDecomposition (const SVDMatrix &mat) + SingularValueDecomposition (const SVDMatrix &mat) : + A (mat), + U (), + s (NULL), + s_size (0), + V () { - A = mat; - s = NULL; - s_size = 0; calculate(); } @@ -1080,14 +1082,16 @@ OdfOutput::preprocess(ZipFile &zf, Inkscape::XML::Node *node) //Now consider items. SPObject *reprobj = SP_ACTIVE_DOCUMENT->getObjectByRepr(node); if (!reprobj) + { return; + } if (!SP_IS_ITEM(reprobj)) - { + { return; - } - SPItem *item = SP_ITEM(reprobj); + } + //SPItem *item = SP_ITEM(reprobj); //### Get SVG-to-ODF transform - Geom::Affine tf = getODFTransform(item); + //Geom::Affine tf = getODFTransform(item); if (nodeName == "image" || nodeName == "svg:image") { @@ -1210,14 +1214,19 @@ bool OdfOutput::writeMeta(ZipFile &zf) time(&tim); std::map::iterator iter; - Glib::ustring creator = "unknown"; + Glib::ustring InkscapeVersion = Glib::ustring("Inkscape.org - ") + Inkscape::version_string; + Glib::ustring creator = InkscapeVersion; iter = metadata.find("dc:creator"); if (iter != metadata.end()) + { creator = iter->second; + } Glib::ustring date = ""; iter = metadata.find("dc:date"); if (iter != metadata.end()) + { date = iter->second; + } outs.printf("\n"); outs.printf("\n"); @@ -1242,21 +1251,20 @@ bool OdfOutput::writeMeta(ZipFile &zf) outs.printf("xmlns:anim=\"urn:oasis:names:tc:opendocument:xmlns:animation:1.0\"\n"); outs.printf("office:version=\"1.0\">\n"); outs.printf("\n"); - Glib::ustring tmp = Glib::ustring(" Inkscape.org - ") + Inkscape::version_string + "\n"; + Glib::ustring tmp = Glib::ustring(" ") + InkscapeVersion + "\n"; outs.writeUString(tmp); - outs.printf(" %#s\n", - creator.c_str()); - outs.printf(" %#s\n", date.c_str()); + outs.printf(" %s\n", creator.c_str()); + outs.printf(" %s\n", date.c_str()); for (iter = metadata.begin() ; iter != metadata.end() ; ++iter) - { + { Glib::ustring name = iter->first; Glib::ustring value = iter->second; - if (name.size() > 0 && value.size()>0) - { - outs.printf(" <%#s>%#s\n", - name.c_str(), value.c_str(), name.c_str()); - } + if (!name.empty() && !value.empty()) + { + tmp = Glib::ustring::compose(" <%1>%2\n", name, value, name); + outs.writeUString(tmp); } + } outs.printf(" 2\n"); outs.printf(" PT56S\n"); outs.printf(" \n"); @@ -1333,7 +1341,7 @@ bool OdfOutput::writeStyle(ZipFile &zf) } //## Dump our gradient table - int gradientCount = 0; + unsigned int gradientCount = 0; outs.printf("\n"); outs.printf("\n"); std::vector::iterator giter; @@ -1359,8 +1367,8 @@ bool OdfOutput::writeStyle(ZipFile &zf) continue; } outs.printf("\n"); outs.printf(" \n"); @@ -1752,8 +1760,8 @@ bool OdfOutput::processGradient(Writer &outs, SPItem *item, return false;; } outs.printf("\n"); outs.printf(" \n"); -- cgit v1.2.3