changeset 5532:6f35b80c5ffa

[gaim-migrate @ 5932] (10:04:36) Robot101: LSchiere: alternative way to deal with the magic number - remove it. doesn't crash when signing on to a HTTP proxy. also resolves the mysterious "unsigned tmp" which appeared a week or few ago.. committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 26 May 2003 14:04:53 +0000
parents 10920646988f
children b4c32b9a797d
files src/proxy.c src/util.c src/util.h
diffstat 3 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/proxy.c	Mon May 26 12:45:05 2003 +0000
+++ b/src/proxy.c	Mon May 26 14:04:53 2003 +0000
@@ -785,7 +785,7 @@
 	if (phb->gpi->proxyuser) {
 		char *t1, *t2;
 		t1 = g_strdup_printf("%s:%s", phb->gpi->proxyuser, phb->gpi->proxypass);
-		t2 = tobase64(t1, -1);
+		t2 = tobase64(t1, strlen(t1));
 		g_free(t1);
 		g_return_if_fail(request_len < sizeof(request));
 		request_len += g_snprintf(request + request_len, sizeof(request) - request_len, "Proxy-Authorization: Basic %s\r\n", t2);
--- a/src/util.c	Mon May 26 12:45:05 2003 +0000
+++ b/src/util.c	Mon May 26 14:04:53 2003 +0000
@@ -354,10 +354,7 @@
 char *tobase64(const unsigned char *buf, size_t len)
 {
 	char *s = NULL, *rv = NULL;
-	unsigned tmp;
-
-	if(len == (size_t)(-1))
-		len = strlen(buf);
+	unsigned char tmp;
 
 	s = g_malloc((4 * (len + 1)) / 3 + 1);
 
--- a/src/util.h	Mon May 26 12:45:05 2003 +0000
+++ b/src/util.h	Mon May 26 14:04:53 2003 +0000
@@ -44,7 +44,7 @@
  * Converts a string to its base-64 equivalent.
  *
  * @param buf The data to convert.
- * @param len The length of the data, or -1 if it's a NULL-terminated string.
+ * @param len The length of the data.
  *
  * @return The base-64 version of @a str.
  *