From: Wilfried Goesgens Date: Sat, 27 Oct 2012 11:37:02 +0000 (+0200) Subject: BSTR: add method to run-time add numbers X-Git-Tag: v8.20~208 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=b3261cb6bd37bf9a5da60e07aa1762741a88629e BSTR: add method to run-time add numbers - fix format warnings about wrong size of long --- diff --git a/webcit/paramhandling.c b/webcit/paramhandling.c index 9db69f7e7..f5cc22bbc 100644 --- a/webcit/paramhandling.c +++ b/webcit/paramhandling.c @@ -318,7 +318,7 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp, long keylen; #ifdef DEBUG_URLSTRINGS - syslog(9, "upload_handler() name=%s, type=%s, len=%d", name, cbtype, length); + syslog(9, "upload_handler() name=%s, type=%s, len="SIZE_T_FMT, name, cbtype, length); #endif if (WCC->Hdr->urlstrings == NULL) WCC->Hdr->urlstrings = NewHash(1, NULL); @@ -364,8 +364,6 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp, } - - void PutBstr(const char *key, long keylen, StrBuf *Value) { urlcontent *u; @@ -381,6 +379,14 @@ void PutBstr(const char *key, long keylen, StrBuf *Value) u->url_data = Value; Put(WC->Hdr->urlstrings, u->url_key, keylen, u, free_url); } +void PutlBstr(const char *key, long keylen, long Value) +{ + StrBuf *Buf; + + Buf = NewStrBufPlain(NULL, sizeof(long) * 16); + StrBufPrintf(Buf, "%ld", Value); + PutBstr(key, keylen, Buf); +} diff --git a/webcit/paramhandling.h b/webcit/paramhandling.h index cd1c16038..87b0b1cec 100644 --- a/webcit/paramhandling.h +++ b/webcit/paramhandling.h @@ -40,3 +40,6 @@ const char *Bstr(const char *key, size_t keylen); #define putbstr(a, b) PutBstr(a, sizeof(a) - 1, b) void PutBstr(const char *key, long keylen, StrBuf *Value); +#define putlbstr(a, b) PutlBstr(a, sizeof(a) - 1, b) +void PutlBstr(const char *key, long keylen, long Value); + diff --git a/webcit/subst.c b/webcit/subst.c index e9955a05d..02ef070c6 100644 --- a/webcit/subst.c +++ b/webcit/subst.c @@ -898,7 +898,7 @@ int GetNextParameter(StrBuf *Buf, StrBufPeek(Buf, pch, -1, '\0'); if (LoadTemplates > 1) { syslog(1, - "DBG: got param [%s] %d %d\n", + "DBG: got param [%s] "SIZE_T_FMT" "SIZE_T_FMT"\n", pchs, pche - pchs, strlen(pchs) ); }