Mercurial > pidgin
comparison src/gtkimhtml.c @ 4793:677d3cb193a1
[gaim-migrate @ 5113]
this removes all the remaining deprecated glib, gdk, gdk-pixbuf, and gtk
function calls. Hopefully I didn't break anything.
Most of this is due to the deprecation of g_strcasecmp and g_strncasecmp.
Two functions I never thought would be deprecated, but apparently they're
no good at comparing utf8 text. g_ascii_str{,n}casecmp is OK when you're
sure that it's ASCII. Otherwise, we're supposed to use g_utf8_collate(),
except that it is case sensitive. Since glib doesn't currently have a
case-insensitive one, I wrote one. If you need to compare utf8 text, you
can use gaim_utf8_strcasecmp().
I have to go do dishes now.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sun, 16 Mar 2003 00:01:49 +0000 |
parents | b0367d56b608 |
children | dc6de8ad81ae |
comparison
equal
deleted
inserted
replaced
4792:9212d1c5b7dc | 4793:677d3cb193a1 |
---|---|
530 if (!t->image->icon) | 530 if (!t->image->icon) |
531 t->image->icon = gdk_pixbuf_new_from_file(t->image->file, NULL); | 531 t->image->icon = gdk_pixbuf_new_from_file(t->image->file, NULL); |
532 | 532 |
533 return t->image->icon; | 533 return t->image->icon; |
534 } | 534 } |
535 #define VALID_TAG(x) if (!g_strncasecmp (string, x ">", strlen (x ">"))) { \ | 535 #define VALID_TAG(x) if (!g_ascii_strncasecmp (string, x ">", strlen (x ">"))) { \ |
536 *tag = g_strndup (string, strlen (x)); \ | 536 *tag = g_strndup (string, strlen (x)); \ |
537 *len = strlen (x) + 1; \ | 537 *len = strlen (x) + 1; \ |
538 return TRUE; \ | 538 return TRUE; \ |
539 } \ | 539 } \ |
540 (*type)++ | 540 (*type)++ |
541 | 541 |
542 #define VALID_OPT_TAG(x) if (!g_strncasecmp (string, x " ", strlen (x " "))) { \ | 542 #define VALID_OPT_TAG(x) if (!g_ascii_strncasecmp (string, x " ", strlen (x " "))) { \ |
543 const gchar *c = string + strlen (x " "); \ | 543 const gchar *c = string + strlen (x " "); \ |
544 gchar e = '"'; \ | 544 gchar e = '"'; \ |
545 gboolean quote = FALSE; \ | 545 gboolean quote = FALSE; \ |
546 while (*c) { \ | 546 while (*c) { \ |
547 if (*c == '"' || *c == '\'') { \ | 547 if (*c == '"' || *c == '\'') { \ |
571 { | 571 { |
572 g_return_val_if_fail (string != NULL, FALSE); | 572 g_return_val_if_fail (string != NULL, FALSE); |
573 g_return_val_if_fail (replace != NULL, FALSE); | 573 g_return_val_if_fail (replace != NULL, FALSE); |
574 g_return_val_if_fail (length != NULL, FALSE); | 574 g_return_val_if_fail (length != NULL, FALSE); |
575 | 575 |
576 if (!g_strncasecmp (string, "&", 5)) { | 576 if (!g_ascii_strncasecmp (string, "&", 5)) { |
577 *replace = '&'; | 577 *replace = '&'; |
578 *length = 5; | 578 *length = 5; |
579 } else if (!g_strncasecmp (string, "<", 4)) { | 579 } else if (!g_ascii_strncasecmp (string, "<", 4)) { |
580 *replace = '<'; | 580 *replace = '<'; |
581 *length = 4; | 581 *length = 4; |
582 } else if (!g_strncasecmp (string, ">", 4)) { | 582 } else if (!g_ascii_strncasecmp (string, ">", 4)) { |
583 *replace = '>'; | 583 *replace = '>'; |
584 *length = 4; | 584 *length = 4; |
585 } else if (!g_strncasecmp (string, " ", 6)) { | 585 } else if (!g_ascii_strncasecmp (string, " ", 6)) { |
586 *replace = ' '; | 586 *replace = ' '; |
587 *length = 6; | 587 *length = 6; |
588 } else if (!g_strncasecmp (string, "©", 6)) { | 588 } else if (!g_ascii_strncasecmp (string, "©", 6)) { |
589 *replace = '©'; /* was: '©' */ | 589 *replace = '©'; /* was: '©' */ |
590 *length = 6; | 590 *length = 6; |
591 } else if (!g_strncasecmp (string, """, 6)) { | 591 } else if (!g_ascii_strncasecmp (string, """, 6)) { |
592 *replace = '\"'; | 592 *replace = '\"'; |
593 *length = 6; | 593 *length = 6; |
594 } else if (!g_strncasecmp (string, "®", 5)) { | 594 } else if (!g_ascii_strncasecmp (string, "®", 5)) { |
595 *replace = '®'; /* was: '®' */ | 595 *replace = '®'; /* was: '®' */ |
596 *length = 5; | 596 *length = 5; |
597 } else if (*(string + 1) == '#') { | 597 } else if (*(string + 1) == '#') { |
598 guint pound = 0; | 598 guint pound = 0; |
599 if ((sscanf (string, "&#%u;", £) == 1) && pound != 0) { | 599 if ((sscanf (string, "&#%u;", £) == 1) && pound != 0) { |
672 VALID_OPT_TAG ("A"); | 672 VALID_OPT_TAG ("A"); |
673 VALID_OPT_TAG ("IMG"); | 673 VALID_OPT_TAG ("IMG"); |
674 VALID_OPT_TAG ("P"); | 674 VALID_OPT_TAG ("P"); |
675 VALID_OPT_TAG ("H3"); | 675 VALID_OPT_TAG ("H3"); |
676 | 676 |
677 if (!g_strncasecmp(string, "!--", strlen ("!--"))) { | 677 if (!g_ascii_strncasecmp(string, "!--", strlen ("!--"))) { |
678 gchar *e = strstr (string + strlen("!--"), "-->"); | 678 gchar *e = strstr (string + strlen("!--"), "-->"); |
679 if (e) { | 679 if (e) { |
680 *len = e - string + strlen ("-->"); | 680 *len = e - string + strlen ("-->"); |
681 *tag = g_strndup (string + strlen ("!--"), *len - strlen ("!---->")); | 681 *tag = g_strndup (string + strlen ("!--"), *len - strlen ("!---->")); |
682 return TRUE; | 682 return TRUE; |
691 const gchar *opt) | 691 const gchar *opt) |
692 { | 692 { |
693 gchar *t = tag; | 693 gchar *t = tag; |
694 gchar *e, *a; | 694 gchar *e, *a; |
695 | 695 |
696 while (g_strncasecmp (t, opt, strlen (opt))) { | 696 while (g_ascii_strncasecmp (t, opt, strlen (opt))) { |
697 gboolean quote = FALSE; | 697 gboolean quote = FALSE; |
698 if (*t == '\0') break; | 698 if (*t == '\0') break; |
699 while (*t && !((*t == ' ') && !quote)) { | 699 while (*t && !((*t == ' ') && !quote)) { |
700 if (*t == '\"') | 700 if (*t == '\"') |
701 quote = ! quote; | 701 quote = ! quote; |
702 t++; | 702 t++; |
703 } | 703 } |
704 while (*t && (*t == ' ')) t++; | 704 while (*t && (*t == ' ')) t++; |
705 } | 705 } |
706 | 706 |
707 if (!g_strncasecmp (t, opt, strlen (opt))) { | 707 if (!g_ascii_strncasecmp (t, opt, strlen (opt))) { |
708 t += strlen (opt); | 708 t += strlen (opt); |
709 } else { | 709 } else { |
710 return NULL; | 710 return NULL; |
711 } | 711 } |
712 | 712 |