From 8580a1d5cef4aa3d90a5760c52ab6206c5616554 Mon Sep 17 00:00:00 2001 From: zilmar Date: Wed, 13 Jan 2016 06:01:13 +1100 Subject: [PATCH] [Project64] moved stdwstr_f::stdwstr_f out of .h and in to .cpp --- Source/Common/StdString.cpp | 21 +++++++++++++++++---- Source/Common/StdString.h | 15 +++------------ 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Source/Common/StdString.cpp b/Source/Common/StdString.cpp index 98e41c12d..cb51ee28b 100644 --- a/Source/Common/StdString.cpp +++ b/Source/Common/StdString.cpp @@ -1,8 +1,6 @@ #include "stdafx.h" #include #include -#include "StdString.h" -#include stdstr::stdstr() { @@ -251,9 +249,24 @@ std::wstring stdstr::ToUTF16(unsigned int CodePage, bool * bSuccess) #endif stdstr_f::stdstr_f(const char * strFormat, ...) -{ +{ + va_list args; + va_start(args, strFormat); + ArgFormat(strFormat, args); + va_end(args); +} + +#ifdef _WIN32 +stdwstr_f::stdwstr_f(const wchar_t * strFormat, ...) +{ va_list args; va_start(args, strFormat); - ArgFormat(strFormat,args); + + wchar_t Msg[1000]; + _vsnwprintf(Msg, sizeof(Msg) - 1, strFormat, args); + va_end(args); + + this->assign(Msg); } +#endif diff --git a/Source/Common/StdString.h b/Source/Common/StdString.h index 9f1342e1f..411fbdd4a 100644 --- a/Source/Common/StdString.h +++ b/Source/Common/StdString.h @@ -52,22 +52,13 @@ public: stdstr_f(const char * strFormat, ...); }; +#ifdef _WIN32 class stdwstr_f : public std::wstring { public: - stdwstr_f(const wchar_t * strFormat, ...) - { - va_list args; - va_start(args, strFormat); - - wchar_t Msg[1000]; - _vsnwprintf(Msg, sizeof(Msg) - 1, strFormat, args); - - va_end(args); - - this->assign(Msg); - } + stdwstr_f(const wchar_t * strFormat, ... ); }; +#endif typedef std::list strlist; typedef strlist::iterator strlist_iter;