# HG changeset patch # User Eric Warmenhoven # Date 978648379 0 # Node ID b167222b5c935ab13548a78f6266a86dc1d9d939 # Parent 8331d967288efe66c68645a2e1c214529a7b7175 [gaim-migrate @ 1385] updates to libyahoo, and jlsantiago told me how to get icq to work on hpux committer: Tailor Script diff -r 8331d967288e -r b167222b5c93 plugins/icq/icqbyteorder.h --- a/plugins/icq/icqbyteorder.h Thu Jan 04 22:41:12 2001 +0000 +++ b/plugins/icq/icqbyteorder.h Thu Jan 04 22:46:19 2001 +0000 @@ -1,5 +1,5 @@ /* - * $Id: icqbyteorder.h 1319 2000-12-19 10:08:29Z warmenhoven $ + * $Id: icqbyteorder.h 1385 2001-01-04 22:46:19Z warmenhoven $ * * This header defines macros to handle ICQ protocol byte order conversion. * @@ -62,6 +62,12 @@ # include #endif +/* put in by EWarmenhoven; jlsantiago told me what to do. I should send this on to the + * icqlib guys. */ +#ifdef hpux +#include +#endif + /* * I am really trying to use builtin optimized byte swap routines. * they are highly optimised on some platforms. diff -r 8331d967288e -r b167222b5c93 plugins/yay/libyahoo.c --- a/plugins/yay/libyahoo.c Thu Jan 04 22:41:12 2001 +0000 +++ b/plugins/yay/libyahoo.c Thu Jan 04 22:46:19 2001 +0000 @@ -660,47 +660,74 @@ return servfd; } -/* really ugly brute force approach - someone find a GPL'd/free - equivalent and replace this p.o.s. */ -static char *yahoo_urlencode(char *data) +/* + * yahoo_urlencode(char *) + * + * + * 29/12/2000: + * + * function modified to accept only one arg. + * added code to reuse the buffer and check allocs. + * + * -- Hrishikesh Desai + * + */ + + +static char *yahoo_urlencode(char *instr) { - static char *tmp = NULL; - char buf[4]; - int i, len; - - len = 3 * strlen(data) + 1; - - if (tmp) - FREE(tmp); - - if (!data) - return NULL; - - /* change this at some point to re-use the buffer, no sense - allocating repeatedly */ - if (!(tmp = (char *) malloc(len))) - return NULL; - tmp[0] = 0; - - for (i = 0; i < strlen(data); i++) + register int ipos, bpos; //input str pos., buffer pos. + static unsigned char *str=NULL; + int len=strlen(instr); + int tmp; + + //attempt to reuse buffer + if(NULL==str) + str = (unsigned char *) malloc(3 * len + 1); + else + str = (unsigned char *) realloc(str,3 * len + 1); + + //malloc, realloc failed ? + if(errno==ENOMEM) + { + perror("libyahoo[yahoo_urlencode]"); + //return ref. to empty string, so's prog. or whatever wont crash + return ""; + } + + ipos=bpos=0; + + while(ipos