From a62d3da857e1b2b2174c34db28c9a8f0ecf5e552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 6 Jan 2009 17:20:19 +0000 Subject: [PATCH] tools/errmsg: code correction --- tools/errmsg.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/errmsg.cpp b/tools/errmsg.cpp index e49dfd7c6..e5176819f 100644 --- a/tools/errmsg.cpp +++ b/tools/errmsg.cpp @@ -19,16 +19,20 @@ public: static const unsigned int ALL = 1; static const unsigned int STYLE = 2; - std::string msg(const char str[]) const + std::string msg(bool code) const { - std::string ret(str + _msg + str); + const char *str = code ? "\"" : ""; + std::string ret( str + _msg + str ); if (! _par1.empty()) { std::string::size_type pos = 0; while ((pos = ret.find("%1", pos)) != std::string::npos) { ret.erase(pos, 2); - ret.insert(pos, str + _par1 + str); + if ( code ) + ret.insert(pos, "\" + " + _par1 + " + \""); + else + ret.insert(pos, _par1); } } return ret;