Minor cleanup in XML vector parsing. Minor cleanup in ChangeLocale class. Changed...
authordarco <darco@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Wed, 30 Aug 2006 19:56:28 +0000 (19:56 +0000)
committerdarco <darco@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Wed, 30 Aug 2006 19:56:28 +0000 (19:56 +0000)
git-svn-id: http://svn.voria.com/code@221 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-core/trunk/config/subs.m4
synfig-core/trunk/src/synfig/general.h
synfig-core/trunk/src/synfig/loadcanvas.cpp

index ccce797..7760ed2 100644 (file)
@@ -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
index b6069a9..9dc0059 100644 (file)
 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());
     }
 };
 
index 49ee884..6edf4e5 100644 (file)
@@ -317,13 +317,7 @@ CanvasParser::parse_vector(xmlpp::Element *element,Canvas::Handle canvas)
                                error(element, "Undefined value in <x>");
                                return Vector();
                        }
-                       xmlpp::TextNode *text=dynamic_cast<xmlpp::TextNode*>(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 <y>");
                                return Vector();
                        }
-                       xmlpp::TextNode *text=dynamic_cast<xmlpp::TextNode*>(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());