From 69352206b6557282d16927415a87500f152e4ff6 Mon Sep 17 00:00:00 2001 From: Peter Tissen Date: Tue, 1 Apr 2014 19:44:38 +0200 Subject: [PATCH 1/3] blantant test code removal well this is embarassing, VS didn't recompile it, so I didn't notice the mistake --- Utilities/StrFmt.cpp | 3 +++ Utilities/StrFmt.h | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Utilities/StrFmt.cpp b/Utilities/StrFmt.cpp index 51ed10c3e6..58ed16f145 100644 --- a/Utilities/StrFmt.cpp +++ b/Utilities/StrFmt.cpp @@ -1,6 +1,9 @@ #include "stdafx.h" #include "StrFmt.h" +static const std::string fmt::placeholder = "???"; + + //wrapper to deal with advance sprintf formating options with automatic length finding //can't take strings by reference because of "va_start", so overload it with char * std::string fmt::FormatV(const char *fmt, va_list args) diff --git a/Utilities/StrFmt.h b/Utilities/StrFmt.h index 2338ea7d07..5f98262268 100644 --- a/Utilities/StrFmt.h +++ b/Utilities/StrFmt.h @@ -15,7 +15,7 @@ namespace fmt{ struct empty_t{}; - //static const string placeholder = "???"; + extern const string placeholder; // write `fmt` from `pos` to the first occurence of `fmt::placeholder` to // the stream `os`. Then write `arg` to to the stream. If there's no @@ -24,7 +24,7 @@ namespace fmt{ template empty_t write(const string &fmt, ostream &os, string::size_type &pos, T &&arg) { - string::size_type ins = fmt.find(/*placeholder*/"???", pos); + string::size_type ins = fmt.find(placeholder, pos); if (ins == string::npos) { From 373ae6b1072dd9dbb8ea133f1ccb022a06fa647a Mon Sep 17 00:00:00 2001 From: Peter Tissen Date: Tue, 1 Apr 2014 20:13:22 +0200 Subject: [PATCH 2/3] remove dummy alias in strfmt. Fix some wxString remnants, that only make problems in Linux --- Utilities/StrFmt.h | 9 +-------- rpcs3/Emu/CPU/CPUDecoder.h | 10 +++++++++- rpcs3/Emu/Cell/PPUProgramCompiler.cpp | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Utilities/StrFmt.h b/Utilities/StrFmt.h index 5f98262268..0c705bd544 100644 --- a/Utilities/StrFmt.h +++ b/Utilities/StrFmt.h @@ -1,5 +1,6 @@ #pragma once #include +#include #include #include #include @@ -94,14 +95,6 @@ namespace fmt{ return str; } - //TODO:remove - //fmt alias for FormatV unused at the moment - template - auto fmt(Args&&... args) -> decltype(FormatV(std::forward(parameters)...)) - { - return FormatV(std::forward(args)...); - } - //convert a wxString to a std::string encoded in utf8 //CAUTION, only use this to interface with wxWidgets classes std::string ToUTF8(const wxString& right); diff --git a/rpcs3/Emu/CPU/CPUDecoder.h b/rpcs3/Emu/CPU/CPUDecoder.h index c686863be8..d05c1d4267 100644 --- a/rpcs3/Emu/CPU/CPUDecoder.h +++ b/rpcs3/Emu/CPU/CPUDecoder.h @@ -1,4 +1,5 @@ #pragma once +#include #include "CPUInstrTable.h" #pragma warning( disable : 4800 ) @@ -321,7 +322,14 @@ public: , m_args_count(args_count) , m_args(args_count ? new CodeFieldBase*[args_count] : nullptr) { - m_name.MakeLower().Replace("_", "."); + std::transform( + name.begin(), + name.end(), + m_name.begin(), + [](const char &a){ + char b = tolower(a); + if (b == '_') b = '.'; + return b; }); } __forceinline const std::string& GetName() const diff --git a/rpcs3/Emu/Cell/PPUProgramCompiler.cpp b/rpcs3/Emu/Cell/PPUProgramCompiler.cpp index 03f7f4a796..e74e741a95 100644 --- a/rpcs3/Emu/Cell/PPUProgramCompiler.cpp +++ b/rpcs3/Emu/Cell/PPUProgramCompiler.cpp @@ -149,7 +149,7 @@ void CompilePPUProgram::WriteError(const std::string& error) { if(m_err_list) { - m_err_list->WriteText(fmt::FromUTF8(fmt::Format("line %lld: %s\n", m_line, error))); + m_err_list->WriteText(fmt::FromUTF8(fmt::Format("line %lld: %s\n", m_line, error.c_str()))); } } From 748aa6fce88e226ab2586d49b449219d5b0ddd9e Mon Sep 17 00:00:00 2001 From: Peter Tissen Date: Tue, 1 Apr 2014 20:27:58 +0200 Subject: [PATCH 3/3] fix indentation --- rpcs3/Emu/CPU/CPUDecoder.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/CPU/CPUDecoder.h b/rpcs3/Emu/CPU/CPUDecoder.h index d05c1d4267..4091e73146 100644 --- a/rpcs3/Emu/CPU/CPUDecoder.h +++ b/rpcs3/Emu/CPU/CPUDecoder.h @@ -326,10 +326,12 @@ public: name.begin(), name.end(), m_name.begin(), - [](const char &a){ + [](const char &a) + { char b = tolower(a); if (b == '_') b = '.'; - return b; }); + return b; + }); } __forceinline const std::string& GetName() const