comparison libpurple/protocols/gg/lib/message.c @ 31936:3b8415185090

Accept broken URLs from third-party GG clients same as official GG. This patch is r1096 upstream, thanks to tomkiewicz again. Fixes #13886.
author Ethan Blanton <elb@pidgin.im>
date Sun, 01 May 2011 16:36:39 +0000
parents 93b08d43f684
children
comparison
equal deleted inserted replaced
31935:039867991a51 31936:3b8415185090
359 * \param dst Wskaźnik na bufor roboczy 359 * \param dst Wskaźnik na bufor roboczy
360 * \param pos Wskaźnik na aktualne położenie w buforze roboczym 360 * \param pos Wskaźnik na aktualne położenie w buforze roboczym
361 * \param src Dodawany tekst 361 * \param src Dodawany tekst
362 * \param len Długość dodawanego tekstu 362 * \param len Długość dodawanego tekstu
363 */ 363 */
364 static void gg_append(char *dst, int *pos, const void *src, int len) 364 static void gg_append(char *dst, size_t *pos, const void *src, int len)
365 { 365 {
366 if (dst != NULL) 366 if (dst != NULL)
367 memcpy(&dst[*pos], src, len); 367 memcpy(&dst[*pos], src, len);
368 368
369 *pos += len; 369 *pos += len;
392 const int img_len = 29; 392 const int img_len = 29;
393 int char_pos = 0; 393 int char_pos = 0;
394 int format_idx = 0; 394 int format_idx = 0;
395 unsigned char old_attr = 0; 395 unsigned char old_attr = 0;
396 const unsigned char *color = (const unsigned char*) "\x00\x00\x00"; 396 const unsigned char *color = (const unsigned char*) "\x00\x00\x00";
397 int len, i; 397 int i;
398 size_t len;
398 const unsigned char *format_ = (const unsigned char*) format; 399 const unsigned char *format_ = (const unsigned char*) format;
399 400
400 len = 0; 401 len = 0;
401 402
402 /* Nie mamy atrybutów dla pierwsze znaku, a tekst nie jest pusty, więc 403 /* Nie mamy atrybutów dla pierwsze znaku, a tekst nie jest pusty, więc
582 tag = NULL; 583 tag = NULL;
583 in_entity = 0; 584 in_entity = 0;
584 entity = NULL; 585 entity = NULL;
585 586
586 for (src = html; *src != 0; src++) { 587 for (src = html; *src != 0; src++) {
588 if (in_entity && !(isalnum(*src) || *src == '#' || *src == ';')) {
589 in_entity = 0;
590 gg_append(dst, &len, entity, src - entity);
591 }
592
587 if (*src == '<') { 593 if (*src == '<') {
588 tag = src; 594 tag = src;
589 in_tag = 1; 595 in_tag = 1;
590 continue; 596 continue;
591 } 597 }