c-aries / utt-wubi

Universal Typing Training - Chinese Wubi
GNU General Public License v3.0
1 stars 1 forks source link

utt_xml.c make error #2

Closed c-aries closed 12 years ago

c-aries commented 12 years ago

utt_xml.c: In function 'utt_xml_write':utt_xml.c:146:3: error: format not a string literal and no format arguments [-Werror=format-security]utt_xml.c:147:3: error: format not a string literal and no format arguments [-Werror=format-security]cc1: all warnings being treated as errorsmake: *\ [utt_xml.o] Error 1

dwj@dwj-ThinkPad-SL410:~/downloads/utt-wubi$ gcc --version gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

c-aries commented 12 years ago

$ grep -A 3 -R xmlTextWriterWriteFormatElement( /usr/include/libxml2/ /usr/include/libxml2/libxml/xmlwriter.h: xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer, /usr/include/libxml2/libxml/xmlwriter.h- const xmlChar * name, /usr/include/libxml2/libxml/xmlwriter.h- const char *format, ...) /usr/include/libxml2/libxml/xmlwriter.h- LIBXML_ATTR_FORMAT(3,4); $

so we modify xmlTextWriterWriteFormatElement (ptr, BAD_CAST "Title", title); to xmlTextWriterWriteFormatElement (ptr, BAD_CAST "Title", "%s", title);

c-aries commented 12 years ago

$ grep -A 3 -R xmlTextWriterWriteFormatElement( /usr/include/libxml2/ /usr/include/libxml2/libxml/xmlwriter.h: xmlTextWriterWriteFormatElement(xmlTextWriterPtr writer, /usr/include/libxml2/libxml/xmlwriter.h- const xmlChar * name, /usr/include/libxml2/libxml/xmlwriter.h- const char *format, ...) /usr/include/libxml2/libxml/xmlwriter.h- LIBXML_ATTR_FORMAT(3,4); $

so we modify xmlTextWriterWriteFormatElement (ptr, BAD_CAST "Title", title); to xmlTextWriterWriteFormatElement (ptr, BAD_CAST "Title", "%s", title);