From 420856af6e870e6897771965c9d474168c019274 Mon Sep 17 00:00:00 2001 From: darco Date: Wed, 30 Aug 2006 19:56:28 +0000 Subject: [PATCH] Minor cleanup in XML vector parsing. Minor cleanup in ChangeLocale class. Changed the default optimization level from 2 to 1, because -O2 is broken in GCC4.1. The problem with GCC4.1 appears to be inside of loadcanvas.cpp (Specificly in the vector parsing function mentioned above), so this deserves further investigation in the future. git-svn-id: http://svn.voria.com/code@221 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/config/subs.m4 | 4 ++-- synfig-core/trunk/src/synfig/general.h | 9 ++++----- synfig-core/trunk/src/synfig/loadcanvas.cpp | 16 ++-------------- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/synfig-core/trunk/config/subs.m4 b/synfig-core/trunk/config/subs.m4 index ccce797..7760ed2 100644 --- a/synfig-core/trunk/config/subs.m4 +++ b/synfig-core/trunk/config/subs.m4 @@ -100,10 +100,10 @@ AC_DEFUN([AC_ARG_OPTIMIZATION], [ AC_MSG_CHECKING([for optimization flags]) - AC_ARG_ENABLE(optimization,[ --enable-optimization=[[0,1,2,3,4]] Select optimization level (default=2)],[ + AC_ARG_ENABLE(optimization,[ --enable-optimization=[[0,1,2,3,4]] Select optimization level (default=1)],[ optimization=$enableval ],[ - optimization="2" + optimization="1" ]) optimization_flags='' case "$optimization" in diff --git a/synfig-core/trunk/src/synfig/general.h b/synfig-core/trunk/src/synfig/general.h index b6069a9..9dc0059 100644 --- a/synfig-core/trunk/src/synfig/general.h +++ b/synfig-core/trunk/src/synfig/general.h @@ -63,16 +63,15 @@ namespace synfig { class ChangeLocale { - const char *previous; - int category; + const String previous; + const int category; public: ChangeLocale(int category, const char *locale): - previous(setlocale(category,NULL)),category(category) + previous(setlocale(category,locale)),category(category) { - setlocale(category,locale); } ~ChangeLocale() { - setlocale(category,previous); + setlocale(category,previous.c_str()); } }; diff --git a/synfig-core/trunk/src/synfig/loadcanvas.cpp b/synfig-core/trunk/src/synfig/loadcanvas.cpp index 49ee884..6edf4e5 100644 --- a/synfig-core/trunk/src/synfig/loadcanvas.cpp +++ b/synfig-core/trunk/src/synfig/loadcanvas.cpp @@ -317,13 +317,7 @@ CanvasParser::parse_vector(xmlpp::Element *element,Canvas::Handle canvas) error(element, "Undefined value in "); return Vector(); } - xmlpp::TextNode *text=dynamic_cast(child->get_children().front()); - if(!text) - { - error(element,"I need a number, not an element!"); - return Vector(); - } - vect[0]=atof(text->get_content().c_str()); + vect[0]=atof(child->get_child_text()->get_content().c_str()); } else if(child->get_name()=="y") @@ -333,13 +327,7 @@ CanvasParser::parse_vector(xmlpp::Element *element,Canvas::Handle canvas) error(element, "Undefined value in "); return Vector(); } - xmlpp::TextNode *text=dynamic_cast(child->get_children().front()); - if(!text) - { - error(element,"I need a number, not an element!"); - return Vector(); - } - vect[1]=atof(text->get_content().c_str()); + vect[1]=atof(child->get_child_text()->get_content().c_str()); } else error_unexpected_element(child,child->get_name()); -- 2.7.4