diff options
author | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2004-04-05 03:42:40 +0800 |
---|---|---|
committer | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2004-04-05 03:42:40 +0800 |
commit | be8fc1e32d84b1d6430efda0722221a74953d253 (patch) | |
tree | ea8f37db1deb888732df9898a0d04d6fffe3fa2a /net | |
parent | 35ff332d6be173e8729dc77719e759ab825f5229 (diff) | |
download | marcuscom-ports-be8fc1e32d84b1d6430efda0722221a74953d253.tar marcuscom-ports-be8fc1e32d84b1d6430efda0722221a74953d253.tar.gz marcuscom-ports-be8fc1e32d84b1d6430efda0722221a74953d253.tar.bz2 marcuscom-ports-be8fc1e32d84b1d6430efda0722221a74953d253.tar.lz marcuscom-ports-be8fc1e32d84b1d6430efda0722221a74953d253.tar.xz marcuscom-ports-be8fc1e32d84b1d6430efda0722221a74953d253.tar.zst marcuscom-ports-be8fc1e32d84b1d6430efda0722221a74953d253.zip |
Fix the quoted printable code again.
PR: 65110
Submitted by: green
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@2255 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'net')
-rw-r--r-- | net/gaim/files/patch-src::util.c | 90 |
1 files changed, 88 insertions, 2 deletions
diff --git a/net/gaim/files/patch-src::util.c b/net/gaim/files/patch-src::util.c index aea0f2dae..7beb3f6c7 100644 --- a/net/gaim/files/patch-src::util.c +++ b/net/gaim/files/patch-src::util.c @@ -1,6 +1,92 @@ --- src/util.c.orig Wed Mar 31 17:56:09 2004 -+++ src/util.c Fri Apr 2 02:25:08 2004 -@@ -2119,9 +2119,14 @@ ++++ src/util.c Sat Apr 3 00:18:30 2004 +@@ -247,26 +247,71 @@ + /************************************************************************** + * Quoted Printable Functions + **************************************************************************/ ++static void hex(const char **p, const char *end, unsigned char *n) ++{ ++ int i, c; ++ ++ for (i = 0, c = 0; i < 2 && *p < end; ++i, ++*p) { ++ c <<= 4; ++ switch (**p) { ++ case '0': break; ++ case '1': c += 1; break; ++ case '2': c += 2; break; ++ case '3': c += 3; break; ++ case '4': c += 4; break; ++ case '5': c += 5; break; ++ case '6': c += 6; break; ++ case '7': c += 7; break; ++ case '8': c += 8; break; ++ case '9': c += 9; break; ++ case 'a': c += 10; break; ++ case 'b': c += 11; break; ++ case 'c': c += 12; break; ++ case 'd': c += 13; break; ++ case 'e': c += 14; break; ++ case 'f': c += 15; break; ++ case 'A': c += 10; break; ++ case 'B': c += 11; break; ++ case 'C': c += 12; break; ++ case 'D': c += 13; break; ++ case 'E': c += 14; break; ++ case 'F': c += 15; break; ++ default: ++ if (i == 0) { ++ *n = **p; ++ ++*p; ++ return; ++ } ++ c >>= 4; ++ goto done; ++ } ++ } ++done: ++ *n = (c > UCHAR_MAX) ? '?' : c; ++ return; ++} ++ + void + gaim_quotedp_decode(const char *str, char **ret_str, int *ret_len) + { +- char *n, *new; +- const char *end, *p; +- int i; +- +- n = new = g_malloc(strlen (str) + 1); +- end = str + strlen(str); ++ const char *p, *end; ++ unsigned char *n, *new; ++ size_t len; ++ ++ len = strlen (str); ++ n = new = g_malloc(len + 1); ++ p = str; ++ end = &p[len]; + +- for (p = str; p < end; p++, n++) { ++ while (p < end) { + if (*p == '=') { +- sscanf(p + 1, "%2x\n", &i); +- *n = i; +- p += 2; ++ ++p; ++ hex(&p, end, n); ++ } else { ++ *n = *p == '_' ? ' ' : *p; ++ ++p; + } +- else if (*p == '_') +- *n = ' '; +- else +- *n = *p; ++ ++n; + } + + *n = '\0'; +@@ -2119,9 +2164,14 @@ static size_t parse_content_len(const char *data, size_t data_len) { |