[Libreoffice-commits] libvisio.git: src/lib

Miklos Vajna vmiklos at collabora.co.uk
Sun Dec 7 02:11:28 PST 2014


 src/lib/libvisio_utils.cpp |    8 ++++++++
 src/lib/libvisio_utils.h   |    6 ++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 3507f0bc15a8f1c3d1c2b8d5d11962d8de5d9467
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sun Dec 7 11:10:39 2014 +0100

    print debug messages to stderr
    
    Change-Id: I54305fcb8c2ea80951acdb5b426a0dd501330762

diff --git a/src/lib/libvisio_utils.cpp b/src/lib/libvisio_utils.cpp
index e622417..90f1510 100644
--- a/src/lib/libvisio_utils.cpp
+++ b/src/lib/libvisio_utils.cpp
@@ -10,6 +10,7 @@
 #include <vector>
 #include <string>
 #include <algorithm> // std::count
+#include <cstdarg>
 #include "VSDInternalStream.h"
 #include "libvisio_utils.h"
 
@@ -122,5 +123,12 @@ void libvisio::appendUCS4(librevenge::RVNGString &text, UChar32 ucs4Character)
   text.append((char *)outbuf);
 }
 
+void libvisio::debugPrint(const char *format, ...)
+{
+  va_list args;
+  va_start(args, format);
+  std::vfprintf(stderr, format, args);
+  va_end(args);
+}
 
 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
diff --git a/src/lib/libvisio_utils.h b/src/lib/libvisio_utils.h
index 60be13f..ae84764 100644
--- a/src/lib/libvisio_utils.h
+++ b/src/lib/libvisio_utils.h
@@ -55,10 +55,10 @@ typedef unsigned __int64 uint64_t;
 // do nothing with debug messages in a release compile
 #ifdef DEBUG
 #ifdef VERBOSE_DEBUG
-#define VSD_DEBUG_MSG(M) printf("%15s:%5d: ", __FILE__, __LINE__); printf M
+#define VSD_DEBUG_MSG(M) libvisio::debugPrint("%15s:%5d: ", __FILE__, __LINE__); libvisio::debugPrint M
 #define VSD_DEBUG(M) M
 #else
-#define VSD_DEBUG_MSG(M) printf M
+#define VSD_DEBUG_MSG(M) libvisio::debugPrint M
 #define VSD_DEBUG(M) M
 #endif
 #else
@@ -82,6 +82,8 @@ const librevenge::RVNGString getColourString(const Colour &c);
 
 void appendUCS4(librevenge::RVNGString &text, UChar32 ucs4Character);
 
+void debugPrint(const char *format, ...);
+
 class EndOfStreamException
 {
 };


More information about the Libreoffice-commits mailing list