Mercurial > pidgin
comparison finch/libgnt/gntkeys.c @ 18057:23b03396e71e
Eliminate warnings about array subscripts being char. They can be signed,
so we need to cast to unsigned char.
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Thu, 07 Jun 2007 03:13:02 +0000 |
parents | 1cedd520cd18 |
children | 48067a8f6a32 ac904659104f |
comparison
equal
deleted
inserted
replaced
18056:6f7f54765822 | 18057:23b03396e71e |
---|---|
204 struct _node *n = NULL; | 204 struct _node *n = NULL; |
205 if (!path || !*path) { | 205 if (!path || !*path) { |
206 node->flags |= IS_END; | 206 node->flags |= IS_END; |
207 return; | 207 return; |
208 } | 208 } |
209 while (*path && node->next[*path]) { | 209 while (*path && node->next[(unsigned char)*path]) { |
210 node = node->next[*path]; | 210 node = node->next[(unsigned char)*path]; |
211 node->ref++; | 211 node->ref++; |
212 path++; | 212 path++; |
213 } | 213 } |
214 if (!*path) | 214 if (!*path) |
215 return; | 215 return; |
216 n = g_new0(struct _node, 1); | 216 n = g_new0(struct _node, 1); |
217 n->ref = 1; | 217 n->ref = 1; |
218 node->next[*path++] = n; | 218 node->next[(unsigned char)*path++] = n; |
219 add_path(n, path); | 219 add_path(n, path); |
220 } | 220 } |
221 | 221 |
222 void gnt_keys_add_combination(const char *path) | 222 void gnt_keys_add_combination(const char *path) |
223 { | 223 { |
228 { | 228 { |
229 struct _node *next = NULL; | 229 struct _node *next = NULL; |
230 | 230 |
231 if (!*path) | 231 if (!*path) |
232 return; | 232 return; |
233 next = node->next[*path]; | 233 next = node->next[(unsigned char)*path]; |
234 if (!next) | 234 if (!next) |
235 return; | 235 return; |
236 del_path(next, path + 1); | 236 del_path(next, path + 1); |
237 next->ref--; | 237 next->ref--; |
238 if (next->ref == 0) { | 238 if (next->ref == 0) { |
239 node->next[*path] = NULL; | 239 node->next[(unsigned char)*path] = NULL; |
240 g_free(next); | 240 g_free(next); |
241 } | 241 } |
242 } | 242 } |
243 | 243 |
244 void gnt_keys_del_combination(const char *path) | 244 void gnt_keys_del_combination(const char *path) |
250 { | 250 { |
251 int depth = 0; | 251 int depth = 0; |
252 struct _node *n = &root; | 252 struct _node *n = &root; |
253 | 253 |
254 root.flags &= ~IS_END; | 254 root.flags &= ~IS_END; |
255 while (*path && n->next[*path] && !(n->flags & IS_END)) { | 255 while (*path && n->next[(unsigned char)*path] && !(n->flags & IS_END)) { |
256 if (!g_ascii_isspace(*path) && | 256 if (!g_ascii_isspace(*path) && |
257 !g_ascii_iscntrl(*path) && | 257 !g_ascii_iscntrl(*path) && |
258 !g_ascii_isgraph(*path)) | 258 !g_ascii_isgraph(*path)) |
259 return 0; | 259 return 0; |
260 n = n->next[*path++]; | 260 n = n->next[(unsigned char)*path++]; |
261 depth++; | 261 depth++; |
262 } | 262 } |
263 | 263 |
264 if (!(n->flags & IS_END)) | 264 if (!(n->flags & IS_END)) |
265 depth = 0; | 265 depth = 0; |