diff src/protocols/gg/common.c @ 3466:7a3f16a375a5

[gaim-migrate @ 3516] some patches from some people. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Thu, 29 Aug 2002 01:47:15 +0000
parents 4b3f17ca66bf
children 9682c0e022c6
line wrap: on
line diff
--- a/src/protocols/gg/common.c	Thu Aug 29 01:43:23 2002 +0000
+++ b/src/protocols/gg/common.c	Thu Aug 29 01:47:15 2002 +0000
@@ -1,4 +1,4 @@
-/* $Id: common.c 2859 2001-12-05 09:48:56Z warmenhoven $ */
+/* $Id: common.c 3516 2002-08-29 01:47:15Z seanegan $ */
 
 /*
  *  (C) Copyright 2001 Wojtek Kaniewski <wojtekka@irc.pl>,
@@ -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;