Uses the XML2 library
authorarjen <arjen>
Sat, 2 Nov 2002 14:35:15 +0000 (14:35 +0000)
committerarjen <arjen>
Sat, 2 Nov 2002 14:35:15 +0000 (14:35 +0000)
BugFix: segfault when finding a parameters that is not in the user-sepcific
config tree.

src/configuration.cpp
src/configuration.h

index 7772621..c4cce46 100644 (file)
@@ -6,7 +6,7 @@
 ***********************
 **      FILE NAME      : configuration.cpp
 **      SYSTEM NAME    : AXE - Andromeda X-windows Encapsulation
-**      VERSION NUMBER : $Revision: 1.2 $
+**      VERSION NUMBER : $Revision: 1.3 $
 **
 **  DESCRIPTION      :  Implementation of configuration class
 **
 ********************************
 **      ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
 **      CREATION DATE   : Jul 23, 2002
-**      LAST UPDATE     : Jul 24, 2002
+**      LAST UPDATE     : Nov 02, 2002
 **      MODIFICATIONS   : 
 **************************************************************************/
 
 /*****************************
    $Log: configuration.cpp,v $
-   Revision 1.2  2002-09-28 06:48:46  arjen
+   Revision 1.3  2002-11-02 14:35:15  arjen
+   Uses the XML2 library
+   BugFix: segfault when finding a parameters that is not in the user-sepcific
+   config tree.
+
+   Revision 1.2  2002/09/28 06:48:46  arjen
    Bugfix: In configuration::find_parameter(), check if the parameter node exists
    before retrieving its contents.
 
@@ -33,7 +38,7 @@
 
 *****************************/
 
-static const char *RCSID = "$Id: configuration.cpp,v 1.2 2002-09-28 06:48:46 arjen Exp $";
+static const char *RCSID = "$Id: configuration.cpp,v 1.3 2002-11-02 14:35:15 arjen Exp $";
 
 #include "configuration.h"
 
@@ -148,7 +153,7 @@ xmlNodePtr configuration::xmlFindTag(xmlNodePtr node, const String tag)
 **  VARS CHANGED   :
 **  FUNCTIONS USED :
 **  SEE ALSO       :
-**  LAST MODIFIED  : Jul 24, 2002
+**  LAST MODIFIED  : Nov 02, 2002
 **=========================================================================
 */
 
@@ -165,13 +170,13 @@ String configuration::find_parameter(const String section, const String paramete
    if (system)
    {
       root_node    = xmlDocGetRootElement(system);
-      section_node = xmlFindTag(root_node->childs, section);
+      section_node = xmlFindTag(root_node->children, section);
       if (section_node != NULL)
       {
-         param_node = xmlFindTag(section_node->childs, parameter);
+         param_node = xmlFindTag(section_node->children, parameter);
          if (param_node != NULL)
          {
-            param_node = param_node->childs;
+            param_node = param_node->children;
          }
          if (param_node != NULL)
          {
@@ -186,11 +191,14 @@ String configuration::find_parameter(const String section, const String paramete
    if (user)
    {
       root_node    = xmlDocGetRootElement(user);
-      section_node = xmlFindTag(root_node->childs, section);
+      section_node = xmlFindTag(root_node->children, section);
       if (section_node != NULL)
       {
-         param_node = xmlFindTag(section_node->childs, parameter);
-         param_node = param_node->childs;
+         param_node = xmlFindTag(section_node->children, parameter);
+         if (param_node != NULL)
+         {
+            param_node = param_node->children;
+         }
          if (param_node != NULL)
          {
             param_value = (char *)param_node->content;
index 47e81a6..9c59c87 100644 (file)
@@ -5,7 +5,7 @@
 ***********************
 **      FILE NAME      : configuration.h
 **      SYSTEM NAME    : AXE - Andromeda X-windows Encapsulation
-**      VERSION NUMBER : $Revision: 1.2 $
+**      VERSION NUMBER : $Revision: 1.3 $
 **
 **  DESCRIPTION      : Definition of configuration class 
 **
 **  ADMINISTRATIVE INFORMATION *
 ********************************
 **      ORIGINAL AUTHOR : Arjen Baart - arjen@andromeda.nl
-**      CREATION DATE   : Jul 24, 2002
+**      CREATION DATE   : Nov 02, 2002
 **      LAST UPDATE     : 
 **      MODIFICATIONS   : 
 **************************************************************************/
 
 /*****************************
    $Log: configuration.h,v $
-   Revision 1.2  2002-09-02 06:18:20  arjen
+   Revision 1.3  2002-11-02 14:35:15  arjen
+   Uses the XML2 library
+   BugFix: segfault when finding a parameters that is not in the user-sepcific
+   config tree.
+
+   Revision 1.2  2002/09/02 06:18:20  arjen
    Fixed some date and time conversion functions
 
    Revision 1.1  2002/07/25 08:01:26  arjen
 
 *****************************/
 
-/* static const char *RCSID = "$Id: configuration.h,v 1.2 2002-09-02 06:18:20 arjen Exp $"; */
+/* static const char *RCSID = "$Id: configuration.h,v 1.3 2002-11-02 14:35:15 arjen Exp $"; */
 
 #ifndef CONFIGURATION_H
 #define CONFIGURATION_H
 
-#include <parser.h>   // usually in /usr/include/gnome-xml, see xml-config
+#include <libxml/parser.h>   // usually in /usr/include/libxml2, see xml2-config
 
 #include "String.h"