~ubuntu-branches/ubuntu/maverick/conglomerate/maverick

« back to all changes in this revision

Viewing changes to src/gxx-object-from-xml-tree.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2005-11-08 05:07:06 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051108050706-bcg60nwqf1z3w0d6
Tags: 0.9.1-1ubuntu1
* Resynchronise with Debian (Closes: #4397).
  - Thanks, Jordan Mantha.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 
34
34
#define GXX_STRUCT_ATTRIBUTE_STRING(attr_name, member_name, is_required, default_value) \
35
35
  { \
36
 
    xmlChar *xml_value = xmlGetProp (xml_node, attr_name); \
 
36
    xmlChar *xml_value = xmlGetProp (xml_node, (const xmlChar*)attr_name); \
37
37
    if (xml_value) { \
38
38
      if (inst->member_name) { \
39
39
        g_free (inst->member_name); \
40
40
      } \
41
 
      inst->member_name = g_strdup (xml_value); \
 
41
      inst->member_name = g_strdup ((const gchar*)xml_value);   \
42
42
      xmlFree (xml_value); \
43
43
    } else {\
44
44
      if (is_required) { \
49
49
 
50
50
#define GXX_STRUCT_ATTRIBUTE_ENUM(attr_name, member_name, is_required, default_value, enum_mapping) \
51
51
  { \
52
 
    xmlChar *prop = xmlGetProp (xml_node, attr_name); \
 
52
    xmlChar *prop = xmlGetProp (xml_node, (const xmlChar*)attr_name); \
53
53
    if (prop) { \
54
54
      inst->member_name = cong_enum_mapping_lookup (enum_mapping, \
55
55
                                                    sizeof(enum_mapping)/sizeof(CongEnumMapping), \
56
 
                                                    prop, \
 
56
                                                    (const gchar*)prop, \
57
57
                                                    default_value); \
58
58
      xmlFree (prop); \
59
59
    } else { \
66
66
 
67
67
#define GXX_STRUCT_ATTRIBUTE_BOOLEAN(attr_name, member_name, is_required, default_value) \
68
68
  { \
69
 
    xmlChar *xml_value = xmlGetProp (xml_node, attr_name); \
 
69
    xmlChar *xml_value = xmlGetProp (xml_node, (const xmlChar*)attr_name); \
70
70
    if (xml_value) { \
71
 
      inst->member_name = cong_util_string_to_bool (xml_value, default_value); \
 
71
      inst->member_name = cong_util_string_to_bool ((const gchar*)xml_value, default_value); \
72
72
      xmlFree (xml_value); \
73
73
    } else {\
74
74
      if (is_required) { \
82
82
  { \
83
83
    xmlNodePtr child; \
84
84
    for (child = xml_node->children; child; child=child->next) { \
85
 
      if (0==strcmp(child->name,child_name)) { \
 
85
      if (0==strcmp((const char*)child->name,child_name)) {     \
86
86
        inst->member_name = gxx_generated_object_from_xml_tree_fn_##fn_name_frag (child); \
87
87
      } \
88
88
    } \
98
98
    xmlNodePtr child; \
99
99
    gboolean is_required = FALSE; /* for now */ \
100
100
    for (child = xml_node->children; child; child=child->next) { \
101
 
      if (0==strcmp(child->name,child_name)) { \
102
 
        gchar *pcdata = xmlNodeListGetString(xml_node->doc, child->xmlChildrenNode, 1); \
 
101
      if (0==strcmp((const char*)child->name,child_name)) {     \
 
102
        xmlChar *pcdata = xmlNodeListGetString(xml_node->doc, child->xmlChildrenNode, 1); \
103
103
        if (pcdata) { \
104
 
          gchar *hash_attr = xmlGetNsProp (child, hashing_attribute_name, hashing_attribute_ns_uri); \
 
104
          xmlChar *hash_attr = xmlGetNsProp (child, (const xmlChar*)hashing_attribute_name, (const xmlChar*)hashing_attribute_ns_uri); \
105
105
          if (hash_attr) { \
106
106
            g_hash_table_insert (inst->hash_table_member_name, \
107
 
                                 g_strdup (hash_attr), \
108
 
                                 g_strdup (pcdata)); \
109
 
            g_free (hash_attr); \
 
107
                                 g_strdup ((const gchar*)hash_attr),    \
 
108
                                 g_strdup ((const gchar*)pcdata)); \
 
109
            xmlFree (hash_attr); \
110
110
          } else { \
111
111
            if (is_required) { \
112
112
                g_warning("Missing attribute \"%s\" within <%s>", hashing_attribute_name, child_name); \
113
113
              } else { \
114
114
                g_hash_table_insert (inst->hash_table_member_name, \
115
115
                                     NULL, \
116
 
                                     g_strdup (pcdata)); \
 
116
                                     g_strdup ((const gchar*)pcdata)); \
117
117
              } \
118
118
          } \
119
 
          g_free (pcdata); \
 
119
          xmlFree (pcdata); \
120
120
        } else { \
121
121
          g_warning("Missing PCDATA within <%s>", child_name); \
122
122
        } \