[Libwebsockets] master - uint64_t format conversion failure

Andy Green andy at warmcat.com
Tue Dec 2 01:57:23 CET 2014



On 2 December 2014 06:57:04 GMT+08:00, Michael Haberler <mail17 at mah.priv.at> wrote:
>gcc 4.7.2 complains:
>
>
>[ 52%] Building C object
>CMakeFiles/test-ping.dir/test-server/test-ping.c.o
>/home/mah/src/libwebsockets-warmcat/test-server/test-ping.c: In
>function ‘callback_lws_mirror’:
>/home/mah/src/libwebsockets-warmcat/test-server/test-ping.c:193:11:
>error: format ‘%ld’ expects argument of type ‘long int’, but argument 5
>has type ‘uint64_t’ [-Werror=format]
>/home/mah/src/libwebsockets-warmcat/test-server/test-ping.c:216:4:
>error: format ‘%ld’ expects argument of type ‘long int’, but argument 5
>has type ‘uint64_t’ [-Werror=format]
>cc1: all warnings being treated as errors
>make[2]: *** [CMakeFiles/test-ping.dir/test-server/test-ping.c.o] Error
>1
>make[1]: *** [CMakeFiles/test-ping.dir/all] Error 2
>make: *** [all] Error 2
>
>tentative patch:
>https://github.com/mhaberler/libwebsockets/commit/4cab125445b85ac3d4e375ad87c512cf36059a56
>
>not sure about Windows applicability, it might mean we need to emply
>__STDC_FORMAT_MACROS  like here:
>http://stackoverflow.com/questions/8132399/how-to-printf-uint64-t

Thanks to Joakim we have autobuild for Windows now via a web service, Appveyor.  It's OK with it as it is (although I see it spews a lot of warnings).

It's also autobuilt now with travis-ci using gcc and clang... no problems.

I also build it here with gcc with no warnings.

But I think your warnings are valid... luckily there's an easy fix I only made it uint64_t because of a coverity warning (another build innovation from Joakim).  So it can just be truncated for the print back to unsigned long.

It's pushed and Appveyor continues to be happy, although it was happy before...

-Andy

>
>- Michael
>
>
>
>
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>http://ml.libwebsockets.org/mailman/listinfo/libwebsockets




More information about the Libwebsockets mailing list