fix Wformat compiler warnings

This commit is contained in:
Daniel Winzen 2022-12-05 21:38:30 +01:00
parent c716c67da2
commit e3cbdc94a8
No known key found for this signature in database
GPG Key ID: 222FCC3F35C41077
13 changed files with 25 additions and 24 deletions

View File

@ -8,7 +8,7 @@
BUILDDIR = ../bin/ BUILDDIR = ../bin/
CC = cl CC = cl
CFLAGS = /nologo /MT /W3 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "WITH_SSL" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE) CFLAGS = /nologo /MT /W3 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "WITH_SSL" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRIu64=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE)
COUT = /Fo COUT = /Fo
LN = link LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386 LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386

View File

@ -8,7 +8,7 @@
BUILDDIR = ../bin64/ BUILDDIR = ../bin64/
CC = cl CC = cl
CFLAGS = /nologo /MT /W3 /Ox /EHs- /GS /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "WITH_SSL" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE) CFLAGS = /nologo /MT /W3 /Ox /EHs- /GS /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "WITH_SSL" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRIu64=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE)
COUT = /Fo COUT = /Fo
LN = link LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:x64 LDFLAGS = /nologo /subsystem:console /incremental:no /machine:x64

View File

@ -8,7 +8,7 @@
BUILDDIR = ../bin64/ BUILDDIR = ../bin64/
CC = cl CC = cl
CFLAGS = /nologo /MT /W3 /Ox /EHs- /GS /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "WITH_WSAPOLL" /D "WITH_SSL" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE) CFLAGS = /nologo /MT /W3 /Ox /EHs- /GS /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "WITH_WSAPOLL" /D "WITH_SSL" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRIu64=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE)
COUT = /Fo COUT = /Fo
LN = link LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:arm64 LDFLAGS = /nologo /subsystem:console /incremental:no /machine:arm64

View File

@ -8,7 +8,7 @@
BUILDDIR = ../bin/ BUILDDIR = ../bin/
CC = cl CC = cl
CFLAGS = /DARM /D "NOODBC" /nologo /MT /W3 /Wp64 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "_WINCE" /D "WITH_STD_MALLOC" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c CFLAGS = /DARM /D "NOODBC" /nologo /MT /W3 /Wp64 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "_WINCE" /D "WITH_STD_MALLOC" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRIu64=\"I64\"" /Fp"proxy.pch" /FD /c
COUT = /Fo COUT = /Fo
LN = link LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no LDFLAGS = /nologo /subsystem:console /incremental:no

View File

@ -8,7 +8,7 @@
BUILDDIR = ../bin/ BUILDDIR = ../bin/
CC = cl CC = cl
CFLAGS = /nologo /Ox /MT /D "NOIPV6" /D "NODEBUG" /D "NOODBC" /D "NORADIUS" /D"WATCOM" /D "MSVC" /D "WITH_STD_MALLOC" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /c $(VERSION) $(BUILDDATE) CFLAGS = /nologo /Ox /MT /D "NOIPV6" /D "NODEBUG" /D "NOODBC" /D "NORADIUS" /D"WATCOM" /D "MSVC" /D "WITH_STD_MALLOC" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRIu64=\"I64\"" /c $(VERSION) $(BUILDDATE)
COUT = /Fo COUT = /Fo
LN = link LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no LDFLAGS = /nologo /subsystem:console /incremental:no

View File

