Correct printf arguments and use asprintf

Origin: http://marc.info/?l=openbsd-ports&m=142090828929750&w=2

* Str.c: Use asprintf() instead of rolling our own printf string
length detection.

* cookie.c: Pass the char pointer in the string struct to printf %s
instead of the string struct itself.
Print time_t using %lld instead of %ld to allow for 64-bit time_t.

* main.c: Print a long int using the correct format specifier.

* map.c: Print size_t using the correct format specifier.
This commit is contained in:
Scarlett
2015-01-15 18:54:54 +09:00
committed by Tatsuya Kinoshita
parent dae53252fb
commit ec8272d8fe
4 changed files with 24 additions and 100 deletions

View File

@@ -247,7 +247,7 @@ find_cookie(ParsedURL *pu)
Strcat(tmp, Sprintf("; $Domain=\"%s\"", p1->domain->ptr));
if (p1->portl)
Strcat(tmp,
Sprintf("; $Port=\"%s\"", portlist2str(p1->portl)));
Sprintf("; $Port=\"%s\"", portlist2str(p1->portl)->ptr));
}
}
return tmp;
@@ -461,9 +461,9 @@ save_cookies(void)
for (p = First_cookie; p; p = p->next) {
if (!(p->flag & COO_USE) || p->flag & COO_DISCARD)
continue;
fprintf(fp, "%s\t%s\t%s\t%ld\t%s\t%s\t%d\t%d\t%s\t%s\t%s\n",
fprintf(fp, "%s\t%s\t%s\t%lld\t%s\t%s\t%d\t%d\t%s\t%s\t%s\n",
parsedURL2Str(&p->url)->ptr,
p->name->ptr, p->value->ptr, p->expires,
p->name->ptr, p->value->ptr, (long long) p->expires,
p->domain->ptr, p->path->ptr, p->flag,
p->version, str2charp(p->comment),
(p->portl) ? portlist2str(p->portl)->ptr : "",