OSDN Git Service

Correct an XML validation tool format specification error.
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Sat, 12 Oct 2013 06:28:22 +0000 (07:28 +0100)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Sat, 12 Oct 2013 06:28:22 +0000 (07:28 +0100)
ChangeLog
tests/xmlcheck.cpp

index 7f24908..6e439bc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-10-12  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
+       Correct an XML validation tool format specification error.
+
+       * tests/xmlchec.cpp (error_handler::handleError): Need PRIu64 format
+       for printing loc->getLineNumber() and loc->getColumnNumber(); define
+       __STDC_FORMAT_MACROS as 1, and include inttypes.h, to use it.
+
 2013-10-08  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
        Integrate XML validation tests into build infrastructure.
index 01f1928..aea0323 100644 (file)
  * arising from the use of this software.
  *
  */
-#include <cstdio>
+#define __STDC_FORMAT_MACROS  1
+#include <inttypes.h>   /* for PRIu64        */
+
+#include <cstdio>      /* for fprintf()     */
 #include <string>
 #include <memory>       /* for std::auto_ptr */
 #include <cstddef>      /* for std::size_t   */
@@ -151,7 +154,7 @@ error_handler::handleError( const xercesc::DOMError& condition )
    * diagnostic message to emit.
    */
   char* msg = XMLString::transcode( condition.getMessage() );
-  fprintf( stderr, "%d:%d: %s: %s\n", loc->getLineNumber(),
+  fprintf( stderr, "%" PRIu64 ":%" PRIu64 ": %s: %s\n", loc->getLineNumber(),
       loc->getColumnNumber(), warn ? "WARNING" : "ERROR", msg
     );
   XMLString::release( &msg );