Format warnings in src/libnrtype/Layout-TNG-Output.cpp

Bug #1278049 reported by Kris
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
Kris

Bug Description

Current trunk (r13012) shows format compiler warnings because the z modifier does not exist for printf related functions. Attached is a patch that gets rid of the warnings and makes more immediate usage of glib::ustring functionality (as internediate step to drop all printf related functions in favor of glib::ustring). I do not know where I could see the result of Layout::dumpAsText() so hence this patch as opposed to a direct commit.

Tags: code-design
Revision history for this message
Kris (kris-degussem) wrote :
Revision history for this message
jazzynico (jazzynico) wrote :

Patch tested on Windows XP, Inkscape trunk revision 13012. No more compiler warnings.

Grep tells us that Layout::dumpAsText() is currently commented everywhere it is written:
---
D:\Dev\inkscape-13012>grep -H -r "dumpAsText" src
src/libnrtype/Layout-TNG-Output.cpp:// these functions are for dumpAsText() only. No need to translate
src/libnrtype/Layout-TNG-Output.cpp:Glib::ustring Layout::dumpAsText() const
src/libnrtype/Layout-TNG.h: Glib::ustring dumpAsText() const;
src/sp-flowtext.cpp: //g_print(layout.dumpAsText().c_str());
src/sp-text.cpp: //g_print(layout.dumpAsText().c_str());
src/sp-text.cpp: //g_print(layout.dumpAsText().c_str());
----

Unfortunately, uncommenting the calls from sp-text.cpp gives the following error message when compiling:
----
compile src/sp-text.cpp
Make error line 304: problem compiling: src/sp-text.cpp: In member function 'void SPText::rebuildLayout()':
src/sp-text.cpp:521:17: error: format not a string literal and no format arguments [-Werror=format-security]
src/sp-text.cpp:526:5: error: format not a string literal and no format arguments [-Werror=format-security]
cc1plus.exe: some warnings being treated as errors

Changed in inkscape:
assignee: nobody → Kris (kris-degussem)
status: New → In Progress
Revision history for this message
jazzynico (jazzynico) wrote :

> Unfortunately, uncommenting the calls from sp-text.cpp gives the following error message when compiling

Debug code fixed revision 13017.

Revision history for this message
jazzynico (jazzynico) wrote :

Patch also tested on Crunchbang Waldorf, Inkscape trunk revision 13017.
No regression in the way the debug messages are printed.

Feel free to commit, Kris!

Changed in inkscape:
milestone: none → 0.91
Revision history for this message
Kris (kris-degussem) wrote :

Committed in r13022.

Changed in inkscape:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.