From c5382a0a91a3a6f4a13774c889d533f8350d9d86 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Mon, 11 Mar 2013 08:09:59 +0100 Subject: Translations. Latvian, Spanish and Ukrainian translations update, and translators list update. (bzr r12189) --- src/ui/dialog/aboutbox.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index d4928d25d..ba9670d86 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -447,7 +447,7 @@ void AboutBox::initStrings() { "Aleksandar Urošević , 2004-2006.\n" "Alessio Frusciante , 2002, 2003.\n" "Alexander Shopov , 2006.\n" -"Alexandre Prokoudine , 2005, 2010-2011.\n" +"Alexandre Prokoudine , 2005, 2010-2013.\n" "Alexey Remizov , 2004.\n" "Ali Ghanavatian , 2010.\n" "Álvaro Lopes , 2001, 2002.\n" @@ -468,14 +468,14 @@ void AboutBox::initStrings() { "Christian Meyer , 2000-2002.\n" "Christian Neumair , 2002, 2003.\n" "Christian Rose , 2000-2003.\n" -"Cristian Secară , 2010.\n" +"Cristian Secară , 2010-2013.\n" "Christophe Merlet (RedFox) , 2000-2002.\n" "Clytie Siddall , 2004-2008.\n" "Colin Marquardt , 2004-2006.\n" "Cédric Gemy , 2006.\n" "Daniel Díaz , 2004.\n" "Didier Conchaudron , 2003.\n" -"Dimitris Spingos , 2011.\n" +"Dimitris Spingos , 2011-2013.\n" "Dorji Tashi , 2006.\n" "Duarte Loreto 2002, 2003 (Maintainer).\n" "Elias Norberg , 2009.\n" @@ -493,6 +493,7 @@ void AboutBox::initStrings() { "Ilia Penev , 2006.\n" "Ivan Masár , 2006-2010. \n" "Iñaki Larrañaga , 2006.\n" +"Jānis Eisaks , 2012, 2013.\n" "Jeffrey Steve Borbón Sanabria , 2005.\n" "Jesper Öqvist , 2010, 2011.\n" "Joaquim Perez i Noguer , 2008-2009.\n" @@ -514,16 +515,16 @@ void AboutBox::initStrings() { "Kingsley Turner , 2006.\n" "Kitae , 2006.\n" "Kjartan Maraas , 2000-2002.\n" -"Kris De Gussem , 2008-2011.\n" +"Kris De Gussem , 2008-2013.\n" "Lauris Kaplinski , 2000.\n" "Leandro Regueiro , 2006-2008, 2010.\n" "Liu Xiaoqin , 2008.\n" "Luca Bruno , 2005.\n" -"Lucas Vieites Fariña, 2003-2010.\n" +"Lucas Vieites Fariña, 2003-2013.\n" "Mahesh subedi , 2006.\n" "Martin Srebotnjak, , 2005, 2010.\n" "Masatake YAMATO , 2002.\n" -"Masato Hashimoto , 2009-2011.\n" +"Masato Hashimoto , 2009-2012.\n" "Matiphas , 2004-2006.\n" "Mattias Hultgren , 2005, 2006.\n" "Maxim Dziumanenko , 2004.\n" @@ -534,7 +535,7 @@ void AboutBox::initStrings() { "Muhammad Bashir Al-Noimi , 2008.\n" "Myckel Habets , 2008.\n" "Nguyen Dinh Trung , 2007, 2008.\n" -"Nicolas Dufour , 2008-2011.\n" +"Nicolas Dufour , 2008-2013.\n" "Pawan Chitrakar , 2006.\n" "Przemysław Loesch , 2005.\n" "Quico Llach , 2000. Traducció sodipodi.\n" @@ -555,7 +556,7 @@ void AboutBox::initStrings() { "Thiago Pimentel , 2006.\n" "Toshifumi Sato , 2005.\n" "Jon South , 2006. \n" -"Uwe Schöler , 2006-2011.\n" +"Uwe Schöler , 2006-2013.\n" "Valek Filippov , 2000, 2003.\n" "Victor Dachev , 2006.\n" "Vincent van Adrighem , 2003.\n" @@ -570,7 +571,7 @@ void AboutBox::initStrings() { "Yaron Shahrabani , 2009.\n" "Yukihiro Nakai , 2000, 2003.\n" "Yuri Beznos , 2006.\n" -"Yuri Chornoivan , 2007-2011.\n" +"Yuri Chornoivan , 2007-2013.\n" "Yuri Syrota , 2000.\n" "Yves Guillou , 2004.\n" "Zdenko Podobný , 2003, 2004." -- cgit v1.2.3 From c834b13959869176738502e99fc74301e7b32100 Mon Sep 17 00:00:00 2001 From: John Smith Date: Mon, 11 Mar 2013 23:14:55 +0900 Subject: Fix for 998276 : Keyboard shortcuts not appearing in the main menu under Unity, uppdate to fix markup issue (bzr r12190) --- src/interface.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/interface.cpp b/src/interface.cpp index bf497b407..69832a2eb 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -468,6 +468,8 @@ static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb item = gtk_image_menu_item_new_with_mnemonic(action->name); } + gtk_label_set_markup_with_mnemonic( GTK_LABEL(gtk_bin_get_child(GTK_BIN (item))), action->name); + GtkAccelGroup *accel_group = sp_shortcut_get_accel_group(); gtk_menu_set_accel_group(menu, accel_group); -- cgit v1.2.3 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 From c9ab0e5a52eeea522ba9f526836310a80bcfe466 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Mon, 11 Mar 2013 22:47:05 +0100 Subject: Drop duplicate io code ( Bug #1120585 ) (bzr r12192) --- src/dom/CMakeLists.txt | 11 - src/dom/Makefile_insert | 8 - src/dom/io/bufferstream.cpp | 167 --------------- src/dom/io/bufferstream.h | 135 ------------ src/dom/io/stringstream.cpp | 159 -------------- src/dom/io/stringstream.h | 131 ------------ src/dom/io/uristream.cpp | 462 ----------------------------------------- src/dom/io/uristream.h | 207 ------------------ src/extension/internal/odf.cpp | 18 +- src/extension/internal/odf.h | 7 +- src/io/CMakeLists.txt | 3 +- src/io/Makefile_insert | 2 + src/io/bufferstream.cpp | 157 ++++++++++++++ src/io/bufferstream.h | 109 ++++++++++ 14 files changed, 280 insertions(+), 1296 deletions(-) delete mode 100644 src/dom/io/bufferstream.cpp delete mode 100644 src/dom/io/bufferstream.h delete mode 100644 src/dom/io/stringstream.cpp delete mode 100644 src/dom/io/stringstream.h delete mode 100644 src/dom/io/uristream.cpp delete mode 100644 src/dom/io/uristream.h create mode 100644 src/io/bufferstream.cpp create mode 100644 src/io/bufferstream.h (limited to 'src') diff --git a/src/dom/CMakeLists.txt b/src/dom/CMakeLists.txt index 5d761e649..8167e1b03 100644 --- a/src/dom/CMakeLists.txt +++ b/src/dom/CMakeLists.txt @@ -14,16 +14,10 @@ set(dom_SRC ucd.cpp uri.cpp xmlreader.cpp - # xmlwriter.cpp xpathimpl.cpp xpathparser.cpp xpathtoken.cpp - io/bufferstream.cpp - io/domstream.cpp - io/stringstream.cpp - io/uristream.cpp - util/digest.cpp util/ziptool.cpp @@ -59,11 +53,6 @@ set(dom_SRC xpathparser.h xpathtoken.h - io/bufferstream.h - io/domstream.h - io/stringstream.h - io/uristream.h - util/digest.h util/ziptool.h ) diff --git a/src/dom/Makefile_insert b/src/dom/Makefile_insert index 91c91eeac..058242a36 100644 --- a/src/dom/Makefile_insert +++ b/src/dom/Makefile_insert @@ -50,14 +50,6 @@ dom_libdom_a_SOURCES = \ dom/xpathparser.h \ dom/xpathtoken.h \ dom/xpathtoken.cpp \ - dom/io/bufferstream.cpp \ - dom/io/bufferstream.h \ - dom/io/domstream.cpp \ - dom/io/domstream.h \ - dom/io/stringstream.cpp \ - dom/io/stringstream.h \ - dom/io/uristream.cpp \ - dom/io/uristream.h \ dom/util/digest.h \ dom/util/digest.cpp \ dom/util/ziptool.h \ diff --git a/src/dom/io/bufferstream.cpp b/src/dom/io/bufferstream.cpp deleted file mode 100644 index 3389bd80e..000000000 --- a/src/dom/io/bufferstream.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Phoebe DOM Implementation. - * - * This is a C++ approximation of the W3C DOM model, which follows - * fairly closely the specifications in the various .idl files, copies of - * which are provided for reference. Most important is this one: - * - * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html - * - * Authors: - * Bob Jamison - * - * Copyright (C) 2006 Bob Jamison - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * This class provided buffered endpoints for input and output. - */ - -#include "bufferstream.h" - -namespace org -{ -namespace w3c -{ -namespace dom -{ -namespace io -{ - - - -//######################################################################### -//# B U F F E R I N P U T S T R E A M -//######################################################################### - - -/** - * - */ -BufferInputStream::BufferInputStream( - const std::vector &sourceBuffer) - : buffer(sourceBuffer) -{ - position = 0; - closed = false; -} - -/** - * - */ -BufferInputStream::~BufferInputStream() -{ - -} - -/** - * Returns the number of bytes that can be read (or skipped over) from - * this input stream without blocking by the next caller of a method for - * this input stream. - */ -int BufferInputStream::available() -{ - if (closed) - return -1; - return buffer.size() - position; -} - - -/** - * Closes this input stream and releases any system resources - * associated with the stream. - */ -void BufferInputStream::close() -{ - closed = true; -} - -/** - * Reads the next byte of data from the input stream. -1 if EOF - */ -int BufferInputStream::get() -{ - if (closed) - return -1; - if (position >= (int)buffer.size()) - return -1; - int ch = (int) buffer[position++]; - return ch; -} - - - - -//######################################################################### -//# B U F F E R O U T P U T S T R E A M -//######################################################################### - -/** - * - */ -BufferOutputStream::BufferOutputStream() -{ - closed = false; -} - -/** - * - */ -BufferOutputStream::~BufferOutputStream() -{ -} - -/** - * Closes this output stream and releases any system resources - * associated with this stream. - */ -void BufferOutputStream::close() -{ - closed = true; -} - -/** - * Flushes this output stream and forces any buffered output - * bytes to be written out. - */ -void BufferOutputStream::flush() -{ - //nothing to do -} - -/** - * Writes the specified byte to this output stream. - */ -int BufferOutputStream::put(gunichar ch) -{ - if (closed) - return -1; - buffer.push_back(ch); - return 1; -} - - - - -} //namespace io -} //namespace dom -} //namespace w3c -} //namespace org - -//######################################################################### -//# E N D O F F I L E -//######################################################################### diff --git a/src/dom/io/bufferstream.h b/src/dom/io/bufferstream.h deleted file mode 100644 index 0ac06b362..000000000 --- a/src/dom/io/bufferstream.h +++ /dev/null @@ -1,135 +0,0 @@ -#ifndef SEEN_BUFFERSTREAM_H -#define SEEN_BUFFERSTREAM_H -/** - * @file - * Phoebe DOM Implementation. - * - * This is a C++ approximation of the W3C DOM model, which follows - * fairly closely the specifications in the various .idl files, copies of - * which are provided for reference. Most important is this one: - * - * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html - */ -/* - * Authors: - * Bob Jamison - * - * Copyright (C) 2006 Bob Jamison - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - - -#include "domstream.h" - - -namespace org -{ -namespace w3c -{ -namespace dom -{ -namespace io -{ - - -//######################################################################### -//# S T R I N G I N P U T S T R E A M -//######################################################################### - -/** - * This class is for reading character from a DOMString - * - */ -class BufferInputStream : public InputStream -{ - -public: - - BufferInputStream(const std::vector &sourceBuffer); - - virtual ~BufferInputStream(); - - virtual int available(); - - virtual void close(); - - virtual int get(); - -private: - - const std::vector &buffer; - - long position; - - bool closed; - -}; // class BufferInputStream - - - - -//######################################################################### -//# B U F F E R O U T P U T S T R E A M -//######################################################################### - -/** - * This class is for sending a stream to a character buffer - * - */ -class BufferOutputStream : public OutputStream -{ - -public: - - BufferOutputStream(); - - virtual ~BufferOutputStream(); - - virtual void close(); - - virtual void flush(); - - virtual int put(gunichar ch); - - virtual std::vector &getBuffer() - { return buffer; } - - virtual void clear() - { buffer.clear(); } - -private: - - std::vector buffer; - - bool closed; - - -}; // class BufferOutputStream - - - - - - - -} //namespace io -} //namespace dom -} //namespace w3c -} //namespace org - - - -#endif // SEEN_BUFFERSTREAM_H diff --git a/src/dom/io/stringstream.cpp b/src/dom/io/stringstream.cpp deleted file mode 100644 index ca058a575..000000000 --- a/src/dom/io/stringstream.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Phoebe DOM Implementation. - * - * This is a C++ approximation of the W3C DOM model, which follows - * fairly closely the specifications in the various .idl files, copies of - * which are provided for reference. Most important is this one: - * - * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html - * - * Authors: - * Bob Jamison - * - * Copyright (C) 2005 Bob Jamison - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * Our base String stream classes. We implement these to - * be based on DOMString - * - */ - - -#include "stringstream.h" - -namespace org -{ -namespace w3c -{ -namespace dom -{ -namespace io -{ - - - -//######################################################################### -//# S T R I N G I N P U T S T R E A M -//######################################################################### - - -/** - * - */ -StringInputStream::StringInputStream(const DOMString &sourceString) - : buffer((DOMString &)sourceString) -{ - position = 0; -} - -/** - * - */ -StringInputStream::~StringInputStream() -{ - -} - -/** - * Returns the number of bytes that can be read (or skipped over) from - * this input stream without blocking by the next caller of a method for - * this input stream. - */ -int StringInputStream::available() -{ - return buffer.size() - position; -} - - -/** - * Closes this input stream and releases any system resources - * associated with the stream. - */ -void StringInputStream::close() -{ -} - -/** - * Reads the next byte of data from the input stream. -1 if EOF - */ -int StringInputStream::get() -{ - if (position >= (int)buffer.size()) - return -1; - int ch = (int) buffer[position++]; - return ch; -} - - - - -//######################################################################### -//# S T R I N G O U T P U T S T R E A M -//######################################################################### - -/** - * - */ -StringOutputStream::StringOutputStream() -{ -} - -/** - * - */ -StringOutputStream::~StringOutputStream() -{ -} - -/** - * Closes this output stream and releases any system resources - * associated with this stream. - */ -void StringOutputStream::close() -{ -} - -/** - * Flushes this output stream and forces any buffered output - * bytes to be written out. - */ -void StringOutputStream::flush() -{ - //nothing to do -} - -/** - * Writes the specified byte to this output stream. - */ -int StringOutputStream::put(gunichar ch) -{ - buffer.push_back(ch); - return 1; -} - - - - -} //namespace io -} //namespace dom -} //namespace w3c -} //namespace org - -//######################################################################### -//# E N D O F F I L E -//######################################################################### diff --git a/src/dom/io/stringstream.h b/src/dom/io/stringstream.h deleted file mode 100644 index 9ba24fc26..000000000 --- a/src/dom/io/stringstream.h +++ /dev/null @@ -1,131 +0,0 @@ -#ifndef SEEN_STRINGSTREAM_H -#define SEEN_STRINGSTREAM_H -/** - * @file - * Phoebe DOM Implementation. - * - * This is a C++ approximation of the W3C DOM model, which follows - * fairly closely the specifications in the various .idl files, copies of - * which are provided for reference. Most important is this one: - * - * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html - */ -/* - * Authors: - * Bob Jamison - * - * Copyright (C) 2006 Bob Jamison - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - - -#include "domstream.h" - - -namespace org -{ -namespace w3c -{ -namespace dom -{ -namespace io -{ - - -//######################################################################### -//# S T R I N G I N P U T S T R E A M -//######################################################################### - -/** - * This class is for reading character from a DOMString - * - */ -class StringInputStream : public InputStream -{ - -public: - - StringInputStream(const DOMString &sourceString); - - virtual ~StringInputStream(); - - virtual int available(); - - virtual void close(); - - virtual int get(); - -private: - - DOMString &buffer; - - long position; - -}; // class StringInputStream - - - - -//######################################################################### -//# S T R I N G O U T P U T S T R E A M -//######################################################################### - -/** - * This class is for sending a stream to a DOMString - * - */ -class StringOutputStream : public OutputStream -{ - -public: - - StringOutputStream(); - - virtual ~StringOutputStream(); - - virtual void close(); - - virtual void flush(); - - virtual int put(gunichar ch); - - virtual DOMString &getString() - { return buffer; } - - virtual void clear() - { buffer = ""; } - -private: - - DOMString buffer; - - -}; // class StringOutputStream - - - - - - - -} //namespace io -} //namespace dom -} //namespace w3c -} //namespace org - - - -#endif // SEEN_STRINGSTREAM_H diff --git a/src/dom/io/uristream.cpp b/src/dom/io/uristream.cpp deleted file mode 100644 index f6172d9e0..000000000 --- a/src/dom/io/uristream.cpp +++ /dev/null @@ -1,462 +0,0 @@ -/* - * Phoebe DOM Implementation. - * - * This is a C++ approximation of the W3C DOM model, which follows - * fairly closely the specifications in the various .idl files, copies of - * which are provided for reference. Most important is this one: - * - * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html - * - * Authors: - * Bob Jamison - * - * Copyright (C) 2005-2008 Bob Jamison - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - - - -#include "uristream.h" -#include -#include - - -namespace org -{ -namespace w3c -{ -namespace dom -{ -namespace io -{ - - - -//######################################################################### -//# U R I I N P U T S T R E A M / R E A D E R -//######################################################################### - - -/** - * - */ -UriInputStream::UriInputStream(const URI &source) - throw (StreamException): uri((URI &)source) -{ - init(); -} - -/** - * - */ -void UriInputStream::init() throw (StreamException) -{ - //get information from uri - scheme = uri.getScheme(); - - switch (scheme) - { - - case URI::SCHEME_FILE: - { - DOMString npath = uri.getNativePath(); - inf = fopen(npath.c_str(), "rb"); - if (!inf) - { - DOMString err = "UriInputStream cannot open file "; - err.append(npath); - throw StreamException(err); - } - break; - } - - case URI::SCHEME_DATA: - { - data = uri.getPath(); - //printf("in data:'%s'\n", data.c_str()); - dataPos = 0; - dataLen = uri.getPath().size(); - break; - } - } - - closed = false; -} - - - - - -/** - * - */ -UriInputStream::~UriInputStream() throw(StreamException) -{ - close(); -} - -/** - * Returns the number of bytes that can be read (or skipped over) from - * this input stream without blocking by the next caller of a method for - * this input stream. - */ -int UriInputStream::available() throw(StreamException) -{ - return 0; -} - - -/** - * Closes this input stream and releases any system resources - * associated with the stream. - */ -void UriInputStream::close() throw(StreamException) -{ - if (closed) - return; - - switch (scheme) - { - - case URI::SCHEME_FILE: - { - if (!inf) - return; - fflush(inf); - fclose(inf); - inf=NULL; - break; - } - - case URI::SCHEME_DATA: - { - //do nothing - break; - } - }//switch - - closed = true; -} - -/** - * Reads the next byte of data from the input stream. -1 if EOF - */ -int UriInputStream::get() throw(StreamException) -{ - int retVal = -1; - if (closed) - { - return -1; - } - - switch (scheme) - { - - case URI::SCHEME_FILE: - { - if (!inf || feof(inf)) - { - retVal = -1; - } - else - { - retVal = fgetc(inf); - } - break; - } - - case URI::SCHEME_DATA: - { - if (dataPos >= dataLen) - { - retVal = -1; - } - else - { - retVal = data[dataPos++]; - } - break; - } - }//switch - - return retVal; -} - - - - - - -/** - * - */ -UriReader::UriReader(const URI &uri) throw (StreamException) -{ - inputStream = new UriInputStream(uri); -} - -/** - * - */ -UriReader::~UriReader() throw (StreamException) -{ - delete inputStream; -} - -/** - * - */ -int UriReader::available() throw(StreamException) -{ - return inputStream->available(); -} - -/** - * - */ -void UriReader::close() throw(StreamException) -{ - inputStream->close(); -} - -/** - * - */ -gunichar UriReader::get() throw(StreamException) -{ - //int ch = (int)inputStream->get(); - return inputStream->get();//ch; -} - - -//######################################################################### -//# U R I O U T P U T S T R E A M / W R I T E R -//######################################################################### - -/** - * - */ -UriOutputStream::UriOutputStream(const URI &destination) - throw (StreamException): closed(false), - ownsFile(true), - outf(NULL), - uri((URI &)destination) -{ - init(); -} - - -/** - * - */ -void UriOutputStream::init() throw(StreamException) -{ - //get information from uri - scheme = uri.getScheme(); - - //printf("out schemestr:'%s' scheme:'%d'\n", schemestr, scheme); - char *cpath = NULL; - - switch (scheme) - { - - case URI::SCHEME_FILE: - { - cpath = (char *) uri.getNativePath().c_str(); - //printf("out path:'%s'\n", cpath); - outf = fopen(cpath, "wb"); - if (!outf) - { - DOMString err = "UriOutputStream cannot open file "; - err += cpath; - throw StreamException(err); - } - break; - } - - case URI::SCHEME_DATA: - { - data = "data:"; - break; - } - - }//switch -} - -/** - * - */ -UriOutputStream::~UriOutputStream() throw(StreamException) -{ - close(); -} - -/** - * Closes this output stream and releases any system resources - * associated with this stream. - */ -void UriOutputStream::close() throw(StreamException) -{ - if (closed) - return; - - switch (scheme) - { - - case URI::SCHEME_FILE: - { - if (!outf) - return; - fflush(outf); - if ( ownsFile ) - fclose(outf); - outf=NULL; - break; - } - - case URI::SCHEME_DATA: - { - uri = URI(data); - break; - } - - }//switch - - closed = true; -} - - -/** - * Flushes this output stream and forces any buffered output - * bytes to be written out. - */ -void UriOutputStream::flush() throw(StreamException) -{ - if (closed) - return; - - switch (scheme) - { - - case URI::SCHEME_FILE: - { - if (!outf) - return; - fflush(outf); - break; - } - - case URI::SCHEME_DATA: - { - //nothing - break; - } - - }//switch - -} - -/** - * Writes the specified byte to this output stream. - */ -int UriOutputStream::put(gunichar ch) throw(StreamException) -{ - if (closed) - return -1; - - switch (scheme) - { - - case URI::SCHEME_FILE: - { - if (!outf) - return -1; - unsigned char uch = (unsigned char)(ch & 0xff); - fputc(uch, outf); - //fwrite(uch, 1, 1, outf); - break; - } - - case URI::SCHEME_DATA: - { - data.push_back(ch); - break; - } - - }//switch - return 1; -} - - - - - -/** - * - */ -UriWriter::UriWriter(const URI &uri) - throw (StreamException) -{ - outputStream = new UriOutputStream(uri); -} - -/** - * - */ -UriWriter::~UriWriter() throw (StreamException) -{ - delete outputStream; -} - -/** - * - */ -void UriWriter::close() throw(StreamException) -{ - outputStream->close(); -} - -/** - * - */ -void UriWriter::flush() throw(StreamException) -{ - outputStream->flush(); -} - -/** - * - */ -int UriWriter::put(gunichar ch) throw(StreamException) -{ - if (outputStream->put(ch) < 0) - return -1; - return 1; -} - - - - - -} //namespace io -} //namespace dom -} //namespace w3c -} //namespace org - - -//######################################################################### -//# E N D O F F I L E -//######################################################################### diff --git a/src/dom/io/uristream.h b/src/dom/io/uristream.h deleted file mode 100644 index 51227acc9..000000000 --- a/src/dom/io/uristream.h +++ /dev/null @@ -1,207 +0,0 @@ -#ifndef SEEN_URISTREAM_H -#define SEEN_URISTREAM_H - -/** - * Phoebe DOM Implementation. - * - * This is a C++ approximation of the W3C DOM model, which follows - * fairly closely the specifications in the various .idl files, copies of - * which are provided for reference. Most important is this one: - * - * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html - */ -/* - * Authors: - * Bob Jamison - * - * Copyright (C) 2005-2008 Bob Jamison - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * This should be the only way that we provide sources/sinks - * to any input/output stream. - * - */ - - -#include "../uri.h" -#include "domstream.h" - - -namespace org -{ -namespace w3c -{ -namespace dom -{ -namespace io -{ - - -//######################################################################### -//# U R I I N P U T S T R E A M / R E A D E R -//######################################################################### - -/** - * This class is for receiving a stream of data from a resource - * defined in a URI - */ -class UriInputStream : public InputStream -{ - -public: - - UriInputStream(const URI &source) throw(StreamException); - - virtual ~UriInputStream() throw(StreamException); - - virtual int available() throw(StreamException); - - virtual void close() throw(StreamException); - - virtual int get() throw(StreamException); - -private: - - void init() throw(StreamException);//common code called by constructor - - bool closed; - - FILE *inf; //for file: uris - DOMString data; //for data: uris - int dataPos; // current read position in data field - int dataLen; // length of data buffer - - URI uri; - - int scheme; -}; // class UriInputStream - - - - -/** - * This class is for receiving a stream of formatted data from a resource - * defined in a URI - */ -class UriReader : public Reader -{ - -public: - - UriReader(const URI &source) throw(StreamException); - - virtual ~UriReader() throw(StreamException); - - virtual int available() throw(StreamException); - - virtual void close() throw(StreamException); - - virtual gunichar get() throw(StreamException); - -private: - - UriInputStream *inputStream; - -}; // class UriReader - - - -//######################################################################### -//# U R I O U T P U T S T R E A M / W R I T E R -//######################################################################### - -/** - * This class is for sending a stream to a destination resource - * defined in a URI - * - */ -class UriOutputStream : public OutputStream -{ - -public: - - UriOutputStream(const URI &destination) throw(StreamException); - - virtual ~UriOutputStream() throw(StreamException); - - virtual void close() throw(StreamException); - - virtual void flush() throw(StreamException); - - virtual int put(gunichar ch) throw(StreamException); - -private: - - void init() throw(StreamException); //common code called by constructor - - bool closed; - bool ownsFile; - - FILE *outf; //for file: uris - DOMString data; //for data: uris - - URI uri; - - int scheme; -}; // class UriOutputStream - - - - - -/** - * This class is for sending a stream of formatted data to a resource - * defined in a URI - */ -class UriWriter : public Writer -{ - -public: - - UriWriter(const URI &source) throw(StreamException); - - virtual ~UriWriter() throw(StreamException); - - virtual void close() throw(StreamException); - - virtual void flush() throw(StreamException); - - virtual int put(gunichar ch) throw(StreamException); - -private: - - UriOutputStream *outputStream; - -}; // class UriReader - - - - - - -} //namespace io -} //namespace dom -} //namespace w3c -} //namespace org - -/*######################################################################### -## E N D O F F I L E -#########################################################################*/ - - -#endif // SEEN_URISTREAM_H diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index 47671a8d2..4c27925ae 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -80,16 +80,15 @@ //# DOM-specific includes #include "dom/dom.h" #include "dom/util/ziptool.h" -#include "dom/io/domstream.h" -#include "dom/io/bufferstream.h" -#include "dom/io/stringstream.h" +//#include "dom/io/domstream.h" #include "inkscape-version.h" #include "document.h" #include "extension/extension.h" - +#include "io/inkscapestream.h" +#include "io/bufferstream.h" namespace Inkscape { @@ -97,15 +96,12 @@ namespace Extension { namespace Internal { - - - //# Shorthand notation typedef org::w3c::dom::DOMString DOMString; -typedef org::w3c::dom::XMLCh XMLCh; -typedef org::w3c::dom::io::OutputStreamWriter OutputStreamWriter; -typedef org::w3c::dom::io::BufferOutputStream BufferOutputStream; -typedef org::w3c::dom::io::StringOutputStream StringOutputStream; +typedef Inkscape::IO::BufferOutputStream BufferOutputStream; +typedef Inkscape::IO::OutputStreamWriter OutputStreamWriter; +typedef Inkscape::IO::StringOutputStream StringOutputStream; + //######################################################################## //# C L A S S SingularValueDecomposition diff --git a/src/extension/internal/odf.h b/src/extension/internal/odf.h index 6b8883134..219a99a4f 100644 --- a/src/extension/internal/odf.h +++ b/src/extension/internal/odf.h @@ -24,7 +24,7 @@ #define EXTENSION_INTERNAL_ODG_OUT_H #include -#include +#include #include #include @@ -37,7 +37,7 @@ #include #include -#include +//#include #include "sp-item.h" namespace Inkscape @@ -48,8 +48,7 @@ namespace Internal { typedef org::w3c::dom::URI URI; -typedef org::w3c::dom::io::Writer Writer; - +typedef Inkscape::IO::Writer Writer; class StyleInfo { diff --git a/src/io/CMakeLists.txt b/src/io/CMakeLists.txt index c5606779e..34502d3db 100644 --- a/src/io/CMakeLists.txt +++ b/src/io/CMakeLists.txt @@ -1,6 +1,7 @@ set(io_SRC base64stream.cpp + bufferstream.cpp ftos.cpp gzipstream.cpp inkjar.cpp @@ -12,10 +13,10 @@ set(io_SRC uristream.cpp xsltstream.cpp - # ------- # Headers base64stream.h + bufferstream.h ftos.h gzipstream.h inkjar.h diff --git a/src/io/Makefile_insert b/src/io/Makefile_insert index bb47b46b8..935c0cc07 100644 --- a/src/io/Makefile_insert +++ b/src/io/Makefile_insert @@ -3,6 +3,8 @@ ink_common_sources += \ io/base64stream.h \ io/base64stream.cpp \ + io/bufferstream.cpp \ + io/bufferstream.h \ io/ftos.cpp \ io/ftos.h \ io/gzipstream.cpp \ diff --git a/src/io/bufferstream.cpp b/src/io/bufferstream.cpp new file mode 100644 index 000000000..ba440254f --- /dev/null +++ b/src/io/bufferstream.cpp @@ -0,0 +1,157 @@ +/* + * Phoebe DOM Implementation. + * + * This is a C++ approximation of the W3C DOM model, which follows + * fairly closely the specifications in the various .idl files, copies of + * which are provided for reference. Most important is this one: + * + * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html + * + * Authors: + * Bob Jamison + * + * Copyright (C) 2006 Bob Jamison + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * This class provided buffered endpoints for input and output. + */ + +#include "bufferstream.h" + +namespace Inkscape +{ +namespace IO +{ + +//######################################################################### +//# B U F F E R I N P U T S T R E A M +//######################################################################### +/** + * + */ +BufferInputStream::BufferInputStream( + const std::vector &sourceBuffer) + : buffer(sourceBuffer) +{ + position = 0; + closed = false; +} + +/** + * + */ +BufferInputStream::~BufferInputStream() +{ + +} + +/** + * Returns the number of bytes that can be read (or skipped over) from + * this input stream without blocking by the next caller of a method for + * this input stream. + */ +int BufferInputStream::available() +{ + if (closed) + return -1; + return buffer.size() - position; +} + + +/** + * Closes this input stream and releases any system resources + * associated with the stream. + */ +void BufferInputStream::close() +{ + closed = true; +} + +/** + * Reads the next byte of data from the input stream. -1 if EOF + */ +int BufferInputStream::get() +{ + if (closed) + return -1; + if (position >= (int)buffer.size()) + return -1; + int ch = (int) buffer[position++]; + return ch; +} + + + + +//######################################################################### +//# B U F F E R O U T P U T S T R E A M +//######################################################################### + +/** + * + */ +BufferOutputStream::BufferOutputStream() +{ + closed = false; +} + +/** + * + */ +BufferOutputStream::~BufferOutputStream() +{ +} + +/** + * Closes this output stream and releases any system resources + * associated with this stream. + */ +void BufferOutputStream::close() +{ + closed = true; +} + +/** + * Flushes this output stream and forces any buffered output + * bytes to be written out. + */ +void BufferOutputStream::flush() +{ + //nothing to do +} + +/** + * Writes the specified byte to this output stream. + */ +int BufferOutputStream::put(gunichar ch) +{ + if (closed) + return -1; + buffer.push_back(ch); + return 1; +} + + + + +} //namespace IO +} //namespace Inkscape + +//######################################################################### +//# E N D O F F I L E +//######################################################################### diff --git a/src/io/bufferstream.h b/src/io/bufferstream.h new file mode 100644 index 000000000..ed565572a --- /dev/null +++ b/src/io/bufferstream.h @@ -0,0 +1,109 @@ +#ifndef SEEN_BUFFERSTREAM_H +#define SEEN_BUFFERSTREAM_H +/** + * @file + * Phoebe DOM Implementation. + * + * This is a C++ approximation of the W3C DOM model, which follows + * fairly closely the specifications in the various .idl files, copies of + * which are provided for reference. Most important is this one: + * + * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html + */ +/* + * Authors: + * Bob Jamison + * + * Copyright (C) 2006 Bob Jamison + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include "inkscapestream.h" + + +namespace Inkscape +{ +namespace IO +{ + +//######################################################################### +//# S T R I N G I N P U T S T R E A M +//######################################################################### + +/** + * This class is for reading character from a DOMString + * + */ +class BufferInputStream : public InputStream +{ + +public: + + BufferInputStream(const std::vector &sourceBuffer); + virtual ~BufferInputStream(); + virtual int available(); + virtual void close(); + virtual int get(); + +private: + const std::vector &buffer; + long position; + bool closed; + +}; // class BufferInputStream + + + + +//######################################################################### +//# B U F F E R O U T P U T S T R E A M +//######################################################################### + +/** + * This class is for sending a stream to a character buffer + * + */ +class BufferOutputStream : public OutputStream +{ + +public: + + BufferOutputStream(); + virtual ~BufferOutputStream(); + virtual void close(); + virtual void flush(); + virtual int put(gunichar ch); + virtual std::vector &getBuffer() + { return buffer; } + + virtual void clear() + { buffer.clear(); } + +private: + std::vector buffer; + bool closed; + +}; // class BufferOutputStream + + + +} //namespace IO +} //namespace Inkscape + + + +#endif // SEEN_BUFFERSTREAM_H -- cgit v1.2.3 From 1f2e3605492857229ecac6204e2957a91dd0ad44 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Mon, 11 Mar 2013 22:48:33 +0100 Subject: cppcheck (bzr r12193) --- src/desktop-style.cpp | 2 +- src/ege-color-prof-tracker.cpp | 3 +- src/ege-select-one-action.cpp | 10 +- src/extension/dependency.cpp | 4 +- src/extension/internal/filter/paint.h | 1 - src/extension/internal/pdfinput/pdf-parser.cpp | 565 +++++++++++++------------ 6 files changed, 292 insertions(+), 293 deletions(-) (limited to 'src') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 2ea3c876b..40132ec58 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -446,9 +446,9 @@ stroke_average_width (GSList const *objects) static bool vectorsClose( std::vector const &lhs, std::vector const &rhs ) { - static double epsilon = 1e-6; bool isClose = false; if ( lhs.size() == rhs.size() ) { + static double epsilon = 1e-6; isClose = true; for ( size_t i = 0; (i < lhs.size()) && isClose; ++i ) { isClose = fabs(lhs[i] - rhs[i]) < epsilon; diff --git a/src/ege-color-prof-tracker.cpp b/src/ege-color-prof-tracker.cpp index 2e1b8188f..53004a96d 100644 --- a/src/ege-color-prof-tracker.cpp +++ b/src/ege-color-prof-tracker.cpp @@ -566,9 +566,8 @@ GdkFilterReturn x11_win_filter(GdkXEvent *xevent, const gchar* name = gdk_x11_get_xatom_name(note->atom); if ( strncmp("_ICC_PROFILE", name, 12 ) == 0 ) { XEvent* native = (XEvent*)xevent; - Status stat = Success; XWindowAttributes tmp; - stat = XGetWindowAttributes( native->xproperty.display, native->xproperty.window, &tmp ); + Status stat = XGetWindowAttributes( native->xproperty.display, native->xproperty.window, &tmp ); if ( stat ) { GdkDisplay* display = gdk_x11_lookup_xdisplay(native->xproperty.display); if ( display ) { diff --git a/src/ege-select-one-action.cpp b/src/ege-select-one-action.cpp index 33cfd04f2..871b961bd 100644 --- a/src/ege-select-one-action.cpp +++ b/src/ege-select-one-action.cpp @@ -567,7 +567,6 @@ GtkWidget* create_menu_item( GtkAction* action ) if ( IS_EGE_SELECT_ONE_ACTION(action) ) { EgeSelectOneAction* act = EGE_SELECT_ONE_ACTION( action ); gchar* sss = 0; - gboolean valid = FALSE; gint index = 0; GtkTreeIter iter; GSList* group = 0; @@ -577,7 +576,7 @@ GtkWidget* create_menu_item( GtkAction* action ) item = gtk_menu_item_new_with_label( sss ); - valid = gtk_tree_model_get_iter_first( act->private_data->model, &iter ); + gboolean valid = gtk_tree_model_get_iter_first( act->private_data->model, &iter ); while ( valid ) { gchar* str = 0; gtk_tree_model_get( act->private_data->model, &iter, @@ -746,8 +745,6 @@ GtkWidget* create_tool_item( GtkAction* action ) gtk_container_add( GTK_CONTAINER(item), holder ); } else { - GtkCellRenderer * renderer = 0; - #if GTK_CHECK_VERSION(3,0,0) GtkWidget* holder = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 4); gtk_box_set_homogeneous(GTK_BOX(holder), FALSE); @@ -759,8 +756,8 @@ GtkWidget* create_tool_item( GtkAction* action ) GtkWidget *normal; if (act->private_data->selectionMode == SELECTION_OPEN) { - normal = gtk_combo_box_new_with_model_and_entry (act->private_data->model); - gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (normal), act->private_data->labelColumn); + normal = gtk_combo_box_new_with_model_and_entry (act->private_data->model); + gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (normal), act->private_data->labelColumn); GtkWidget *child = gtk_bin_get_child( GTK_BIN(normal) ); if (GTK_IS_ENTRY(child)) { @@ -783,6 +780,7 @@ GtkWidget* create_tool_item( GtkAction* action ) } } else { + GtkCellRenderer * renderer = NULL; normal = gtk_combo_box_new_with_model( act->private_data->model ); if ( act->private_data->iconColumn >= 0 ) { renderer = gtk_cell_renderer_pixbuf_new(); diff --git a/src/extension/dependency.cpp b/src/extension/dependency.cpp index 7c358d871..78012ccc8 100644 --- a/src/extension/dependency.cpp +++ b/src/extension/dependency.cpp @@ -122,8 +122,7 @@ Dependency::~Dependency (void) found then a TRUE is returned. If we get all the way through the path then a FALSE is returned, the command could not be found. */ -bool -Dependency::check (void) const +bool Dependency::check (void) const { // std::cout << "Checking: " << *this << std::endl; @@ -216,7 +215,6 @@ Dependency::check (void) const g_free(orig_path); return FALSE; /* Reverse logic in this one */ - break; } } /* switch _location */ break; diff --git a/src/extension/internal/filter/paint.h b/src/extension/internal/filter/paint.h index f04dd92f9..4052f4391 100644 --- a/src/extension/internal/filter/paint.h +++ b/src/extension/internal/filter/paint.h @@ -133,7 +133,6 @@ Chromolitho::get_filter_text (Inkscape::Extension::Extension * ext) std::ostringstream noise; std::ostringstream dblend; std::ostringstream smooth; - std::ostringstream grain; std::ostringstream grainxf; std::ostringstream grainyf; std::ostringstream grainc; diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp index e57161e5a..3be7af34f 100644 --- a/src/extension/internal/pdfinput/pdf-parser.cpp +++ b/src/extension/internal/pdfinput/pdf-parser.cpp @@ -1220,7 +1220,6 @@ void PdfParser::opSetStrokeColor(Object args[], int numArgs) { void PdfParser::opSetFillColorN(Object args[], int numArgs) { GfxColor color; - GfxPattern *pattern; int i; if (state->getFillColorSpace()->getMode() == csPattern) { @@ -1243,6 +1242,7 @@ void PdfParser::opSetFillColorN(Object args[], int numArgs) { state->setFillColor(&color); builder->updateStyle(state); } + GfxPattern *pattern; #if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) if (args[numArgs-1].isName() && (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL))) { @@ -1279,7 +1279,6 @@ void PdfParser::opSetFillColorN(Object args[], int numArgs) { void PdfParser::opSetStrokeColorN(Object args[], int numArgs) { GfxColor color; - GfxPattern *pattern; int i; if (state->getStrokeColorSpace()->getMode() == csPattern) { @@ -1303,6 +1302,7 @@ void PdfParser::opSetStrokeColorN(Object args[], int numArgs) { state->setStrokeColor(&color); builder->updateStyle(state); } + GfxPattern *pattern; #if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) if (args[numArgs-1].isName() && (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL))) { @@ -2702,333 +2702,338 @@ void PdfParser::opXObject(Object args[], int /*numArgs*/) void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) { - Dict *dict, *maskDict; - int width, height; - int bits; - StreamColorSpaceMode csMode; - GBool mask; - GBool invert; - GfxColorSpace *colorSpace, *maskColorSpace; - GfxImageColorMap *colorMap, *maskColorMap; - Object maskObj, smaskObj; - GBool haveColorKeyMask, haveExplicitMask, haveSoftMask; - int maskColors[2*gfxColorMaxComps]; - int maskWidth, maskHeight; - GBool maskInvert; - Stream *maskStr; - Object obj1, obj2; - int i; - - // get info from the stream - bits = 0; - csMode = streamCSNone; - str->getImageParams(&bits, &csMode); - - // get stream dict - dict = str->getDict(); - - // get size - dict->lookup(const_cast("Width"), &obj1); - if (obj1.isNull()) { - obj1.free(); - dict->lookup(const_cast("W"), &obj1); - } - if (obj1.isInt()) - width = obj1.getInt(); - else if (obj1.isReal()) - width = (int)obj1.getReal(); - else - goto err2; - obj1.free(); - dict->lookup(const_cast("Height"), &obj1); - if (obj1.isNull()) { - obj1.free(); - dict->lookup(const_cast("H"), &obj1); - } - if (obj1.isInt()) - height = obj1.getInt(); - else if (obj1.isReal()) - height = (int)obj1.getReal(); - else - goto err2; - obj1.free(); - - // image or mask? - dict->lookup(const_cast("ImageMask"), &obj1); - if (obj1.isNull()) { - obj1.free(); - dict->lookup(const_cast("IM"), &obj1); - } - mask = gFalse; - if (obj1.isBool()) - mask = obj1.getBool(); - else if (!obj1.isNull()) - goto err2; - obj1.free(); - - // bit depth - if (bits == 0) { - dict->lookup(const_cast("BitsPerComponent"), &obj1); + Dict *dict; + int width, height; + int bits; + StreamColorSpaceMode csMode; + GBool mask; + GBool invert; + Object maskObj, smaskObj; + GBool haveColorKeyMask, haveExplicitMask, haveSoftMask; + GBool maskInvert; + Object obj1, obj2; + + // get info from the stream + bits = 0; + csMode = streamCSNone; + str->getImageParams(&bits, &csMode); + + // get stream dict + dict = str->getDict(); + + // get size + dict->lookup(const_cast("Width"), &obj1); if (obj1.isNull()) { - obj1.free(); - dict->lookup(const_cast("BPC"), &obj1); + obj1.free(); + dict->lookup(const_cast("W"), &obj1); } - if (obj1.isInt()) { - bits = obj1.getInt(); - } else if (mask) { - bits = 1; - } else { - goto err2; + if (obj1.isInt()){ + width = obj1.getInt(); } - obj1.free(); - } - - // display a mask - if (mask) { - - // check for inverted mask - if (bits != 1) - goto err1; - invert = gFalse; - dict->lookup(const_cast("Decode"), &obj1); - if (obj1.isNull()) { - obj1.free(); - dict->lookup(const_cast("D"), &obj1); + else if (obj1.isReal()) { + width = (int)obj1.getReal(); } - if (obj1.isArray()) { - obj1.arrayGet(0, &obj2); - if (obj2.isInt() && obj2.getInt() == 1) - invert = gTrue; - obj2.free(); - } else if (!obj1.isNull()) { - goto err2; + else { + goto err2; } obj1.free(); - - // draw it - builder->addImageMask(state, str, width, height, invert); - - } else { - - // get color space and color map - dict->lookup(const_cast("ColorSpace"), &obj1); + dict->lookup(const_cast("Height"), &obj1); if (obj1.isNull()) { - obj1.free(); - dict->lookup(const_cast("CS"), &obj1); + obj1.free(); + dict->lookup(const_cast("H"), &obj1); } - if (obj1.isName()) { - res->lookupColorSpace(obj1.getName(), &obj2); - if (!obj2.isNull()) { - obj1.free(); - obj1 = obj2; - } else { - obj2.free(); - } + if (obj1.isInt()) { + height = obj1.getInt(); } - if (!obj1.isNull()) { -#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) - colorSpace = GfxColorSpace::parse(&obj1, NULL); -#else - colorSpace = GfxColorSpace::parse(&obj1); -#endif - } else if (csMode == streamCSDeviceGray) { - colorSpace = new GfxDeviceGrayColorSpace(); - } else if (csMode == streamCSDeviceRGB) { - colorSpace = new GfxDeviceRGBColorSpace(); - } else if (csMode == streamCSDeviceCMYK) { - colorSpace = new GfxDeviceCMYKColorSpace(); - } else { - colorSpace = NULL; + else if (obj1.isReal()){ + height = static_cast(obj1.getReal()); } - obj1.free(); - if (!colorSpace) { - goto err1; + else { + goto err2; } - dict->lookup(const_cast("Decode"), &obj1); + obj1.free(); + + // image or mask? + dict->lookup(const_cast("ImageMask"), &obj1); if (obj1.isNull()) { - obj1.free(); - dict->lookup(const_cast("D"), &obj1); + obj1.free(); + dict->lookup(const_cast("IM"), &obj1); + } + mask = gFalse; + if (obj1.isBool()) { + mask = obj1.getBool(); + } + else if (!obj1.isNull()) { + goto err2; } - colorMap = new GfxImageColorMap(bits, &obj1, colorSpace); obj1.free(); - if (!colorMap->isOk()) { - delete colorMap; - goto err1; - } - - // get the mask - haveColorKeyMask = haveExplicitMask = haveSoftMask = gFalse; - maskStr = NULL; // make gcc happy - maskWidth = maskHeight = 0; // make gcc happy - maskInvert = gFalse; // make gcc happy - maskColorMap = NULL; // make gcc happy - dict->lookup(const_cast("Mask"), &maskObj); - dict->lookup(const_cast("SMask"), &smaskObj); - if (smaskObj.isStream()) { - // soft mask - if (inlineImg) { - goto err1; - } - maskStr = smaskObj.getStream(); - maskDict = smaskObj.streamGetDict(); - maskDict->lookup(const_cast("Width"), &obj1); + + // bit depth + if (bits == 0) { + dict->lookup(const_cast("BitsPerComponent"), &obj1); if (obj1.isNull()) { - obj1.free(); - maskDict->lookup(const_cast("W"), &obj1); + obj1.free(); + dict->lookup(const_cast("BPC"), &obj1); } - if (!obj1.isInt()) { - goto err2; + if (obj1.isInt()) { + bits = obj1.getInt(); + } else if (mask) { + bits = 1; + } else { + goto err2; } - maskWidth = obj1.getInt(); obj1.free(); - maskDict->lookup(const_cast("Height"), &obj1); - if (obj1.isNull()) { - obj1.free(); - maskDict->lookup(const_cast("H"), &obj1); - } - if (!obj1.isInt()) { - goto err2; + } + + // display a mask + if (mask) { + // check for inverted mask + if (bits != 1) { + goto err1; } - maskHeight = obj1.getInt(); - obj1.free(); - maskDict->lookup(const_cast("BitsPerComponent"), &obj1); + invert = gFalse; + dict->lookup(const_cast("Decode"), &obj1); if (obj1.isNull()) { - obj1.free(); - maskDict->lookup(const_cast("BPC"), &obj1); + obj1.free(); + dict->lookup(const_cast("D"), &obj1); } - if (!obj1.isInt()) { - goto err2; + if (obj1.isArray()) { + obj1.arrayGet(0, &obj2); + if (obj2.isInt() && obj2.getInt() == 1) { + invert = gTrue; + } + obj2.free(); + } else if (!obj1.isNull()) { + goto err2; } - int maskBits = obj1.getInt(); obj1.free(); - maskDict->lookup(const_cast("ColorSpace"), &obj1); + + // draw it + builder->addImageMask(state, str, width, height, invert); + + } else { + // get color space and color map + GfxColorSpace *colorSpace; + dict->lookup(const_cast("ColorSpace"), &obj1); if (obj1.isNull()) { - obj1.free(); - maskDict->lookup(const_cast("CS"), &obj1); + obj1.free(); + dict->lookup(const_cast("CS"), &obj1); } if (obj1.isName()) { - res->lookupColorSpace(obj1.getName(), &obj2); - if (!obj2.isNull()) { + res->lookupColorSpace(obj1.getName(), &obj2); + if (!obj2.isNull()) { obj1.free(); obj1 = obj2; - } else { + } else { obj2.free(); - } + } } + if (!obj1.isNull()) { #if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) - maskColorSpace = GfxColorSpace::parse(&obj1, NULL); + colorSpace = GfxColorSpace::parse(&obj1, NULL); #else - maskColorSpace = GfxColorSpace::parse(&obj1); -#endif + colorSpace = GfxColorSpace::parse(&obj1); +#endif + } else if (csMode == streamCSDeviceGray) { + colorSpace = new GfxDeviceGrayColorSpace(); + } else if (csMode == streamCSDeviceRGB) { + colorSpace = new GfxDeviceRGBColorSpace(); + } else if (csMode == streamCSDeviceCMYK) { + colorSpace = new GfxDeviceCMYKColorSpace(); + } else { + colorSpace = NULL; + } obj1.free(); - if (!maskColorSpace || maskColorSpace->getMode() != csDeviceGray) { + if (!colorSpace) { goto err1; } - maskDict->lookup(const_cast("Decode"), &obj1); + dict->lookup(const_cast("Decode"), &obj1); if (obj1.isNull()) { - obj1.free(); - maskDict->lookup(const_cast("D"), &obj1); + obj1.free(); + dict->lookup(const_cast("D"), &obj1); } - maskColorMap = new GfxImageColorMap(maskBits, &obj1, maskColorSpace); + GfxImageColorMap *colorMap = new GfxImageColorMap(bits, &obj1, colorSpace); obj1.free(); - if (!maskColorMap->isOk()) { - delete maskColorMap; + if (!colorMap->isOk()) { + delete colorMap; goto err1; } - //~ handle the Matte entry - haveSoftMask = gTrue; - } else if (maskObj.isArray()) { - // color key mask - for (i = 0; - i < maskObj.arrayGetLength() && i < 2*gfxColorMaxComps; - ++i) { - maskObj.arrayGet(i, &obj1); - maskColors[i] = obj1.getInt(); - obj1.free(); - } - haveColorKeyMask = gTrue; - } else if (maskObj.isStream()) { - // explicit mask - if (inlineImg) { - goto err1; - } - maskStr = maskObj.getStream(); - maskDict = maskObj.streamGetDict(); - maskDict->lookup(const_cast("Width"), &obj1); - if (obj1.isNull()) { - obj1.free(); - maskDict->lookup(const_cast("W"), &obj1); - } - if (!obj1.isInt()) { - goto err2; - } - maskWidth = obj1.getInt(); - obj1.free(); - maskDict->lookup(const_cast("Height"), &obj1); - if (obj1.isNull()) { - obj1.free(); - maskDict->lookup(const_cast("H"), &obj1); - } - if (!obj1.isInt()) { - goto err2; - } - maskHeight = obj1.getInt(); - obj1.free(); - maskDict->lookup(const_cast("ImageMask"), &obj1); - if (obj1.isNull()) { - obj1.free(); - maskDict->lookup(const_cast("IM"), &obj1); - } - if (!obj1.isBool() || !obj1.getBool()) { - goto err2; - } - obj1.free(); - maskInvert = gFalse; - maskDict->lookup(const_cast("Decode"), &obj1); - if (obj1.isNull()) { - obj1.free(); - maskDict->lookup(const_cast("D"), &obj1); - } - if (obj1.isArray()) { - obj1.arrayGet(0, &obj2); - if (obj2.isInt() && obj2.getInt() == 1) { - maskInvert = gTrue; - } - obj2.free(); - } else if (!obj1.isNull()) { - goto err2; - } - obj1.free(); - haveExplicitMask = gTrue; - } - - // draw it - if (haveSoftMask) { - builder->addSoftMaskedImage(state, str, width, height, colorMap, + + // get the mask + int maskColors[2*gfxColorMaxComps]; + haveColorKeyMask = haveExplicitMask = haveSoftMask = gFalse; + Stream *maskStr = NULL; + int maskWidth = 0; + int maskHeight = 0; + maskInvert = gFalse; + GfxImageColorMap *maskColorMap = NULL; + dict->lookup(const_cast("Mask"), &maskObj); + dict->lookup(const_cast("SMask"), &smaskObj); + Dict* maskDict; + if (smaskObj.isStream()) { + // soft mask + if (inlineImg) { + goto err1; + } + maskStr = smaskObj.getStream(); + maskDict = smaskObj.streamGetDict(); + maskDict->lookup(const_cast("Width"), &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup(const_cast("W"), &obj1); + } + if (!obj1.isInt()) { + goto err2; + } + maskWidth = obj1.getInt(); + obj1.free(); + maskDict->lookup(const_cast("Height"), &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup(const_cast("H"), &obj1); + } + if (!obj1.isInt()) { + goto err2; + } + maskHeight = obj1.getInt(); + obj1.free(); + maskDict->lookup(const_cast("BitsPerComponent"), &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup(const_cast("BPC"), &obj1); + } + if (!obj1.isInt()) { + goto err2; + } + int maskBits = obj1.getInt(); + obj1.free(); + maskDict->lookup(const_cast("ColorSpace"), &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup(const_cast("CS"), &obj1); + } + if (obj1.isName()) { + res->lookupColorSpace(obj1.getName(), &obj2); + if (!obj2.isNull()) { + obj1.free(); + obj1 = obj2; + } else { + obj2.free(); + } + } +#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI) + GfxColorSpace *maskColorSpace = GfxColorSpace::parse(&obj1, NULL); +#else + GfxColorSpace *maskColorSpace = GfxColorSpace::parse(&obj1); +#endif + obj1.free(); + if (!maskColorSpace || maskColorSpace->getMode() != csDeviceGray) { + goto err1; + } + maskDict->lookup(const_cast("Decode"), &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup(const_cast("D"), &obj1); + } + maskColorMap = new GfxImageColorMap(maskBits, &obj1, maskColorSpace); + obj1.free(); + if (!maskColorMap->isOk()) { + delete maskColorMap; + goto err1; + } + //~ handle the Matte entry + haveSoftMask = gTrue; + } else if (maskObj.isArray()) { + // color key mask + int i; + for (i = 0; i < maskObj.arrayGetLength() && i < 2*gfxColorMaxComps; ++i) { + maskObj.arrayGet(i, &obj1); + maskColors[i] = obj1.getInt(); + obj1.free(); + } + haveColorKeyMask = gTrue; + } else if (maskObj.isStream()) { + // explicit mask + if (inlineImg) { + goto err1; + } + maskStr = maskObj.getStream(); + maskDict = maskObj.streamGetDict(); + maskDict->lookup(const_cast("Width"), &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup(const_cast("W"), &obj1); + } + if (!obj1.isInt()) { + goto err2; + } + maskWidth = obj1.getInt(); + obj1.free(); + maskDict->lookup(const_cast("Height"), &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup(const_cast("H"), &obj1); + } + if (!obj1.isInt()) { + goto err2; + } + maskHeight = obj1.getInt(); + obj1.free(); + maskDict->lookup(const_cast("ImageMask"), &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup(const_cast("IM"), &obj1); + } + if (!obj1.isBool() || !obj1.getBool()) { + goto err2; + } + obj1.free(); + maskInvert = gFalse; + maskDict->lookup(const_cast("Decode"), &obj1); + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup(const_cast("D"), &obj1); + } + if (obj1.isArray()) { + obj1.arrayGet(0, &obj2); + if (obj2.isInt() && obj2.getInt() == 1) { + maskInvert = gTrue; + } + obj2.free(); + } else if (!obj1.isNull()) { + goto err2; + } + obj1.free(); + haveExplicitMask = gTrue; + } + + // draw it + if (haveSoftMask) { + builder->addSoftMaskedImage(state, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskColorMap); - delete maskColorMap; - } else if (haveExplicitMask) { - builder->addMaskedImage(state, str, width, height, colorMap, + delete maskColorMap; + } else if (haveExplicitMask) { + builder->addMaskedImage(state, str, width, height, colorMap, maskStr, maskWidth, maskHeight, maskInvert); - } else { - builder->addImage(state, str, width, height, colorMap, - haveColorKeyMask ? maskColors : (int *)NULL); + } else { + builder->addImage(state, str, width, height, colorMap, + haveColorKeyMask ? maskColors : static_cast(NULL)); + } + delete colorMap; + + maskObj.free(); + smaskObj.free(); } - delete colorMap; - maskObj.free(); - smaskObj.free(); - } - - return; + return; err2: - obj1.free(); + obj1.free(); err1: #ifdef POPPLER_NEW_ERRORAPI - error(errSyntaxError, getPos(), "Bad image parameters"); + error(errSyntaxError, getPos(), "Bad image parameters"); #else - error(getPos(), const_cast("Bad image parameters")); + error(getPos(), const_cast("Bad image parameters")); #endif } -- cgit v1.2.3 From 0317aa2df3a1369742f40998b51d2f668296ada8 Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Mon, 11 Mar 2013 23:10:58 +0100 Subject: readding entries in Cmake and make include lists that were not removed after all ( Bug #1120585 ) (bzr r12194) --- src/dom/CMakeLists.txt | 6 +++++- src/dom/Makefile_insert | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/dom/CMakeLists.txt b/src/dom/CMakeLists.txt index 8167e1b03..74832a6f5 100644 --- a/src/dom/CMakeLists.txt +++ b/src/dom/CMakeLists.txt @@ -17,7 +17,9 @@ set(dom_SRC xpathimpl.cpp xpathparser.cpp xpathtoken.cpp - + + io/domstream.cpp + util/digest.cpp util/ziptool.cpp @@ -53,6 +55,8 @@ set(dom_SRC xpathparser.h xpathtoken.h + io/domstream.h + util/digest.h util/ziptool.h ) diff --git a/src/dom/Makefile_insert b/src/dom/Makefile_insert index 058242a36..4ed529a35 100644 --- a/src/dom/Makefile_insert +++ b/src/dom/Makefile_insert @@ -50,6 +50,8 @@ dom_libdom_a_SOURCES = \ dom/xpathparser.h \ dom/xpathtoken.h \ dom/xpathtoken.cpp \ + dom/io/domstream.cpp \ + dom/io/domstream.h \ dom/util/digest.h \ dom/util/digest.cpp \ dom/util/ziptool.h \ -- cgit v1.2.3