[Privoxy-devel] warning: unknown conversion type character 'l' in format
Lee
ler762 at gmail.com
Mon Jun 5 18:26:01 UTC 2017
GCC fusses about an %llu format and seems to translate it into %lu
Other than the compiler warning, I haven't noticed any problems with
%llu but it would be nice to get rid of another compiler warning
message.
in parsers.c add another #ifdef _WIN32 section to use %I64u instead of %llu:
static void create_content_length_header(unsigned long long content_length,
char *header, size_t buffer_length)
{
#ifdef _WIN32
assert(sizeof(unsigned long long) > 4);
snprintf(header, buffer_length, "Content-Length: %I64u", content_length);
log_error(LOG_LEVEL_INFO, "create_content_length_header:
Content-Length: %llu", content_length);
#else
snprintf(header, buffer_length, "Content-Length: %llu", content_length);
#endif
}
------- with %llu
2017-06-05 14:00:39.823 00000cac Request: www.installsite.org/
2017-06-05 14:00:40.150 00000cac Info: buffer_and_filter_content set to 1
2017-06-05 14:00:40.166 00000cac Info: create_content_length_header:
Content-Length: 9855
i686-w64-mingw32-gcc -c -pipe -O2 -DWINVER=0x501 -mwindows -Wall
-Ipcre parsers.c -o parsers.o
In file included from parsers.c:90:0:
strptime.h: In function 'strptime_internal':
strptime.h:277:21: warning: variable 'era' set but not used
[-Wunused-but-set-variable]
struct era_entry *era;
^
strptime.h:265:15: warning: variable 'rp_backup' set but not used
[-Wunused-but-set-variable]
const char *rp_backup;
^
parsers.c: In function 'create_content_length_header':
parsers.c:4671:36: warning: unknown conversion type character 'l' in
format [-Wformat=]
snprintf(header, buffer_length, "Content-Length: %llu", content_length);
^
parsers.c:4671:36: warning: too many arguments for format [-Wformat-extra-args]
------- with %I64u
2017-06-05 14:05:40.360 00000d9c Request: www.installsite.org/
2017-06-05 14:05:40.578 00000d9c Info: buffer_and_filter_content set to 1
2017-06-05 14:05:40.578 00000d9c Info: create_content_length_header:
Content-Length: 9855
i686-w64-mingw32-gcc -c -pipe -O2 -DWINVER=0x501 -mwindows -Wall
-Ipcre parsers.c -o parsers.o
In file included from parsers.c:90:0:
strptime.h: In function 'strptime_internal':
strptime.h:277:21: warning: variable 'era' set but not used
[-Wunused-but-set-variable]
struct era_entry *era;
^
strptime.h:265:15: warning: variable 'rp_backup' set but not used
[-Wunused-but-set-variable]
const char *rp_backup;
^
Can anyone think of a reason _not_ to add the
#ifdef _WIN32
assert(sizeof(unsigned long long) > 4);
snprintf(header, buffer_length, "Content-Length: %I64u", content_length);
#else
bit to parsers.c::create_content_length_header ?
Thanks,
Lee
More information about the Privoxy-devel
mailing list