X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Floadcanvas.cpp;h=49cf6bcc131fbbc0bccc9e16035afd43df91603b;hb=82f8b521a55c8985cd0189c9c71940a7312eccaa;hp=760a2319f98b44b62ab503aab5a45deba30a1de2;hpb=899bef2135047fcea316348dfdf60af632193006;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/loadcanvas.cpp b/synfig-core/trunk/src/synfig/loadcanvas.cpp index 760a231..49cf6bc 100644 --- a/synfig-core/trunk/src/synfig/loadcanvas.cpp +++ b/synfig-core/trunk/src/synfig/loadcanvas.cpp @@ -6,6 +6,7 @@ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007 Chris Moore ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -290,6 +291,15 @@ CanvasParser::parse_integer(xmlpp::Element *element) return atoi(val.c_str()); } +// see 'minor hack' at the end of parse_vector() below +// making this 'static' to give it file local scope +// stops it working (where working means working around +// bug #1509627) +Vector &canvas_parser_vector_id(Vector &vector) +{ + return vector; +} + Vector CanvasParser::parse_vector(xmlpp::Element *element) { @@ -332,7 +342,12 @@ CanvasParser::parse_vector(xmlpp::Element *element) else error_unexpected_element(child,child->get_name()); } - return vect; + // Minor hack - gcc 4.1.2 and earlier think that we're not using + // 'vect' and optimize it out at -O2 and higher. This convinces + // them that we are really using it. + return canvas_parser_vector_id(vect); + // When the bug is fixed, we can just do this instead: + // return vect; } Color @@ -1535,7 +1550,7 @@ CanvasParser::parse_value_node(xmlpp::Element *element,Canvas::Handle canvas) return value_node; } - // If ValueBase::ident_type() recognises the name, then we know it's a ValueBase + // If ValueBase::ident_type() recognizes the name, then we know it's a ValueBase if(element->get_name()!="canvas" && ValueBase::ident_type(element->get_name())) { ValueBase data=parse_value(element,canvas); @@ -1741,7 +1756,7 @@ CanvasParser::parse_layer(xmlpp::Element *element,Canvas::Handle canvas) continue; } - // If we recognise the element name as a + // If we recognize the element name as a // ValueBase, then treat is at one if(/*(*iter)->get_name()!="canvas" && */ValueBase::ident_type((*iter)->get_name()) && !dynamic_cast(*iter)->get_attribute("guid")) { @@ -1974,7 +1989,7 @@ CanvasParser::parse_canvas(xmlpp::Element *element,Canvas::Handle parent,bool in // If we don't have any name, warn if(list.empty()) - warning(child,_("blank \"name\" entitity")); + warning(child,_("blank \"name\" entity")); string tmp; for(xmlpp::Element::NodeList::iterator iter = list.begin(); iter != list.end(); ++iter) @@ -1989,7 +2004,7 @@ CanvasParser::parse_canvas(xmlpp::Element *element,Canvas::Handle parent,bool in // If we don't have any description, warn if(list.empty()) - warning(child,_("blank \"desc\" entitity")); + warning(child,_("blank \"desc\" entity")); string tmp; for(xmlpp::Element::NodeList::iterator iter = list.begin(); iter != list.end(); ++iter) @@ -2004,7 +2019,7 @@ CanvasParser::parse_canvas(xmlpp::Element *element,Canvas::Handle parent,bool in // If we don't have any description, warn if(list.empty()) - warning(child,_("blank \"author\" entitity")); + warning(child,_("blank \"author\" entity")); string tmp; for(xmlpp::Element::NodeList::iterator iter = list.begin(); iter != list.end(); ++iter) @@ -2029,7 +2044,17 @@ CanvasParser::parse_canvas(xmlpp::Element *element,Canvas::Handle parent,bool in if(canvas->value_node_list().placeholder_count()) { - error(element,strprintf(_("Canvas %s has undefined ValueNodes"),canvas->get_id().c_str())); + String nodes; + for (ValueNodeList::const_iterator iter = canvas->value_node_list().begin(); iter != canvas->value_node_list().end(); iter++) + if(PlaceholderValueNode::Handle::cast_dynamic(*iter)) + { + if (nodes != "") nodes += ", "; + nodes += "'" + (*iter)->get_id() + "'"; + } + error(element,strprintf(_("Canvas '%s' has undefined %s: %s"), + canvas->get_id().c_str(), + canvas->value_node_list().placeholder_count() == 1 ? _("ValueNode") : _("ValueNodes"), + nodes.c_str())); } return canvas; @@ -2044,7 +2069,6 @@ CanvasParser::parse_from_file(const String &file) Canvas::Handle CanvasParser::parse_from_file_as(const String &file_,const String &as_) { - CHECK_EXPIRE_TIME(); try { ChangeLocale change_locale(LC_NUMERIC, "C"); @@ -2105,8 +2129,6 @@ CanvasParser::parse_from_file_as(const String &file_,const String &as_) Canvas::Handle CanvasParser::parse_from_string(const String &data) { - CHECK_EXPIRE_TIME(); - try { ChangeLocale change_locale(LC_NUMERIC, "C");