From: arjen Date: Sat, 2 Nov 2002 14:35:15 +0000 (+0000) Subject: Uses the XML2 library X-Git-Tag: V0_3~8 X-Git-Url: http://www.andromeda.nl/gitweb/?p=AXE.git;a=commitdiff_plain;h=29d7a2a8f0f344c7fb8d074bacd68fdd46e2b7cf Uses the XML2 library BugFix: segfault when finding a parameters that is not in the user-sepcific config tree. --- diff --git a/src/configuration.cpp b/src/configuration.cpp index 7772621..c4cce46 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -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 ** @@ -18,13 +18,18 @@ ******************************** ** 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; diff --git a/src/configuration.h b/src/configuration.h index 47e81a6..9c59c87 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -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 ** @@ -16,14 +16,19 @@ ** 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 @@ -31,12 +36,12 @@ *****************************/ -/* 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 // usually in /usr/include/gnome-xml, see xml-config +#include // usually in /usr/include/libxml2, see xml2-config #include "String.h"