libpurple/protocols/bonjour/parser.c

changeset 26393
7420fd99903a
parent 23072
6e7c147d622a
child 26862
74e5bfbe3784
equal deleted inserted replaced
26392:614847d4e059 26393:7420fd99903a
89 else 89 else
90 node = xmlnode_new((const char*) element_name); 90 node = xmlnode_new((const char*) element_name);
91 xmlnode_set_namespace(node, (const char*) namespace); 91 xmlnode_set_namespace(node, (const char*) namespace);
92 92
93 for(i=0; i < nb_attributes * 5; i+=5) { 93 for(i=0; i < nb_attributes * 5; i+=5) {
94 const char *name = (const char *)attributes[i];
95 const char *prefix = (const char *)attributes[i+1];
96 const char *attrib_ns = (const char *)attributes[i+2];
94 char *txt; 97 char *txt;
95 int attrib_len = attributes[i+4] - attributes[i+3]; 98 int attrib_len = attributes[i+4] - attributes[i+3];
96 char *attrib = g_malloc(attrib_len + 1); 99 char *attrib = g_malloc(attrib_len + 1);
97 char *attrib_ns = NULL;
98
99 if (attributes[i+2]) {
100 attrib_ns = g_strdup((char*)attributes[i+2]);
101 }
102 100
103 memcpy(attrib, attributes[i+3], attrib_len); 101 memcpy(attrib, attributes[i+3], attrib_len);
104 attrib[attrib_len] = '\0'; 102 attrib[attrib_len] = '\0';
105 103
106 txt = attrib; 104 txt = attrib;
107 attrib = purple_unescape_html(txt); 105 attrib = purple_unescape_html(txt);
108 g_free(txt); 106 g_free(txt);
109 xmlnode_set_attrib_with_namespace(node, (const char*) attributes[i], attrib_ns, attrib); 107 xmlnode_set_attrib_full(node, name, attrib_ns, prefix, attrib);
110 g_free(attrib); 108 g_free(attrib);
111 g_free(attrib_ns);
112 } 109 }
113 110
114 bconv->current = node; 111 bconv->current = node;
115 } 112 }
116 } 113 }

mercurial