From: Sean E. <sea...@us...> - 2002-08-29 01:47:17
|
Update of /cvsroot/gaim/gaim/src/protocols/gg In directory usw-pr-cvs1:/tmp/cvs-serv15635/src/protocols/gg Modified Files: common.c gg.c libgg.h Log Message: some patches from some people. Index: common.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/gg/common.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- common.c 5 Dec 2001 09:48:56 -0000 1.1 +++ common.c 29 Aug 2002 01:47:14 -0000 1.2 @@ -41,6 +41,7 @@ #endif #include "libgg.h" #include "config.h" +#include <glib.h> /* * gg_debug() @@ -255,21 +256,22 @@ * zwraca zaalokowany bufor, który wypada³oby kiedy¶ zwolniæ albo NULL * w przypadku b³êdu. */ -char *gg_urlencode(char *str) +char *gg_urlencode(const char *str) { - char *p, *q, *buf, hex[] = "0123456789abcdef"; + const char *p, hex[] = "0123456789abcdef"; + char *q, *buf; + int size = 0; if (!str) - str = strdup(""); + str = ""; for (p = str; *p; p++, size++) { if (!((*p >= 'a' && *p <= 'z') || (*p >= 'A' && *p <= 'Z') || (*p >= '0' && *p <= '9'))) size += 2; } - if (!(buf = malloc(size + 1))) - return NULL; + buf = g_new(char, size + 1); for (p = str, q = buf; *p; p++, q++) { if ((*p >= 'a' && *p <= 'z') || (*p >= 'A' && *p <= 'Z') || (*p >= '0' && *p <= '9')) @@ -298,7 +300,7 @@ * manipulacjach w³asnego wpisu w katalogu publicznym. */ -int gg_http_hash(unsigned char *email, unsigned char *password) +int gg_http_hash(const unsigned char *email, const unsigned char *password) { unsigned int a, c; int b, i; Index: gg.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/gg/gg.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- gg.c 25 Aug 2002 10:51:23 -0000 1.21 +++ gg.c 29 Aug 2002 01:47:14 -0000 1.22 @@ -104,7 +104,7 @@ return "Gadu-Gadu"; } -static gchar *charset_convert(const gchar *locstr, char *encsrc, char *encdst) +static gchar *charset_convert(const gchar *locstr, const char *encsrc, const char *encdst) { #ifdef HAVE_ICONV gchar *result = NULL; @@ -114,7 +114,7 @@ return g_strdup(locstr); } -static gboolean invalid_uin(char *uin) +static gboolean invalid_uin(const char *uin) { unsigned long int res = strtol(uin, (char **)NULL, 10); if (res == LONG_MIN || res == LONG_MAX || res == 0) @@ -159,9 +159,9 @@ } } -static gchar *find_local_charset(void) +static const gchar *find_local_charset(void) { - gchar *gg_localenc = g_getenv("GG_CHARSET"); + const gchar *gg_localenc = g_getenv("GG_CHARSET"); if (gg_localenc == NULL) { #ifdef HAVE_LANGINFO_CODESET @@ -607,7 +607,7 @@ return 1; } -static void agg_add_buddy(struct gaim_connection *gc, char *who) +static void agg_add_buddy(struct gaim_connection *gc, const char *who) { struct agg_data *gd = (struct agg_data *)gc->proto_data; if (invalid_uin(who)) @@ -1066,9 +1066,9 @@ } } -static void agg_dir_search(struct gaim_connection *gc, char *first, char *middle, - char *last, char *maiden, char *city, char *state, - char *country, char *email) +static void agg_dir_search(struct gaim_connection *gc, const char *first, const char *middle, + const char *last, const char *maiden, const char *city, const char *state, + const char *country, const char *email) { struct agg_http *srch = g_new0(struct agg_http, 1); srch->gc = gc; @@ -1115,7 +1115,7 @@ } } -static void agg_change_passwd(struct gaim_connection *gc, char *old, char *new) +static void agg_change_passwd(struct gaim_connection *gc, const char *old, const char *new) { struct agg_http *hpass = g_new0(struct agg_http, 1); gchar *u = gg_urlencode(gc->username); Index: libgg.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/gg/libgg.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- libgg.h 14 Dec 2001 18:24:10 -0000 1.7 +++ libgg.h 29 Aug 2002 01:47:14 -0000 1.8 @@ -375,8 +375,8 @@ int gg_connect(void *addr, int port, int async); void gg_read_line(int sock, char *buf, int length); void gg_chomp(char *line); -char *gg_urlencode(char *str); -int gg_http_hash(unsigned char *email, unsigned char *password); +char *gg_urlencode(const char *str); +int gg_http_hash(const unsigned char *email, const unsigned char *password); #define GG_APPMSG_HOST "appmsg.gadu-gadu.pl" #define GG_APPMSG_PORT 80 |