Mercurial > pidgin.yaz
comparison libpurple/protocols/gg/lib/pubdir50.c @ 31534:a8cc50c2279f
Remove trailing whitespace
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Tue, 04 Jan 2011 06:55:30 +0000 |
parents | 6359fde67f4c |
children | fa88dc1dcabb 93b08d43f684 |
comparison
equal
deleted
inserted
replaced
31533:44f53d3fc54f | 31534:a8cc50c2279f |
---|---|
90 free(req->entries[i].value); | 90 free(req->entries[i].value); |
91 req->entries[i].value = dupvalue; | 91 req->entries[i].value = dupvalue; |
92 | 92 |
93 return 0; | 93 return 0; |
94 } | 94 } |
95 | 95 |
96 if (!(dupfield = strdup(field))) { | 96 if (!(dupfield = strdup(field))) { |
97 gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_add_n() out of memory\n"); | 97 gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_add_n() out of memory\n"); |
98 free(dupvalue); | 98 free(dupvalue); |
99 return -1; | 99 return -1; |
100 } | 100 } |
145 * \ingroup pubdir50 | 145 * \ingroup pubdir50 |
146 */ | 146 */ |
147 int gg_pubdir50_seq_set(gg_pubdir50_t req, uint32_t seq) | 147 int gg_pubdir50_seq_set(gg_pubdir50_t req, uint32_t seq) |
148 { | 148 { |
149 gg_debug(GG_DEBUG_FUNCTION, "** gg_pubdir50_seq_set(%p, %d);\n", req, seq); | 149 gg_debug(GG_DEBUG_FUNCTION, "** gg_pubdir50_seq_set(%p, %d);\n", req, seq); |
150 | 150 |
151 if (!req) { | 151 if (!req) { |
152 gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_seq_set() invalid arguments\n"); | 152 gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_seq_set() invalid arguments\n"); |
153 errno = EFAULT; | 153 errno = EFAULT; |
154 return -1; | 154 return -1; |
155 } | 155 } |
170 { | 170 { |
171 int i; | 171 int i; |
172 | 172 |
173 if (!s) | 173 if (!s) |
174 return; | 174 return; |
175 | 175 |
176 for (i = 0; i < s->entries_count; i++) { | 176 for (i = 0; i < s->entries_count; i++) { |
177 free(s->entries[i].field); | 177 free(s->entries[i].field); |
178 free(s->entries[i].value); | 178 free(s->entries[i].value); |
179 } | 179 } |
180 | 180 |
198 uint32_t res; | 198 uint32_t res; |
199 char *buf, *p; | 199 char *buf, *p; |
200 struct gg_pubdir50_request *r; | 200 struct gg_pubdir50_request *r; |
201 | 201 |
202 gg_debug_session(sess, GG_DEBUG_FUNCTION, "** gg_pubdir50(%p, %p);\n", sess, req); | 202 gg_debug_session(sess, GG_DEBUG_FUNCTION, "** gg_pubdir50(%p, %p);\n", sess, req); |
203 | 203 |
204 if (!sess || !req) { | 204 if (!sess || !req) { |
205 gg_debug_session(sess, GG_DEBUG_MISC, "// gg_pubdir50() invalid arguments\n"); | 205 gg_debug_session(sess, GG_DEBUG_MISC, "// gg_pubdir50() invalid arguments\n"); |
206 errno = EFAULT; | 206 errno = EFAULT; |
207 return 0; | 207 return 0; |
208 } | 208 } |
215 | 215 |
216 for (i = 0; i < req->entries_count; i++) { | 216 for (i = 0; i < req->entries_count; i++) { |
217 /* wyszukiwanie bierze tylko pierwszy wpis */ | 217 /* wyszukiwanie bierze tylko pierwszy wpis */ |
218 if (req->entries[i].num) | 218 if (req->entries[i].num) |
219 continue; | 219 continue; |
220 | 220 |
221 if (sess->encoding == GG_ENCODING_CP1250) { | 221 if (sess->encoding == GG_ENCODING_CP1250) { |
222 size += strlen(req->entries[i].field) + 1; | 222 size += strlen(req->entries[i].field) + 1; |
223 size += strlen(req->entries[i].value) + 1; | 223 size += strlen(req->entries[i].value) + 1; |
224 } else { | 224 } else { |
225 char *tmp; | 225 char *tmp; |
318 { | 318 { |
319 const char *end = packet + length, *p; | 319 const char *end = packet + length, *p; |
320 struct gg_pubdir50_reply *r = (struct gg_pubdir50_reply*) packet; | 320 struct gg_pubdir50_reply *r = (struct gg_pubdir50_reply*) packet; |
321 gg_pubdir50_t res; | 321 gg_pubdir50_t res; |
322 int num = 0; | 322 int num = 0; |
323 | 323 |
324 gg_debug(GG_DEBUG_FUNCTION, "** gg_pubdir50_handle_reply_sess(%p, %p, %p, %d);\n", sess, e, packet, length); | 324 gg_debug(GG_DEBUG_FUNCTION, "** gg_pubdir50_handle_reply_sess(%p, %p, %p, %d);\n", sess, e, packet, length); |
325 | 325 |
326 if (!sess || !e || !packet) { | 326 if (!sess || !e || !packet) { |
327 gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_handle_reply() invalid arguments\n"); | 327 gg_debug(GG_DEBUG_MISC, "// gg_pubdir50_handle_reply() invalid arguments\n"); |
328 errno = EFAULT; | 328 errno = EFAULT; |
375 num++; | 375 num++; |
376 field++; | 376 field++; |
377 } | 377 } |
378 | 378 |
379 value = NULL; | 379 value = NULL; |
380 | 380 |
381 for (p = field; p < end; p++) { | 381 for (p = field; p < end; p++) { |
382 /* jeśli mamy koniec tekstu... */ | 382 /* jeśli mamy koniec tekstu... */ |
383 if (!*p) { | 383 if (!*p) { |
384 /* ...i jeszcze nie mieliśmy wartości pola to | 384 /* ...i jeszcze nie mieliśmy wartości pola to |
385 * wiemy, że po tym zerze jest wartość... */ | 385 * wiemy, że po tym zerze jest wartość... */ |
390 * wartości i możemy wychodzić | 390 * wartości i możemy wychodzić |
391 * grzecznie z pętli */ | 391 * grzecznie z pętli */ |
392 break; | 392 break; |
393 } | 393 } |
394 } | 394 } |
395 | 395 |
396 /* sprawdźmy, czy pole nie wychodzi poza pakiet, żeby nie | 396 /* sprawdźmy, czy pole nie wychodzi poza pakiet, żeby nie |
397 * mieć segfaultów, jeśli serwer przestanie zakańczać pakietów | 397 * mieć segfaultów, jeśli serwer przestanie zakańczać pakietów |
398 * przez \0 */ | 398 * przez \0 */ |
399 | 399 |
400 if (p == end) { | 400 if (p == end) { |
427 } | 427 } |
428 | 428 |
429 free(tmp); | 429 free(tmp); |
430 } | 430 } |
431 } | 431 } |
432 } | 432 } |
433 | 433 |
434 res->count = num + 1; | 434 res->count = num + 1; |
435 | 435 |
436 return 0; | 436 return 0; |
437 | 437 |
438 failure: | 438 failure: |
439 gg_pubdir50_free(res); | 439 gg_pubdir50_free(res); |
440 return -1; | 440 return -1; |