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/
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
LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386

View File

@ -8,7 +8,7 @@
BUILDDIR = ../bin64/
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
LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:x64

View File

@ -8,7 +8,7 @@
BUILDDIR = ../bin64/
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
LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:arm64

View File

@ -8,7 +8,7 @@
BUILDDIR = ../bin/
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
LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no
@ -32,4 +32,4 @@ include Makefile.inc
allplugins:
for /D %%i in ($(PLUGINS)) do (copy Makefile plugins\%%i && copy Makefile.var plugins\%%i && cd plugins\%%i && nmake && del *.obj *.idb &&cd ..\..)

View File

@ -8,7 +8,7 @@
BUILDDIR = ../bin/
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
LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no

View File

@ -209,7 +209,7 @@ void dumpcounters(struct trafcount *tlin, int counterd){
if(cfp){
for(tl = tlin; cfp && tl; tl = tl->next){
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);
}

View File

@ -9,7 +9,7 @@
static void pr_unsigned64(struct node *node, CBFUNC cbf, void*cb){
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){

View File

@ -246,15 +246,15 @@ int dobuf2(struct clientparam * param, unsigned char * buf, const unsigned char
i += (int)strlen((char *)buf+i);
break;
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);
break;
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);
break;
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);
break;
case 'h':

View File

@ -72,7 +72,7 @@ int savecounters(void)
sprintf(tmpbuf,pat_file,ldap_dircount,tcd->ace->users->user);
f=fopen(tmpbuf,"w+b");
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);
fclose(f);
@ -387,7 +387,7 @@ int h_trafgroup(int argc, unsigned char ** argv)
fseek(f,0,SEEK_SET);
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);

View File

@ -240,7 +240,7 @@ void mylogfunc(struct clientparam * param, const unsigned char * pz) {
}
if (DBGLEVEL == 1) {
#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
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

View File

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

View File

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

View File

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