Menu

#22 wrong format string usage

v1.0 (example)
open
nobody
None
5
2014-12-06
2014-12-06
No

When compiling liborigin I get compiler warnings about wrong format string usage. In attachment I added a patch to fix this.

Example from compiler output:

[ 52%] Building CXX object CMakeFiles/opj2dat.dir/opj2dat.cpp.o
/usr/lib64/ccache/c++ -g -Wall -I/home/lupinix/dev2/build -o CMakeFiles/opj2dat.dir/opj2dat.cpp.o -c /home/lupinix/dev2/opj2dat.cpp
/home/lupinix/dev2/opj2dat.cpp: In function ‘int main(int, char**)’:
/home/lupinix/dev2/opj2dat.cpp:51:58: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::vector<Origin::SpreadSheet>::size_type {aka long unsigned int}’ [-Wformat=]
printf("number of spreadsheets = %d\n",opj.spreadCount());
^
/home/lupinix/dev2/opj2dat.cpp:52:58: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::vector<Origin::Matrix>::size_type {aka long unsigned int}’ [-Wformat=]
printf("number of matrixes = %d\n",opj.matrixCount());
^
/home/lupinix/dev2/opj2dat.cpp:53:60: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::vector<Origin::Function>::size_type {aka long unsigned int}’ [-Wformat=]
printf("number of functions = %d\n",opj.functionCount());
^
/home/lupinix/dev2/opj2dat.cpp:54:57: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::vector<Origin::Graph>::size_type {aka long unsigned int}’ [-Wformat=]
printf("number of graphs = %d\n",opj.graphCount());
^
/home/lupinix/dev2/opj2dat.cpp:55:56: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::vector<Origin::Note>::size_type {aka long unsigned int}’ [-Wformat=]
printf("number of notes = %d\n",opj.noteCount());

1 Attachments

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.