@ -209,7 +209,7 @@ void dumpcounters(struct trafcount *tlin, int counterd){
if(cfp){ if(cfp){
for(tl = tlin; cfp && tl; tl = tl->next){ for(tl = tlin; cfp && tl; tl = tl->next){
if(tl->type >= conf.countertype) if(tl->type >= conf.countertype)
fprintf(cfp, "%05d %020"PRINTF_INT64_MODIFIER"u%s%s\n", tl->number, tl->traf64, tl->comment?" #" : "", tl->comment? tl->comment : ""); fprintf(cfp, "%05d %020"PRIu64"u%s%s\n", tl->number, tl->traf64, tl->comment?" #" : "", tl->comment? tl->comment : "");
} }
fclose(cfp); fclose(cfp);
} }

View File

@ -9,7 +9,7 @@
static void pr_unsigned64(struct node *node, CBFUNC cbf, void*cb){ static void pr_unsigned64(struct node *node, CBFUNC cbf, void*cb){
char buf[32]; char buf[32];
if(node->value)(*cbf)(cb, buf, sprintf(buf, "%"PRINTF_INT64_MODIFIER"u", *(uint64_t *)node->value)); if(node->value)(*cbf)(cb, buf, sprintf(buf, "%"PRIu64"u", *(uint64_t *)node->value));
} }
static void pr_integer(struct node *node, CBFUNC cbf, void*cb){ static void pr_integer(struct node *node, CBFUNC cbf, void*cb){

View File

@ -246,15 +246,15 @@ int dobuf2(struct clientparam * param, unsigned char * buf, const unsigned char
i += (int)strlen((char *)buf+i); i += (int)strlen((char *)buf+i);
break; break;
case 'L': case 'L':
sprintf((char *)buf+i, "%"PRINTF_INT64_MODIFIER"u", param->cycles); sprintf((char *)buf+i, "%"PRIu64"u", param->cycles);
i += (int)strlen((char *)buf+i); i += (int)strlen((char *)buf+i);
break; break;
case 'I': case 'I':
sprintf((char *)buf+i, "%"PRINTF_INT64_MODIFIER"u", param->statssrv64); sprintf((char *)buf+i, "%"PRIu64"u", param->statssrv64);
i += (int)strlen((char *)buf+i); i += (int)strlen((char *)buf+i);
break; break;
case 'O': case 'O':
sprintf((char *)buf+i, "%"PRINTF_INT64_MODIFIER"u", param->statscli64); sprintf((char *)buf+i, "%"PRIu64"u", param->statscli64);
i += (int)strlen((char *)buf+i); i += (int)strlen((char *)buf+i);
break; break;
case 'h': case 'h':

View File

@ -72,7 +72,7 @@ int savecounters(void)
sprintf(tmpbuf,pat_file,ldap_dircount,tcd->ace->users->user); sprintf(tmpbuf,pat_file,ldap_dircount,tcd->ace->users->user);
f=fopen(tmpbuf,"w+b"); f=fopen(tmpbuf,"w+b");
fseek(f,0,SEEK_SET); fseek(f,0,SEEK_SET);
fprintf(f,"%"PRINTF_INT64_MODIFIER"u %lu %lu\n",tcd->traf64, fprintf(f,"%"PRIu64"u %lu %lu\n",tcd->traf64,
(unsigned long)tcd->cleared,(unsigned long)tcd->updated); (unsigned long)tcd->cleared,(unsigned long)tcd->updated);
fclose(f); fclose(f);
@ -387,7 +387,7 @@ int h_trafgroup(int argc, unsigned char ** argv)
fseek(f,0,SEEK_SET); fseek(f,0,SEEK_SET);
fgets(buf, 256, f); fgets(buf, 256, f);
sscanf(buf,"%"PRINTF_INT64_MODIFIER"u %lu %lu\n",&rcounter.traf64, sscanf(buf,"%"PRIu64"u %lu %lu\n",&rcounter.traf64,
&rcounter.cleared, &rcounter.updated); &rcounter.cleared, &rcounter.updated);

View File

@ -240,7 +240,7 @@ void mylogfunc(struct clientparam * param, const unsigned char * pz) {
} }
if (DBGLEVEL == 1) { if (DBGLEVEL == 1) {
#ifndef NOPSTDINT #ifndef NOPSTDINT
fprintf(stdout, "Port=%hd; Before: srv=%"PRINTF_INT64_MODIFIER"d, cli=%"PRINTF_INT64_MODIFIER"d; After: srv=%"PRINTF_INT64_MODIFIER"d, cli=%"PRINTF_INT64_MODIFIER"d; nreads=%ld; nwrites=%ld; Rule=%d\n",myhtons(*SAPORT(&param->sinsr)), statssrv_before, statscli_before, param->statssrv64, param->statscli64,param->nreads,param->nwrites,rule); fprintf(stdout, "Port=%hd; Before: srv=%"PRIu64"d, cli=%"PRIu64"d; After: srv=%"PRIu64"d, cli=%"PRIu64"d; nreads=%ld; nwrites=%ld; Rule=%d\n",myhtons(*SAPORT(&param->sinsr)), statssrv_before, statscli_before, param->statssrv64, param->statscli64,param->nreads,param->nwrites,rule);
#else #else
fprintf(stdout, "Port=%hd; Before: srv=%lu, cli=%lu; After: srv=%lu, cli=%lu; nreads=%ld; nwrites=%ld; Rule=%d\n",myhtons(param->sins.sin_port), statssrv_before, statscli_before, param->statssrv, param->statscli,param->nreads,param->nwrites,rule); fprintf(stdout, "Port=%hd; Before: srv=%lu, cli=%lu; After: srv=%lu, cli=%lu; nreads=%ld; nwrites=%ld; Rule=%d\n",myhtons(param->sins.sin_port), statssrv_before, statscli_before, param->statssrv, param->statscli,param->nreads,param->nwrites,rule);
#endif #endif

View File

@ -393,7 +393,7 @@ for(;;){
while( (i = sockgetlinebuf(param, CLIENT, buf, BUFSIZE - 1, '\n', conf.timeouts[STRING_S])) > 2){ while( (i = sockgetlinebuf(param, CLIENT, buf, BUFSIZE - 1, '\n', conf.timeouts[STRING_S])) > 2){
if(i> 15 && (!strncasecmp((char *)(buf), "content-length", 14))){ if(i> 15 && (!strncasecmp((char *)(buf), "content-length", 14))){
buf[i]=0; buf[i]=0;
sscanf((char *)buf + 15, "%"PRINTF_INT64_MODIFIER"u", &contentlength64); sscanf((char *)buf + 15, "%"PRIu64"u", &contentlength64);
} }
} }
while( contentlength64 > 0 && (i = sockgetlinebuf(param, CLIENT, buf, (BUFSIZE < contentlength64)? BUFSIZE - 1:(int)contentlength64, '\n', conf.timeouts[STRING_S])) > 0){ while( contentlength64 > 0 && (i = sockgetlinebuf(param, CLIENT, buf, (BUFSIZE < contentlength64)? BUFSIZE - 1:(int)contentlength64, '\n', conf.timeouts[STRING_S])) > 0){
@ -503,7 +503,7 @@ for(;;){
if(!sb)continue; if(!sb)continue;
++sb; ++sb;
while(isspace(*sb))sb++; while(isspace(*sb))sb++;
sscanf((char *)sb, "%"PRINTF_INT64_MODIFIER"u",&contentlength64); sscanf((char *)sb, "%"PRIu64"u",&contentlength64);
if(param->maxtrafout64 && (param->maxtrafout64 < param->statscli64 || contentlength64 > param->maxtrafout64 - param->statscli64)){ if(param->maxtrafout64 && (param->maxtrafout64 < param->statscli64 || contentlength64 > param->maxtrafout64 - param->statscli64)){
RETURN(10); RETURN(10);
} }
@ -581,7 +581,7 @@ for(;;){
contentlength64 = param->cliinbuf; contentlength64 = param->cliinbuf;
param->nolongdatfilter = 1; param->nolongdatfilter = 1;
} }
sprintf((char*)buf+strlen((char *)buf), "Content-Length: %"PRINTF_INT64_MODIFIER"u\r\n", contentlength64); sprintf((char*)buf+strlen((char *)buf), "Content-Length: %"PRIu64"u\r\n", contentlength64);
} }
#endif #endif
@ -955,7 +955,7 @@ for(;;){
if(!sb)continue; if(!sb)continue;
++sb; ++sb;
while(isspace(*sb))sb++; while(isspace(*sb))sb++;
sscanf((char *)sb, "%"PRINTF_INT64_MODIFIER"u", &contentlength64); sscanf((char *)sb, "%"PRIu64"u", &contentlength64);
hascontent = 1; hascontent = 1;
if(param->unsafefilter && param->ndatfilterssrv > 0) { if(param->unsafefilter && param->ndatfilterssrv > 0) {
hascontent = 2; hascontent = 2;
@ -1033,7 +1033,7 @@ for(;;){
} }
if(action != PASS) RETURN(517); if(action != PASS) RETURN(517);
contentlength64 = param->srvinbuf; contentlength64 = param->srvinbuf;
sprintf((char*)buf+strlen((char *)buf), "Content-Length: %"PRINTF_INT64_MODIFIER"u\r\n", contentlength64); sprintf((char*)buf+strlen((char *)buf), "Content-Length: %"PRIu64"u\r\n", contentlength64);
hascontent = 1; hascontent = 1;
} }
} }
@ -1080,7 +1080,7 @@ for(;;){
} }
smallbuf[i] = 0; smallbuf[i] = 0;
contentlength64 = 0; contentlength64 = 0;
sscanf((char *)smallbuf, "%"PRINTF_INT64_MODIFIER"x", &contentlength64); sscanf((char *)smallbuf, "%"PRIu64"x", &contentlength64);
if(contentlength64 == 0) { if(contentlength64 == 0) {
param->chunked = 2; param->chunked = 2;
} }

View File

@ -15,8 +15,9 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <stdint.h> #include <stdint.h>
#ifndef PRINTF_INT64_MODIFIER #include <inttypes.h>
#define PRINTF_INT64_MODIFIER "ll" #ifndef PRIu64
#define PRIu64 "ll"
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -510,9 +510,9 @@ void * adminchild(struct clientparam* param) {
} }
else { else {
inbuf += sprintf(buf+inbuf, inbuf += sprintf(buf+inbuf,
"</td><td>%"PRINTF_INT64_MODIFIER"u</td>" "</td><td>%"PRIu64"u</td>"
"<td>MB%s</td>" "<td>MB%s</td>"
"<td>%"PRINTF_INT64_MODIFIER"u.%"PRINTF_INT64_MODIFIER"u</td>" "<td>%"PRIu64"u.%"PRIu64"u</td>"
"<td>%s</td>", "<td>%s</td>",
cp->traflim64 / (1024 * 1024), cp->traflim64 / (1024 * 1024),
rotations[cp->type], rotations[cp->type],