[Mplayer-cvslog] CVS: main/libmpdemux cookies.c,1.2,1.3

Alex Beregszaszi alex at mplayerhq.hu
Mon Dec 8 21:54:11 CET 2003


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv30999

Modified Files:
	cookies.c 
Log Message:
bsdism by Steven Schultz

Index: cookies.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/cookies.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- cookies.c	8 Dec 2003 13:51:00 -0000	1.2
+++ cookies.c	8 Dec 2003 20:53:40 -0000	1.3
@@ -41,7 +41,6 @@
 {
     char *dst;
     int length = 0;
-    char *p, *end;
 
     while (src[length] > 31)
 	length++;
@@ -177,14 +176,18 @@
 	return list;
 
 
-    asprintf(&buf, "%s/.mozilla/default", homedir);
+    buf = malloc(strlen(homedir) + sizeof("/.mozilla/default") + 1);
+    sprintf(buf, "%s/.mozilla/default", homedir);
     dir = opendir(buf);
     free(buf);
 
     if (dir) {
 	while ((ent = readdir(dir)) != NULL) {
 	    if ((ent->d_name)[0] != '.') {
-		asprintf(&buf, "%s/.mozilla/default/%s/cookies.txt",
+		buf = malloc(strlen(getenv("HOME")) + 
+                             sizeof("/.mozilla/default/") + 
+                             strlen(ent->d_name) + sizeof("cookies.txt") + 1);
+		sprintf(buf, "%s/.mozilla/default/%s/cookies.txt",
 			 getenv("HOME"), ent->d_name);
 		list = load_cookies_from(buf, list);
 		free(buf);
@@ -193,7 +196,8 @@
 	closedir(dir);
     }
 
-    asprintf(&buf, "%s/.netscape/cookies.txt", homedir);
+    buf = malloc(strlen(homedir) + sizeof("/.netscape/cookies.txt") + 1);
+    sprintf(buf, "%s/.netscape/cookies.txt", homedir);
     list = load_cookies_from(buf, list);
     free(buf);
 
@@ -250,16 +254,19 @@
     }
 
 
-    asprintf(&buf, "Cookie:");
+    buf = strdup("Cookie:");
 
     for (i = 0; i < found_cookies; i++) {
 	char *nbuf;
 
-	asprintf(&nbuf, "%s %s=%s;", buf, cookies[i]->name,
+	nbuf = malloc(strlen(buf) + strlen(" ") + strlen(cookies[i]->name) +
+		    strlen("=") + strlen(cookies[i]->value) + strlen(";") + 1);
+	sprintf(nbuf, "%s %s=%s;", buf, cookies[i]->name,
 		 cookies[i]->value);
 	free(buf);
 	buf = nbuf;
     }
+
     if (found_cookies)
 	http_set_field(http_hdr, buf);
     else



More information about the MPlayer-cvslog mailing list