From 968bea0a58f8b2ab3cd24fb4d91a58506aae6b89 Mon Sep 17 00:00:00 2001 From: cbeall3 Date: Wed, 24 Sep 2014 14:56:38 -0400 Subject: [PATCH] removed odprint which used varargs to fix issue 91 --- gtsam/base/Vector.cpp | 54 +++++------------------------------------ gtsam/base/Vector.h | 5 ---- gtsam/linear/Errors.cpp | 2 +- 3 files changed, 7 insertions(+), 54 deletions(-) diff --git a/gtsam/base/Vector.cpp b/gtsam/base/Vector.cpp index 48ada018f..b872aa08b 100644 --- a/gtsam/base/Vector.cpp +++ b/gtsam/base/Vector.cpp @@ -30,55 +30,11 @@ #include -//#ifdef WIN32 -//#include -//#endif using namespace std; namespace gtsam { -/* ************************************************************************* */ -void odprintf_(const char *format, ostream& stream, ...) { - char buf[4096], *p = buf; - - va_list args; - va_start(args, stream); -#ifdef WIN32 - _vsnprintf(p, sizeof buf - 3, format, args); // buf-3 is room for CR/LF/NUL -#else - vsnprintf(p, sizeof buf - 3, format, args); // buf-3 is room for CR/LF/NUL -#endif - va_end(args); - -//#ifdef WIN32 -// OutputDebugString(buf); -//#else - stream << buf; -//#endif -} - -/* ************************************************************************* */ - -void odprintf(const char *format, ...) { - char buf[4096], *p = buf; - - va_list args; - va_start(args, format); -#ifdef WIN32 - _vsnprintf(p, sizeof buf - 3, format, args); // buf-3 is room for CR/LF/NUL -#else - vsnprintf(p, sizeof buf - 3, format, args); // buf-3 is room for CR/LF/NUL -#endif - va_end(args); - -//#ifdef WIN32 -// OutputDebugString(buf); -//#else - cout << buf; -//#endif -} - /* ************************************************************************* */ bool zero(const Vector& v) { bool result = true; @@ -101,10 +57,12 @@ Vector delta(size_t n, size_t i, double value) { /* ************************************************************************* */ void print(const Vector& v, const string& s, ostream& stream) { size_t n = v.size(); - odprintf_("%s [", stream, s.c_str()); - for(size_t i=0; i Vector6; typedef Eigen::VectorBlock SubVector; typedef Eigen::VectorBlock ConstSubVector; -/** - * An auxiliary function to printf for Win32 compatibility, added by Kai - */ -GTSAM_EXPORT void odprintf(const char *format, ...); - /** * Create vector initialized to a constant value * @param n is the size of the vector diff --git a/gtsam/linear/Errors.cpp b/gtsam/linear/Errors.cpp index c0740f756..d40250266 100644 --- a/gtsam/linear/Errors.cpp +++ b/gtsam/linear/Errors.cpp @@ -38,7 +38,7 @@ Errors::Errors(const VectorValues& V) { /* ************************************************************************* */ void Errors::print(const std::string& s) const { - odprintf("%s:\n", s.c_str()); + cout << s << endl; BOOST_FOREACH(const Vector& v, *this) gtsam::print(v); }