Skip to content

Commit

Permalink
Use the new XML macros for portability
Browse files Browse the repository at this point in the history
  • Loading branch information
megastep committed Feb 10, 2006
1 parent 45f4ae6 commit 77d16e7
Show file tree
Hide file tree
Showing 9 changed files with 175 additions and 178 deletions.
34 changes: 17 additions & 17 deletions carbon_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static void EnableTree(xmlNodePtr node, OptionsBox *box)
//gtk_widget_set_sensitive(button, TRUE);
EnableControl(button->Control);
}
node = node->childs;
node = XML_CHILDREN(node);
while(node)
{
EnableTree(node, box);
Expand Down Expand Up @@ -227,7 +227,7 @@ static void parse_option(install_info *info, const char *component, xmlNodePtr n
mark_option(info, node, "false", 1);
}
/* Recurse down any other options */
child = node->childs;
child = XML_CHILDREN(node);
while ( child ) {
if ( !strcmp(child->name, "option") ) {
//parse_option(info, component, child, window, box, level+1, button, 0, NULL);
Expand All @@ -236,7 +236,7 @@ static void parse_option(install_info *info, const char *component, xmlNodePtr n
xmlNodePtr exchild;
//GSList *list = NULL;
RadioGroup *list = NULL;
for ( exchild = child->childs; exchild; exchild = exchild->next) {
for ( exchild = XML_CHILDREN(child); exchild; exchild = exchild->next) {
//parse_option(info, component, exchild, window, box, level+1, button, 1, &list);
parse_option(info, component, exchild, box, level+1, button, 1, &list);
}
Expand Down Expand Up @@ -345,12 +345,12 @@ static void init_install_path(void)
carbon_debug("init_install_path()\n");

static char AppBundlePath[INSTALLFOLDER_MAX_PATH];
char *appbundleid = xmlGetProp(cur_info->config->root, "appbundleid");
char *appbundleid = xmlGetProp(XML_ROOT(cur_info->config), "appbundleid");
if (appbundleid) {
static int alreadyfound = 0;
if (!alreadyfound) {
char *appbundledesc = xmlGetProp(cur_info->config->root, "appbundledesc");
char *desc = xmlGetProp(cur_info->config->root, "desc");
char *appbundledesc = xmlGetProp(XML_ROOT(cur_info->config), "appbundledesc");
char *desc = xmlGetProp(XML_ROOT(cur_info->config), "desc");
int rc = FindAppBundlePath(appbundleid, appbundledesc, desc, AppBundlePath, sizeof (AppBundlePath));
if (appbundledesc) xmlFree(appbundledesc);
if (desc) xmlFree(desc);
Expand Down Expand Up @@ -608,7 +608,7 @@ int OnOptionClickEvent(OptionsButton *ButtonWithEventClick)

// does this option require a seperate EULA?
xmlNodePtr child;
child = data_node->childs;
child = XML_CHILDREN(data_node);
while(child)
{
if (!strcmp(child->name, "eula"))
Expand Down Expand Up @@ -645,7 +645,7 @@ int OnOptionClickEvent(OptionsButton *ButtonWithEventClick)
mark_option(cur_info, data_node, "true", 0);

/* Recurse down any other options to re-enable grayed out options */
node = data_node->childs;
node = XML_CHILDREN(data_node);
while ( node ) {
//enable_tree(node, window);
EnableTree(node, (OptionsBox *)ButtonWithEventClick->Box);
Expand All @@ -659,7 +659,7 @@ int OnOptionClickEvent(OptionsButton *ButtonWithEventClick)
mark_option(cur_info, data_node, "false", 1);

/* Recurse down any other options */
node = data_node->childs;
node = XML_CHILDREN(data_node);
while ( node ) {
if ( !strcmp(node->name, "option") ) {
//GtkWidget *button;
Expand All @@ -676,7 +676,7 @@ int OnOptionClickEvent(OptionsButton *ButtonWithEventClick)
}
} else if ( !strcmp(node->name, "exclusive") ) {
xmlNodePtr child;
for ( child = node->childs; child; child = child->next) {
for ( child = XML_CHILDREN(node); child; child = child->next) {
//GtkWidget *button;

//button = (GtkWidget*)gtk_object_get_data(GTK_OBJECT(window),
Expand All @@ -694,7 +694,7 @@ int OnOptionClickEvent(OptionsButton *ButtonWithEventClick)
node = node->next;
}
}
cur_info->install_size = size_tree(cur_info, cur_info->config->root->childs);
cur_info->install_size = size_tree(cur_info, XML_CHILDREN(XML_ROOT(cur_info->config)));
update_size();

return true;
Expand Down Expand Up @@ -973,7 +973,7 @@ static install_state carbonui_init(install_info *info, int argc, char **argv, in
}

// Disable dock option if not requested in dockoption attribute
/*const char *DesktopOptionString = xmlGetProp(cur_info->config->root, "desktopicon");
/*const char *DesktopOptionString = xmlGetProp(XML_ROOT(cur_info->config), "desktopicon");
if(DesktopOptionString != NULL)
{
printf("carbonui_init() - desktopicon = %s\n", DesktopOptionString);
Expand Down Expand Up @@ -1001,7 +1001,7 @@ static install_state carbonui_init(install_info *info, int argc, char **argv, in
carbon_HideControl(MyRes, OPTION_SYMBOLIC_LINK_CHECK_ID);

// Set initial install size
info->install_size = size_tree(info, info->config->root->childs);
info->install_size = size_tree(info, XML_CHILDREN(XML_ROOT(info->config)));

// Needed so that Expert is detected properly at this point
//license_okay = 1;
Expand Down Expand Up @@ -1119,7 +1119,7 @@ static install_state carbonui_setup(install_info *info)
//gtk_container_foreach(GTK_CONTAINER(options), empty_container, options);
options = carbon_OptionsNewBox(MyRes, true, OnOptionClickEvent);
info->install_size = 0;
node = info->config->root->childs;
node = XML_CHILDREN(XML_ROOT(info->config));
radio_list = NULL;
in_setup = TRUE;
while ( node ) {
Expand All @@ -1128,7 +1128,7 @@ static install_state carbonui_setup(install_info *info)
} else if ( ! strcmp(node->name, "exclusive") ) {
xmlNodePtr child;
RadioGroup *list = NULL;
for ( child = node->childs; child; child = child->next) {
for ( child = XML_CHILDREN(node); child; child = child->next) {
parse_option(info, NULL, child, options, 0, NULL, 1, &list);
}
} else if ( ! strcmp(node->name, "component") ) {
Expand All @@ -1146,14 +1146,14 @@ static install_state carbonui_setup(install_info *info)
//gtk_widget_show(widget);
carbon_OptionsNewLabel(options, xmlGetProp(node, "name"));
}
for ( child = node->childs; child; child = child->next) {
for ( child = XML_CHILDREN(node); child; child = child->next) {
if ( ! strcmp(child->name, "option") ) {
//parse_option(info, xmlGetProp(node, "name"), child, window, options, 0, NULL, 0, NULL);
parse_option(info, xmlGetProp(node, "name"), child, options, 0, NULL, 0, NULL);
} else if ( ! strcmp(child->name, "exclusive") ) {
xmlNodePtr child2;
RadioGroup *list = NULL;
for ( child2 = child->childs; child2; child2 = child2->next) {
for ( child2 = XML_CHILDREN(child); child2; child2 = child2->next) {
//parse_option(info, xmlGetProp(node, "name"), child2, window, options, 0, NULL, 1, &list);
parse_option(info, xmlGetProp(node, "name"), child2, options, 0, NULL, 1, &list);
}
Expand Down
6 changes: 3 additions & 3 deletions check.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Check and Rescue Tool for Loki Setup packages. Verifies the consistency of the files,
* and optionally restores them from the original installation medium.
*
* $Id: check.c,v 1.13 2004-11-02 03:48:57 megastep Exp $
* $Id: check.c,v 1.14 2006-02-10 01:40:36 megastep Exp $
*/

#include <stdlib.h>
Expand Down Expand Up @@ -214,7 +214,7 @@ int check_xml_setup(const char *file, const char *product)
int ret = 0;
xmlDocPtr doc = xmlParseFile(file);
if ( doc ) {
const char *prod = xmlGetProp(doc->root, "product");
const char *prod = xmlGetProp(XML_ROOT(doc), "product");
if ( prod && !strcmp(prod, product) ) {
ret = 1;
}
Expand Down Expand Up @@ -291,7 +291,7 @@ on_media_ok_clicked (GtkButton *button,

/* Enable the relevant options */
select_corrupt_options(install);
copy_tree(install, install->config->root->childs, install->install_path, NULL);
copy_tree(install, XML_CHILDREN(XML_ROOT(install->config)), install->install_path, NULL);

/* Menu items are currently not being restored - maybe they should be tagged in setupdb ? */

Expand Down
6 changes: 3 additions & 3 deletions check_carbon.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Check and Rescue Tool for Loki Setup packages. Verifies the consistency of the files,
* and optionally restores them from the original installation medium.
*
* $Id: check_carbon.c,v 1.6 2004-11-02 03:48:57 megastep Exp $
* $Id: check_carbon.c,v 1.7 2006-02-10 01:40:36 megastep Exp $
*/

#include <stdlib.h>
Expand Down Expand Up @@ -161,7 +161,7 @@ int check_xml_setup(const char *file, const char *product)
int ret = 0;
xmlDocPtr doc = xmlParseFile(file);
if ( doc ) {
const char *prod = xmlGetProp(doc->root, "product");
const char *prod = xmlGetProp(XML_ROOT(doc), "product");
if ( prod && !strcmp(prod, product) ) {
ret = 1;
}
Expand Down Expand Up @@ -237,7 +237,7 @@ void DoMediaCheck(const char *Dir)

/* Enable the relevant options */
select_corrupt_options(install);
copy_tree(install, install->config->root->childs, install->install_path, NULL);
copy_tree(install, XML_CHILDREN(XML_ROOT(install->config)), install->install_path, NULL);

/* Menu items are currently not being restored - maybe they should be tagged in setupdb ? */

Expand Down
20 changes: 10 additions & 10 deletions console_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ static int parse_option(install_info *info, const char *component, xmlNodePtr no
if ( comp &&
loki_find_option(comp, get_option_name(info,node,NULL,0)) ) {
/* Recurse down any other options */
node = node->childs;
node = XML_CHILDREN(node);
while ( node ) {
if ( ! strcmp((char *)node->name, "option") ) {
parse_option(info, component, node, 0, 0);
} else if ( ! strcmp((char *)node->name, "exclusive") ) {
xmlNodePtr child;
int reinst = GetReinstallNode(info, node);
for ( child = node->childs; child && parse_option(info, component, child, 1, reinst); child = child->next)
for ( child = XML_CHILDREN(node); child && parse_option(info, component, child, 1, reinst); child = child->next)
;
}
node = node->next;
Expand Down Expand Up @@ -248,7 +248,7 @@ static int parse_option(install_info *info, const char *component, xmlNodePtr no
info->install_size += size_node(info, node);

/* Recurse down any other options */
kid = node->childs;
kid = XML_CHILDREN(node);
while ( kid ) {
if ( ! strcmp((char *)kid->name, "option") ) {
if ( !strcmp((char *)node->name, "exclusive") ) {
Expand All @@ -259,7 +259,7 @@ static int parse_option(install_info *info, const char *component, xmlNodePtr no
} else if ( ! strcmp((char *)kid->name, "exclusive") ) {
xmlNodePtr child;
int reinst = GetReinstallNode(info, kid);
for ( child = kid->childs; child && parse_option(info, component, child, 1, reinst); child = child->next)
for ( child = XML_CHILDREN(kid); child && parse_option(info, component, child, 1, reinst); child = child->next)
;
}
kid = kid->next;
Expand Down Expand Up @@ -309,7 +309,7 @@ static install_state console_init(install_info *info, int argc, char **argv, int
state = SETUP_README;
}

info->install_size = size_tree(info, info->config->root->childs);
info->install_size = size_tree(info, XML_CHILDREN(XML_ROOT(info->config)));

return state;
}
Expand Down Expand Up @@ -372,7 +372,7 @@ static install_state console_setup(install_info *info)
while ( ! okay ) {
int index = 1, chosen;
const char *wanted;
node = info->config->root->childs;
node = XML_CHILDREN(XML_ROOT(info->config));

printf("%s\n", GetProductDesc(info));
while ( node ) {
Expand All @@ -395,7 +395,7 @@ static install_state console_setup(install_info *info)
}
chosen = atoi(path);
if ( chosen > 0 && chosen < index ) {
node = info->config->root->childs;
node = XML_CHILDREN(XML_ROOT(info->config));
index = 1;
while ( node ) {
if ( strcmp((char *)node->name, "option") == 0 ) {
Expand Down Expand Up @@ -511,14 +511,14 @@ static install_state console_setup(install_info *info)

/* Go through the install options */
info->install_size = 0;
node = info->config->root->childs;
node = XML_CHILDREN(XML_ROOT(info->config));
while ( node ) {
if ( ! strcmp((char *)node->name, "option") ) {
parse_option(info, NULL, node, 0, 0);
} else if ( ! strcmp((char *)node->name, "exclusive") ) {
xmlNodePtr child;
int reinst = GetReinstallNode(info, node);
for ( child = node->childs; child && parse_option(info, NULL, child, 1, reinst); child = child->next)
for ( child = XML_CHILDREN(node); child && parse_option(info, NULL, child, 1, reinst); child = child->next)
;
} else if ( ! strcmp((char *)node->name, "component") ) {
if ( match_arch(info, (char *)xmlGetProp(node, BAD_CAST "arch")) &&
Expand All @@ -532,7 +532,7 @@ static install_state console_setup(install_info *info)
}
printf(_("\n%s component\n\n"), str);
}
for ( child = node->childs; child; child = child->next) {
for ( child = XML_CHILDREN(node); child; child = child->next) {
parse_option(info, (char *)xmlGetProp(node, BAD_CAST "name"), child, 0, 0);
}
}
Expand Down
Loading

0 comments on commit 77d16e7

Please sign in to comment.