Mercurial > mplayer.hg
changeset 11591:96206a53e2c5
bsdism by Steven Schultz
author | alex |
---|---|
date | Mon, 08 Dec 2003 20:53:40 +0000 |
parents | 0908285ada31 |
children | bbf3898360e7 |
files | libmpdemux/cookies.c |
diffstat | 1 files changed, 13 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/cookies.c Mon Dec 08 19:33:38 2003 +0000 +++ b/libmpdemux/cookies.c Mon Dec 08 20:53:40 2003 +0000 @@ -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