Mercurial > pidgin.yaz
comparison libgaim/protocols/jabber/parser.c @ 14628:58202142e9ad
[gaim-migrate @ 17369]
This is what we decided to do about the signedness warnings, right?
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Tue, 26 Sep 2006 21:37:37 +0000 |
parents | 86e1ebd8ee7f |
children | 459dafda90af |
comparison
equal
deleted
inserted
replaced
14627:134f4d999ff0 | 14628:58202142e9ad |
---|---|
38 xmlnode *node; | 38 xmlnode *node; |
39 int i; | 39 int i; |
40 | 40 |
41 if(!element_name) { | 41 if(!element_name) { |
42 return; | 42 return; |
43 } else if(!strcmp(element_name, "stream")) { | 43 } else if(!xmlStrcmp(element_name, (xmlChar*) "stream")) { |
44 js->protocol_version = JABBER_PROTO_0_9; | 44 js->protocol_version = JABBER_PROTO_0_9; |
45 for(i=0; i < nb_attributes * 5; i += 5) { | 45 for(i=0; i < nb_attributes * 5; i += 5) { |
46 int attrib_len = attributes[i+4] - attributes[i+3]; | 46 int attrib_len = attributes[i+4] - attributes[i+3]; |
47 char *attrib = g_malloc(attrib_len + 1); | 47 char *attrib = g_malloc(attrib_len + 1); |
48 memcpy(attrib, attributes[i+3], attrib_len); | 48 memcpy(attrib, attributes[i+3], attrib_len); |
49 attrib[attrib_len] = '\0'; | 49 attrib[attrib_len] = '\0'; |
50 | 50 |
51 if(!strcmp(attributes[i], "version") | 51 if(!xmlStrcmp(attributes[i], (xmlChar*) "version") |
52 && !strcmp(attrib, "1.0")) { | 52 && !strcmp(attrib, "1.0")) { |
53 js->protocol_version = JABBER_PROTO_1_0; | 53 js->protocol_version = JABBER_PROTO_1_0; |
54 g_free(attrib); | 54 g_free(attrib); |
55 } else if(!strcmp(attributes[i], "id")) { | 55 } else if(!xmlStrcmp(attributes[i], (xmlChar*) "id")) { |
56 if(js->stream_id) | 56 if(js->stream_id) |
57 g_free(js->stream_id); | 57 g_free(js->stream_id); |
58 js->stream_id = attrib; | 58 js->stream_id = attrib; |
59 } | 59 } |
60 } | 60 } |
64 if(js->state == JABBER_STREAM_INITIALIZING) | 64 if(js->state == JABBER_STREAM_INITIALIZING) |
65 jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING); | 65 jabber_stream_set_state(js, JABBER_STREAM_AUTHENTICATING); |
66 } else { | 66 } else { |
67 | 67 |
68 if(js->current) | 68 if(js->current) |
69 node = xmlnode_new_child(js->current, element_name); | 69 node = xmlnode_new_child(js->current, (const char*) element_name); |
70 else | 70 else |
71 node = xmlnode_new(element_name); | 71 node = xmlnode_new((const char*) element_name); |
72 xmlnode_set_namespace(node, namespace); | 72 xmlnode_set_namespace(node, (const char*) namespace); |
73 | 73 |
74 for(i=0; i < nb_attributes * 5; i+=5) { | 74 for(i=0; i < nb_attributes * 5; i+=5) { |
75 int attrib_len = attributes[i+4] - attributes[i+3]; | 75 int attrib_len = attributes[i+4] - attributes[i+3]; |
76 char *attrib = g_malloc(attrib_len + 1); | 76 char *attrib = g_malloc(attrib_len + 1); |
77 memcpy(attrib, attributes[i+3], attrib_len); | 77 memcpy(attrib, attributes[i+3], attrib_len); |
78 attrib[attrib_len] = '\0'; | 78 attrib[attrib_len] = '\0'; |
79 xmlnode_set_attrib(node, attributes[i], attrib); | 79 xmlnode_set_attrib(node, (const char*) attributes[i], attrib); |
80 g_free(attrib); | 80 g_free(attrib); |
81 } | 81 } |
82 | 82 |
83 js->current = node; | 83 js->current = node; |
84 } | 84 } |
92 | 92 |
93 if(!js->current) | 93 if(!js->current) |
94 return; | 94 return; |
95 | 95 |
96 if(js->current->parent) { | 96 if(js->current->parent) { |
97 if(!strcmp(js->current->name, element_name)) | 97 if(!xmlStrcmp((xmlChar*) js->current->name, element_name)) |
98 js->current = js->current->parent; | 98 js->current = js->current->parent; |
99 } else { | 99 } else { |
100 xmlnode *packet = js->current; | 100 xmlnode *packet = js->current; |
101 js->current = NULL; | 101 js->current = NULL; |
102 jabber_process_packet(js, packet); | 102 jabber_process_packet(js, packet); |
113 return; | 113 return; |
114 | 114 |
115 if(!text || !text_len) | 115 if(!text || !text_len) |
116 return; | 116 return; |
117 | 117 |
118 xmlnode_insert_data(js->current, text, text_len); | 118 xmlnode_insert_data(js->current, (const char*) text, text_len); |
119 } | 119 } |
120 | 120 |
121 static xmlSAXHandler jabber_parser_libxml = { | 121 static xmlSAXHandler jabber_parser_libxml = { |
122 .internalSubset = NULL, | 122 .internalSubset = NULL, |
123 .isStandalone = NULL, | 123 .isStandalone = NULL, |