diff options
| author | Thomas Holder <thomas@thomas-holder.de> | 2019-08-23 15:25:01 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marcjeanmougin@free.fr> | 2019-08-23 17:38:10 +0000 |
| commit | ac61104df7df1b452666a037aeac55d5b71da85d (patch) | |
| tree | 6240a92eebb158c8785e15342a5db7c0ecf3d0a6 /src | |
| parent | Update of Czech translation (diff) | |
| download | inkscape-ac61104df7df1b452666a037aeac55d5b71da85d.tar.gz inkscape-ac61104df7df1b452666a037aeac55d5b71da85d.zip | |
Eliminate clang warnings
-Winfinite-recursion
-Wpessimizing-move
-Wunused-label
-Wunneeded-internal-declaration
-Wself-assign-overloaded
-Wunused-const-variable (some)
-Wsometimes-uninitialized (some)
Diffstat (limited to 'src')
| -rw-r--r-- | src/debug/event.h | 2 | ||||
| -rw-r--r-- | src/debug/simple-event.h | 2 | ||||
| -rw-r--r-- | src/debug/timestamp.cpp | 2 | ||||
| -rw-r--r-- | src/display/sodipodi-ctrlrect.cpp | 2 | ||||
| -rw-r--r-- | src/document.cpp | 17 | ||||
| -rw-r--r-- | src/extension/internal/wmf-inout.cpp | 6 | ||||
| -rw-r--r-- | src/gc-anchored.cpp | 2 | ||||
| -rw-r--r-- | src/gradient-drag.cpp | 6 | ||||
| -rw-r--r-- | src/helper/png-write.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/lpe-offset.cpp | 17 | ||||
| -rw-r--r-- | src/object/sp-object.cpp | 2 | ||||
| -rw-r--r-- | src/sp-cursor.cpp | 2 | ||||
| -rw-r--r-- | src/style-internal.cpp | 1 | ||||
| -rw-r--r-- | src/style.cpp | 3 | ||||
| -rw-r--r-- | src/ui/dialog/export.cpp | 24 | ||||
| -rw-r--r-- | src/ui/tool/node.h | 4 | ||||
| -rw-r--r-- | src/xml/simple-node.cpp | 2 |
17 files changed, 20 insertions, 76 deletions
diff --git a/src/debug/event.h b/src/debug/event.h index db0146b4b..3bc6089f0 100644 --- a/src/debug/event.h +++ b/src/debug/event.h @@ -46,7 +46,7 @@ public: : name(n), value(std::move(v)) {} PropertyPair(char const *n, char const *v) : name(n), - value(std::move(std::make_shared<std::string>(v))) {} + value(std::make_shared<std::string>(v)) {} char const *name; std::shared_ptr<std::string> value; diff --git a/src/debug/simple-event.h b/src/debug/simple-event.h index 983ff5346..c753ae1fe 100644 --- a/src/debug/simple-event.h +++ b/src/debug/simple-event.h @@ -48,7 +48,7 @@ protected: _properties.push_back(PropertyPair(name, std::move(value))); } void _addProperty(char const *name, char const *value) { - _addProperty(name, std::move(std::make_shared<std::string>(value))); + _addProperty(name, std::make_shared<std::string>(value)); } void _addProperty(char const *name, long value) { _addFormattedProperty(name, "%ld", value); diff --git a/src/debug/timestamp.cpp b/src/debug/timestamp.cpp index 619c4a18a..14d211ef3 100644 --- a/src/debug/timestamp.cpp +++ b/src/debug/timestamp.cpp @@ -28,7 +28,7 @@ std::shared_ptr<std::string> timestamp() { gchar *value = g_strdup_printf( "%d.%06d", static_cast<gint>(timestamp.tv_sec), static_cast<gint>(timestamp.tv_usec) ); std::shared_ptr<std::string> result = std::make_shared<std::string>(value); g_free(value); - return std::move(result); + return result; } } diff --git a/src/display/sodipodi-ctrlrect.cpp b/src/display/sodipodi-ctrlrect.cpp index 2900310c5..a50714ac3 100644 --- a/src/display/sodipodi-ctrlrect.cpp +++ b/src/display/sodipodi-ctrlrect.cpp @@ -36,8 +36,6 @@ static void sp_ctrlrect_destroy(SPCanvasItem *object); static void sp_ctrlrect_update(SPCanvasItem *item, Geom::Affine const &affine, unsigned int flags); static void sp_ctrlrect_render(SPCanvasItem *item, SPCanvasBuf *buf); -static const guint DASH_LENGTH = 4; - G_DEFINE_TYPE(CtrlRect, sp_ctrlrect, SP_TYPE_CANVAS_ITEM); static void sp_ctrlrect_class_init(CtrlRectClass *c) diff --git a/src/document.cpp b/src/document.cpp index be0c556f0..c08e5b554 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -1344,23 +1344,6 @@ static std::vector<SPItem*> &find_items_in_area(std::vector<SPItem*> &s, return s; } -/** -Returns true if an item is among the descendants of group (recursively). - */ -static bool item_is_in_group(SPItem *item, SPGroup *group) -{ - for (auto& o: group->children) { - if ( SP_IS_ITEM(&o) ) { - if (SP_ITEM(&o) == item) { - return true; - } else if (SP_IS_GROUP(&o) && item_is_in_group(item, SP_GROUP(&o))) { - return true; - } - } - } - return false; -} - SPItem *SPDocument::getItemFromListAtPointBottom(unsigned int dkey, SPGroup *group, std::vector<SPItem*> const &list,Geom::Point const &p, bool take_insensitive) { g_return_val_if_fail(group, NULL); diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index 4a080da00..2c68076dc 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -1100,12 +1100,12 @@ Wmf::select_brush(PWMF_CALLBACK_DATA d, int index) uint32_t tidx; uint16_t Style; uint16_t cUsage; - const char *Bm16h; // Pointer to Bitmap16 header (px follows) - const char *dib; // Pointer to DIB + const char *Bm16h = nullptr; // Pointer to Bitmap16 header (px follows) + const char *dib = nullptr; // Pointer to DIB (void) U_WMRDIBCREATEPATTERNBRUSH_get(record, &Style, &cUsage, &Bm16h, &dib); if(dib || Bm16h){ if(dib){ tidx = add_dib_image(d, dib, cUsage); } - else if(Bm16h){ + else { U_BITMAP16 Bm16; const char *px; memcpy(&Bm16, Bm16h, U_SIZE_BITMAP16); diff --git a/src/gc-anchored.cpp b/src/gc-anchored.cpp index dc5a9e45c..12eaa8319 100644 --- a/src/gc-anchored.cpp +++ b/src/gc-anchored.cpp @@ -33,7 +33,7 @@ public: { _addProperty("base", Util::format("%p", Core::base(const_cast<Anchored *>(object))).pointer()); _addProperty("pointer", Util::format("%p", object).pointer()); - _addProperty("class", std::move(Debug::demangle(typeid(*object).name()))); + _addProperty("class", Debug::demangle(typeid(*object).name())); _addProperty("new-refcount", object->_anchored_refcount() + bias); } }; diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index 681268991..88247a21a 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -66,12 +66,6 @@ guint32 const GR_KNOT_COLOR_SELECTED = 0x0000ff00; guint32 const GR_KNOT_COLOR_HIGHLIGHT = 0xffffff00; guint32 const GR_KNOT_COLOR_MESHCORNER = 0xbfbfbf00; -guint32 const GR_LINE_COLOR_FILL = 0x0000ff7f; -guint32 const GR_LINE_COLOR_STROKE = 0x9999007f; - -// screen pixels between knots when they snap: -#define SNAP_DIST 5 - // absolute distance between gradient points for them to become a single dragger when the drag is created: #define MERGE_DIST 0.1 diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp index 802d1372d..ba726bfb9 100644 --- a/src/helper/png-write.cpp +++ b/src/helper/png-write.cpp @@ -51,8 +51,6 @@ * working PNG reader/writer, see pngtest.c, included in this distribution. */ -static unsigned int const MAX_STRIPE_SIZE = 1024*1024; - struct SPEBP { unsigned long int width, height, sheight; guint32 background; diff --git a/src/live_effects/lpe-offset.cpp b/src/live_effects/lpe-offset.cpp index d9017a144..4c3aa6b50 100644 --- a/src/live_effects/lpe-offset.cpp +++ b/src/live_effects/lpe-offset.cpp @@ -99,14 +99,7 @@ LPEOffset::LPEOffset(LivePathEffectObject *lpeobject) : LPEOffset::~LPEOffset() = default; -enum fill_type -{ - fill_oddEven = 0, - fill_nonZero = 1, - fill_positive = 2, - fill_justDont = 3 -}; -typedef enum fill_type FillRuleFlatten; +typedef FillRule FillRuleFlatten; static void sp_flatten(Geom::PathVector &pathvector, FillRuleFlatten fillkind) @@ -287,12 +280,8 @@ LPEOffset::doEffect_path(Geom::PathVector const & path_in) const gchar *val; css = sp_repr_css_attr (item->getRepr() , "style"); val = sp_repr_css_property (css, "fill-rule", nullptr); - FillRuleFlatten fillrule; - if (val && strcmp (val, "nonzero") == 0) - { - fillrule = fill_nonZero; - } - else if (val && strcmp (val, "evenodd") == 0) + FillRuleFlatten fillrule = fill_nonZero; + if (val && strcmp (val, "evenodd") == 0) { fillrule = fill_oddEven; } diff --git a/src/object/sp-object.cpp b/src/object/sp-object.cpp index 5936963c7..1d7ae6396 100644 --- a/src/object/sp-object.cpp +++ b/src/object/sp-object.cpp @@ -201,7 +201,7 @@ public: : BaseRefCountEvent(name) { _addProperty("object", Util::format("%p", object).pointer()); - _addProperty("class", std::move(Debug::demangle(g_type_name(G_TYPE_FROM_INSTANCE(object))))); + _addProperty("class", Debug::demangle(g_type_name(G_TYPE_FROM_INSTANCE(object)))); _addProperty("new-refcount", Util::format("%d", G_OBJECT(object)->ref_count + bias).pointer()); } }; diff --git a/src/sp-cursor.cpp b/src/sp-cursor.cpp index 3cac8c633..dd8a30053 100644 --- a/src/sp-cursor.cpp +++ b/src/sp-cursor.cpp @@ -58,7 +58,7 @@ struct RGBA { GdkCursor *sp_cursor_from_xpm(char const *const *xpm, guint32 fill, guint32 stroke) { GdkPixbuf *pixbuf; - GdkCursor *cursor; + GdkCursor *cursor = nullptr; GdkDisplay *display = gdk_display_get_default(); int height = 0; diff --git a/src/style-internal.cpp b/src/style-internal.cpp index e88cad5c0..5ea806b89 100644 --- a/src/style-internal.cpp +++ b/src/style-internal.cpp @@ -409,7 +409,6 @@ void SPILength::setDouble(double v) // Generate a string and allow emove name for parsing dasharray, etc. const Glib::ustring SPILength::toString(bool wname) const { -Inkscape: CSSOStringStream os; if (wname) { os << name << ":"; diff --git a/src/style.cpp b/src/style.cpp index 2d82791af..9af026bd1 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -1222,9 +1222,6 @@ sp_repr_sel_eng() return ret; } -/** Indexed by SP_CSS_FONT_SIZE_blah. These seem a bit small */ -static float const font_size_table[] = {6.0, 8.0, 10.0, 12.0, 14.0, 18.0, 24.0}; - // The following functions should be incorporated into SPIPaint. FIXME // Called in: style.cpp, style-internal.cpp void diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index 2c1ebb45d..7b2f2628d 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -930,26 +930,12 @@ Gtk::Dialog * Export::create_progress_dialog (Glib::ustring progress_text) { // FIXME: Some lib function should be available to do this ... Glib::ustring Export::filename_add_extension (Glib::ustring filename, Glib::ustring extension) { - Glib::ustring::size_type dot; - Glib::ustring::size_type dot_ext; - - dot = filename.find_last_of("."); - dot_ext = filename.lowercase().rfind("." + extension.lowercase()); - if ( dot == std::string::npos ) - { - return filename = filename + "." + extension; - } - else - { - if (dot == dot_ext) - { - return filename = filename; - } - else - { - return filename = filename + "." + extension; - } + auto pos = int(filename.size()) - int(extension.size()); + if (pos > 0 && filename[pos - 1] == '.' && filename.substr(pos).lowercase() == extension.lowercase()) { + return filename; } + + return filename + "." + extension; } Glib::ustring Export::absolutize_path_from_document_location (SPDocument *doc, const Glib::ustring &filename) diff --git a/src/ui/tool/node.h b/src/ui/tool/node.h index b28f70808..d4e09caa0 100644 --- a/src/ui/tool/node.h +++ b/src/ui/tool/node.h @@ -392,10 +392,10 @@ public: iterator before(double t, double *fracpart = nullptr); iterator before(Geom::PathTime const &pvp); const_iterator before(double t, double *fracpart = nullptr) const { - return const_iterator(before(t, fracpart)._node); + return const_cast<NodeList *>(this)->before(t, fracpart)._node; } const_iterator before(Geom::PathTime const &pvp) const { - return const_iterator(before(pvp)._node); + return const_cast<NodeList *>(this)->before(pvp)._node; } // list operations diff --git a/src/xml/simple-node.cpp b/src/xml/simple-node.cpp index a1f0c7024..b628d678a 100644 --- a/src/xml/simple-node.cpp +++ b/src/xml/simple-node.cpp @@ -60,7 +60,7 @@ std::shared_ptr<std::string> stringify_node(Node const &node) { } std::shared_ptr<std::string> result = std::make_shared<std::string>(string); g_free(string); - return std::move(result); + return result; } typedef Debug::SimpleEvent<Debug::Event::XML> DebugXML; |
