From: joncruz Date: Sat, 1 Mar 2008 09:09:39 +0000 (+0000) Subject: Warning and whitespace cleanup X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f61e22edfbabba7d9ffdfb87c7661a372989e858;p=inkscape.git Warning and whitespace cleanup --- diff --git a/src/display/guideline.cpp b/src/display/guideline.cpp index 99dfcc316..3b279f724 100644 --- a/src/display/guideline.cpp +++ b/src/display/guideline.cpp @@ -130,14 +130,14 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf) } else { // render angled line, once intersection has been detected, draw from there. Geom::Point parallel_to_line( gl->normal_to_line[Geom::Y], - /*should be minus, but inverted y axis*/ gl->normal_to_line[Geom::X]); + /*should be minus, but inverted y axis*/ gl->normal_to_line[Geom::X]); //try to intersect with left vertical of rect double y_intersect_left = (buf->rect.x0 - gl->point_on_line[Geom::X]) * parallel_to_line[Geom::Y] / parallel_to_line[Geom::X] + gl->point_on_line[Geom::Y]; if ( (y_intersect_left >= buf->rect.y0) && (y_intersect_left <= buf->rect.y1) ) { // intersects with left vertical! double y_intersect_right = (buf->rect.x1 - gl->point_on_line[Geom::X]) * parallel_to_line[Geom::Y] / parallel_to_line[Geom::X] + gl->point_on_line[Geom::Y]; - sp_guideline_drawline (buf, buf->rect.x0, round(y_intersect_left), buf->rect.x1, round(y_intersect_right), gl->rgba); + sp_guideline_drawline (buf, buf->rect.x0, static_cast(round(y_intersect_left)), buf->rect.x1, static_cast(round(y_intersect_right)), gl->rgba); return; } @@ -145,7 +145,7 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf) double y_intersect_right = (buf->rect.x1 - gl->point_on_line[Geom::X]) * parallel_to_line[Geom::Y] / parallel_to_line[Geom::X] + gl->point_on_line[Geom::Y]; if ( (y_intersect_right >= buf->rect.y0) && (y_intersect_right <= buf->rect.y1) ) { // intersects with right vertical! - sp_guideline_drawline (buf, buf->rect.x1, round(y_intersect_right), buf->rect.x0, round(y_intersect_left), gl->rgba); + sp_guideline_drawline (buf, buf->rect.x1, static_cast(round(y_intersect_right)), buf->rect.x0, static_cast(round(y_intersect_left)), gl->rgba); return; } @@ -154,7 +154,7 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf) if ( (x_intersect_top >= buf->rect.x0) && (x_intersect_top <= buf->rect.x1) ) { // intersects with top horizontal! double x_intersect_bottom = (buf->rect.y1 - gl->point_on_line[Geom::Y]) * parallel_to_line[Geom::X] / parallel_to_line[Geom::Y] + gl->point_on_line[Geom::X]; - sp_guideline_drawline (buf, round(x_intersect_top), buf->rect.y0, round(x_intersect_bottom), buf->rect.y1, gl->rgba); + sp_guideline_drawline (buf, static_cast(round(x_intersect_top)), buf->rect.y0, static_cast(round(x_intersect_bottom)), buf->rect.y1, gl->rgba); return; } @@ -162,7 +162,7 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf) double x_intersect_bottom = (buf->rect.y1 - gl->point_on_line[Geom::Y]) * parallel_to_line[Geom::X] / parallel_to_line[Geom::Y] + gl->point_on_line[Geom::X]; if ( (x_intersect_top >= buf->rect.x0) && (x_intersect_top <= buf->rect.x1) ) { // intersects with bottom horizontal! - sp_guideline_drawline (buf, round(x_intersect_bottom), buf->rect.y1, round(x_intersect_top), buf->rect.y0, gl->rgba); + sp_guideline_drawline (buf, static_cast(round(x_intersect_bottom)), buf->rect.y1, static_cast(round(x_intersect_top)), buf->rect.y0, gl->rgba); return; } } diff --git a/src/extension/paramenum.h b/src/extension/paramenum.h index b01a15344..5ea4a0196 100644 --- a/src/extension/paramenum.h +++ b/src/extension/paramenum.h @@ -1,5 +1,5 @@ -#ifndef __INK_EXTENSION_PARAMENUM_H__ -#define __INK_EXTENSION_PARAMENUM_H__ +#ifndef INK_EXTENSION_PARAMENUM_H_SEEN +#define INK_EXTENSION_PARAMENUM_H_SEEN /** \file * Enumeration parameter for extensions. @@ -30,21 +30,21 @@ namespace Extension { class ParamComboBox : public Parameter { private: /** \brief Internal value. This should point to a string that has - been allocated in memory. And should be free'd. + been allocated in memory. And should be free'd. It is the value of the current selected string */ gchar * _value; - + GSList * choices; /**< A table to store the choice strings */ - + public: ParamComboBox(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); virtual ~ParamComboBox(void); Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void string (std::string &string); - - const gchar * get (const SPDocument * doc, const Inkscape::XML::Node * node) { return _value; } + + const gchar * get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } const gchar * set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node); - + void changed (void); }; /* class ParamComboBox */ @@ -55,7 +55,7 @@ public: } /* namespace Extension */ } /* namespace Inkscape */ -#endif /* __INK_EXTENSION_PARAMENUM_H__ */ +#endif /* INK_EXTENSION_PARAMENUM_H_SEEN */ /* Local Variables: diff --git a/src/extension/parameter.cpp b/src/extension/parameter.cpp index 9a7535a25..dd80cf59c 100644 --- a/src/extension/parameter.cpp +++ b/src/extension/parameter.cpp @@ -74,12 +74,12 @@ public: ParamEnum(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); ~ParamEnum(void); /** \brief Returns \c _value, with a \i const to protect it. */ - const gchar * get (const SPDocument * doc, const Inkscape::XML::Node * node) { return _current_choice != NULL ? _current_choice->_value : NULL; } + const gchar * get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _current_choice != NULL ? _current_choice->_value : NULL; } const gchar * set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node); Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); Glib::ustring * string (void); }; /* class ParamEnum */ - + /** \return None \brief This function creates a parameter that can be used later. This @@ -169,7 +169,7 @@ Parameter::make (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * bool Parameter::get_bool (const SPDocument * doc, const Inkscape::XML::Node * node) { - ParamBool * boolpntr = dynamic_cast(this); + ParamBool * boolpntr = dynamic_cast(this); if (boolpntr == NULL) throw Extension::param_not_bool_param(); return boolpntr->get(doc, node); @@ -179,7 +179,7 @@ Parameter::get_bool (const SPDocument * doc, const Inkscape::XML::Node * node) int Parameter::get_int (const SPDocument * doc, const Inkscape::XML::Node * node) { - ParamInt * intpntr = dynamic_cast(this); + ParamInt * intpntr = dynamic_cast(this); if (intpntr == NULL) throw Extension::param_not_int_param(); return intpntr->get(doc, node); @@ -189,7 +189,7 @@ Parameter::get_int (const SPDocument * doc, const Inkscape::XML::Node * node) float Parameter::get_float (const SPDocument * doc, const Inkscape::XML::Node * node) { - ParamFloat * floatpntr = dynamic_cast(this); + ParamFloat * floatpntr = dynamic_cast(this); if (floatpntr == NULL) throw Extension::param_not_float_param(); return floatpntr->get(doc, node); @@ -238,7 +238,7 @@ Parameter::set_bool (bool in, SPDocument * doc, Inkscape::XML::Node * node) int Parameter::set_int (int in, SPDocument * doc, Inkscape::XML::Node * node) { - ParamInt * intpntr = dynamic_cast(this); + ParamInt * intpntr = dynamic_cast(this); if (intpntr == NULL) throw Extension::param_not_int_param(); return intpntr->set(in, doc, node); @@ -259,7 +259,7 @@ Parameter::set_float (float in, SPDocument * doc, Inkscape::XML::Node * node) const gchar * Parameter::set_string (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node) { - ParamString * stringpntr = dynamic_cast(this); + ParamString * stringpntr = dynamic_cast(this); if (stringpntr == NULL) throw Extension::param_not_string_param(); return stringpntr->set(in, doc, node); @@ -357,14 +357,14 @@ Parameter::document_param_node (SPDocument * doc) /** \brief Basically, if there is no widget pass a NULL. */ Gtk::Widget * -Parameter::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) +Parameter::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal * /*changeSignal*/) { return NULL; } /** \brief If I'm not sure which it is, just don't return a value. */ -void -Parameter::string (std::string &string) +void +Parameter::string (std::string &/*string*/) { return; } @@ -392,7 +392,7 @@ Parameter::string (std::list &list) -ParamEnum::ParamEnum (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) : +ParamEnum::ParamEnum (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * /*xml*/) : Parameter(name, guitext, desc, scope, ext), _current_choice(NULL) { return; @@ -413,13 +413,13 @@ ParamEnum::string (void) } Gtk::Widget * -ParamEnum::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) +ParamEnum::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal * /*changeSignal*/) { return NULL; } const gchar * -ParamEnum::set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node) +ParamEnum::set (const gchar * /*in*/, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) { return NULL; } diff --git a/src/extension/paramnotebook.cpp b/src/extension/paramnotebook.cpp index ea74f10b4..7862edeb1 100644 --- a/src/extension/paramnotebook.cpp +++ b/src/extension/paramnotebook.cpp @@ -48,7 +48,7 @@ private: This only gets created if there are parameters on this page */ Gtk::Tooltips * _tooltips; - + public: static ParamNotebookPage * makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext); @@ -57,7 +57,7 @@ public: Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void paramString (std::list &list); gchar * get_guitext (void) {return _text;}; - + }; /* class ParamNotebookPage */ @@ -65,7 +65,7 @@ ParamNotebookPage::ParamNotebookPage (const gchar * name, const gchar * guitext, Parameter(name, guitext, desc, scope, ext) { parameters = NULL; - + // Read XML to build page if (xml != NULL) { Inkscape::XML::Node *child_repr = sp_repr_children(xml); @@ -81,7 +81,7 @@ ParamNotebookPage::ParamNotebookPage (const gchar * name, const gchar * guitext, child_repr = sp_repr_next(child_repr); } } - + return; } @@ -166,7 +166,7 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension: } ParamNotebookPage * page = new ParamNotebookPage(name, guitext, desc, scope, in_ext, in_repr); - + /* Note: page could equal NULL */ return page; } @@ -180,26 +180,26 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension: */ Gtk::Widget * ParamNotebookPage::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) -{ +{ if (!_tooltips) _tooltips = new Gtk::Tooltips(); - + Gtk::VBox * vbox = Gtk::manage(new Gtk::VBox); - vbox->set_border_width(5); - - // add parameters onto page (if any) + vbox->set_border_width(5); + + // add parameters onto page (if any) for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) { Parameter * param = reinterpret_cast(list->data); Gtk::Widget * widg = param->get_widget(doc, node, changeSignal); gchar const * tip = param->get_tooltip(); - + vbox->pack_start(*widg, true, true, 2); if (tip != NULL) { _tooltips->set_tip(*widg, Glib::ustring(tip)); } } - + vbox->show(); - + return dynamic_cast(vbox); } @@ -215,7 +215,7 @@ ParamNotebook::ParamNotebook (const gchar * name, const gchar * guitext, const g Parameter(name, guitext, desc, scope, ext) { pages = NULL; - + // Read XML tree to add pages: if (xml != NULL) { Inkscape::XML::Node *child_repr = sp_repr_children(xml); @@ -231,7 +231,7 @@ ParamNotebook::ParamNotebook (const gchar * name, const gchar * guitext, const g child_repr = sp_repr_next(child_repr); } } - + // Initialize _value with the current page const char * defaultval = NULL; // set first page as default @@ -248,7 +248,7 @@ ParamNotebook::ParamNotebook (const gchar * name, const gchar * guitext, const g defaultval = paramval; if (defaultval != NULL) _value = g_strdup(defaultval); // allocate space for _value - + return; } @@ -279,7 +279,7 @@ ParamNotebook::~ParamNotebook (void) the passed in value is duplicated using \c g_strdup(). */ const gchar * -ParamNotebook::set (const int in, SPDocument * doc, Inkscape::XML::Node * node) +ParamNotebook::set (const int in, SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/) { ParamNotebookPage * page = NULL; int i = 0; @@ -287,9 +287,9 @@ ParamNotebook::set (const int in, SPDocument * doc, Inkscape::XML::Node * node) page = reinterpret_cast(list->data); i++; } - + if (page == NULL) return _value; - + if (_value != NULL) g_free(_value); _value = g_strdup(page->name()); @@ -307,7 +307,7 @@ ParamNotebook::set (const int in, SPDocument * doc, Inkscape::XML::Node * node) This is really a hack. The function is called by Extension::paramString() to build the commandline string like: '--param1name=\"param1value\" --param2name=\"param2value\" ...' - Extension::paramString expects this function to return '\"param1value\"'; but instead, + Extension::paramString expects this function to return '\"param1value\"'; but instead, this function returns: '\"param1value\" --page1param1name=\"page1param1value\" ...' \TODO Do this better. For example, make Parameter::paramString() that returns '--name=\"value\"' @@ -363,7 +363,7 @@ public: notebookpages are added or removed. */ void -ParamNotebookWdg::changed_page(GtkNotebookPage *page, +ParamNotebookWdg::changed_page(GtkNotebookPage */*page*/, guint pagenum) { if (is_visible()) { @@ -384,11 +384,11 @@ ParamNotebook::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::s { ParamNotebookWdg * nb = Gtk::manage(new ParamNotebookWdg(this, doc, node)); - // add pages (if any) + // add pages (if any) int i = -1; int pagenr = i; for (GSList * list = pages; list != NULL; list = g_slist_next(list)) { - i++; + i++; ParamNotebookPage * page = reinterpret_cast(list->data); Gtk::Widget * widg = page->get_widget(doc, node, changeSignal); nb->append_page(*widg, _(page->get_guitext())); @@ -398,7 +398,7 @@ ParamNotebook::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::s } nb->show(); - + if (pagenr >= 0) nb->set_current_page(pagenr); return dynamic_cast(nb); diff --git a/src/extension/paramnotebook.h b/src/extension/paramnotebook.h index 4b98ea967..7f976113a 100644 --- a/src/extension/paramnotebook.h +++ b/src/extension/paramnotebook.h @@ -1,5 +1,5 @@ -#ifndef __INK_EXTENSION_PARAMNOTEBOOK_H__ -#define __INK_EXTENSION_PARAMNOTEBOOK_H__ +#ifndef INK_EXTENSION_PARAMNOTEBOOK_H_SEEN +#define INK_EXTENSION_PARAMNOTEBOOK_H_SEEN /** \file * Notebook parameter for extensions. @@ -30,10 +30,10 @@ namespace Extension { class ParamNotebook : public Parameter { private: /** \brief Internal value. This should point to a string that has - been allocated in memory. And should be free'd. + been allocated in memory. And should be free'd. It is the name of the current page. */ gchar * _value; - + GSList * pages; /**< A table to store the pages with parameters for this notebook. This only gets created if there are pages in this notebook */ @@ -42,8 +42,8 @@ public: virtual ~ParamNotebook(void); Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void string (std::list &list); - - const gchar * get (const SPDocument * doc, const Inkscape::XML::Node * node) { return _value; } + + const gchar * get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } const gchar * set (const int in, SPDocument * doc, Inkscape::XML::Node * node); }; /* class ParamNotebook */ @@ -54,7 +54,7 @@ public: } /* namespace Extension */ } /* namespace Inkscape */ -#endif /* __INK_EXTENSION_PARAMNOTEBOOK_H__ */ +#endif /* INK_EXTENSION_PARAMNOTEBOOK_H_SEEN */ /* Local Variables: diff --git a/src/extension/paramradiobutton.h b/src/extension/paramradiobutton.h index 584e45219..d7d034d60 100644 --- a/src/extension/paramradiobutton.h +++ b/src/extension/paramradiobutton.h @@ -1,5 +1,5 @@ -#ifndef __INK_EXTENSION_PARAMRADIOBUTTON_H__ -#define __INK_EXTENSION_PARAMRADIOBUTTON_H__ +#ifndef INK_EXTENSION_PARAMRADIOBUTTON_H_SEEN +#define INK_EXTENSION_PARAMRADIOBUTTON_H_SEEN /** \file * Radiobutton parameter for extensions. @@ -30,19 +30,19 @@ namespace Extension { class ParamRadioButton : public Parameter { private: /** \brief Internal value. This should point to a string that has - been allocated in memory. And should be free'd. + been allocated in memory. And should be free'd. It is the value of the current selected string */ gchar * _value; - + GSList * choices; /**< A table to store the choice strings */ - + public: ParamRadioButton(const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); virtual ~ParamRadioButton(void); Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void string (std::string &string); - - const gchar * get (const SPDocument * doc, const Inkscape::XML::Node * node) { return _value; } + + const gchar * get (const SPDocument * /*doc*/, const Inkscape::XML::Node * /*node*/) { return _value; } const gchar * set (const gchar * in, SPDocument * doc, Inkscape::XML::Node * node); }; /* class ParamRadioButton */ @@ -53,5 +53,5 @@ public: } /* namespace Extension */ } /* namespace Inkscape */ -#endif /* __INK_EXTENSION_PARAMRADIOBUTTON_H__ */ +#endif /* INK_EXTENSION_PARAMRADIOBUTTON_H_SEEN */ diff --git a/src/extension/patheffect.cpp b/src/extension/patheffect.cpp index e45d0b255..8e3fc13f1 100644 --- a/src/extension/patheffect.cpp +++ b/src/extension/patheffect.cpp @@ -28,7 +28,7 @@ PathEffect::~PathEffect (void) } void -PathEffect::processPath (SPDocument * doc, Inkscape::XML::Node * path, Inkscape::XML::Node * def) +PathEffect::processPath (SPDocument * /*doc*/, Inkscape::XML::Node * /*path*/, Inkscape::XML::Node * /*def*/) { diff --git a/src/live_effects/parameter/random.cpp b/src/live_effects/parameter/random.cpp index 9213a6a6b..a5aa014a2 100644 --- a/src/live_effects/parameter/random.cpp +++ b/src/live_effects/parameter/random.cpp @@ -54,7 +54,7 @@ RandomParam::param_readSVGValue(const gchar * strvalue) if (success == 1) { success += sp_svg_number_read_d(stringarray[1], &newstartseed); if (success == 2) { - param_set_value(newval, newstartseed); + param_set_value(newval, static_cast(newstartseed)); } else { param_set_value(newval, defseed); } diff --git a/src/xml/repr-css.cpp b/src/xml/repr-css.cpp index 0a2e215a0..afa0ca2ef 100644 --- a/src/xml/repr-css.cpp +++ b/src/xml/repr-css.cpp @@ -26,7 +26,7 @@ public: NodeType type() const { return Inkscape::XML::ELEMENT_NODE; } protected: - SimpleNode *_duplicate(Document* doc) const { return new SPCSSAttrImpl(*this); } + SimpleNode *_duplicate(Document* /*doc*/) const { return new SPCSSAttrImpl(*this); } }; static void sp_repr_css_add_components(SPCSSAttr *css, Node *repr, gchar const *attr); @@ -156,7 +156,7 @@ sp_repr_css_write_string(SPCSSAttr *css) buffer.append(g_quark_to_string(iter->key)); buffer.push_back(':'); if (!strcmp(g_quark_to_string(iter->key), "font-family") - || !strcmp(g_quark_to_string(iter->key), "-inkscape-font-specification")) { + || !strcmp(g_quark_to_string(iter->key), "-inkscape-font-specification")) { // we only quote font-family/font-specification, as SPStyle does gchar *t = g_strdup (iter->value); g_free (t);