mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-22 23:59:41 +08:00
Use PRI/SCN modifiers where possible
This commit is contained in:
1 parent
483542b914
commit
0381461495
12 files changed
+21
-22
No files matched your search
+1
-1
@@ -206,7 +206,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"%s%s\n", tl->number, tl->traf64, tl->comment?" #" : "", tl->comment? tl->comment : "");
|
||||
}
|
||||
fclose(cfp);
|
||||
}
|
||||
|
||||
+1
-1
@@ -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"", *(uint64_t *)node->value));
|
||||
}
|
||||
|
||||
static void pr_integer(struct node *node, CBFUNC cbf, void*cb){
|
||||
|
||||
@@ -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"", 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"", 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"", param->statscli64);
|
||||
i += (int)strlen((char *)buf+i);
|
||||
break;
|
||||
case 'h':
|
||||
|
||||
@@ -61,7 +61,7 @@ int savecounters(void)
|
||||
unsigned char *tmpbuf,pat_file[]="%s%s.lc";
|
||||
|
||||
|
||||
/* timetoexit !=0 - áóäåì çàâåðøàòüñÿ.*/
|
||||
/* timetoexit !=0 - будем завершаться.*/
|
||||
while (tc != NULL)
|
||||
{
|
||||
tcd = tc;
|
||||
@@ -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" %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,"%"SCNu64" %lu %lu\n",&rcounter.traf64,
|
||||
&rcounter.cleared, &rcounter.updated);
|
||||
|
||||
|
||||
|
||||
@@ -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(¶m->sinsr)), statssrv_before, statscli_before, param->statssrv64, param->statscli64,param->nreads,param->nwrites,rule);
|
||||
fprintf(stdout, "Port=%hd; Before: srv=%"PRId64", cli=%"PRId64"; After: srv=%"PRId64", cli=%"PRId64"; nreads=%ld; nwrites=%ld; Rule=%d\n",myhtons(*SAPORT(¶m->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
|
||||
|
||||
+5
-5
@@ -455,7 +455,7 @@ for(;;){
|
||||
if(!sb)continue;
|
||||
++sb;
|
||||
while(isspace(*sb))sb++;
|
||||
sscanf((char *)sb, "%"PRINTF_INT64_MODIFIER"u",&contentlength64);
|
||||
sscanf((char *)sb, "%"SCNu64"",&contentlength64);
|
||||
if(param->maxtrafout64 && (param->maxtrafout64 < param->statscli64 || contentlength64 > param->maxtrafout64 - param->statscli64)){
|
||||
RETURN(10);
|
||||
}
|
||||
@@ -537,7 +537,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"\r\n", contentlength64);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -911,7 +911,7 @@ for(;;){
|
||||
if(!sb)continue;
|
||||
++sb;
|
||||
while(isspace(*sb))sb++;
|
||||
sscanf((char *)sb, "%"PRINTF_INT64_MODIFIER"u", &contentlength64);
|
||||
sscanf((char *)sb, "%"SCNu64"", &contentlength64);
|
||||
hascontent = 1;
|
||||
if(param->unsafefilter && param->ndatfilterssrv > 0) {
|
||||
hascontent = 2;
|
||||
@@ -989,7 +989,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"\r\n", contentlength64);
|
||||
hascontent = 1;
|
||||
}
|
||||
}
|
||||
@@ -1036,7 +1036,7 @@ for(;;){
|
||||
}
|
||||
smallbuf[i] = 0;
|
||||
contentlength64 = 0;
|
||||
sscanf((char *)smallbuf, "%"PRINTF_INT64_MODIFIER"x", &contentlength64);
|
||||
sscanf((char *)smallbuf, "%"SCNx64"", &contentlength64);
|
||||
if(contentlength64 == 0) {
|
||||
param->chunked = 2;
|
||||
}
|
||||
|
||||
+1
-1
@@ -718,7 +718,7 @@ int MODULEMAINFUNC (int argc, char** argv){
|
||||
defparam.clisock = sock;
|
||||
|
||||
if(!srv.silent && !iscbc){
|
||||
sprintf((char *)buf, "Accepting connections [%"PRINTF_INT64_MODIFIER"u/%"PRINTF_INT64_MODIFIER"u]", (uint64_t)getpid(), (uint64_t)pthread_self());
|
||||
sprintf((char *)buf, "Accepting connections [%"PRIu64"/%"PRIu64"]", (uint64_t)getpid(), (uint64_t)pthread_self());
|
||||
dolog(&defparam, buf);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -15,8 +15,8 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdint.h>
|
||||
#ifndef PRINTF_INT64_MODIFIER
|
||||
#define PRINTF_INT64_MODIFIER "ll"
|
||||
#ifndef PRId64
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
+2
-2
@@ -510,9 +510,9 @@ void * adminchild(struct clientparam* param) {
|
||||
}
|
||||
else {
|
||||
inbuf += sprintf(buf+inbuf,
|
||||
"</td><td>%"PRINTF_INT64_MODIFIER"u</td>"
|
||||
"</td><td>%"PRIu64"</td>"
|
||||
"<td>MB%s</td>"
|
||||
"<td>%"PRINTF_INT64_MODIFIER"u.%"PRINTF_INT64_MODIFIER"u</td>"
|
||||
"<td>%"PRIu64".%"PRIu64"</td>"
|
||||
"<td>%s</td>",
|
||||
cp->traflim64 / (1024 * 1024),
|
||||
rotations[cp->type],
|
||||
|
||||
Reference in new issue
Block a user