diff options
Diffstat (limited to 'src/Main/StringFormatter.cpp')
-rw-r--r-- | src/Main/StringFormatter.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/Main/StringFormatter.cpp b/src/Main/StringFormatter.cpp index 39f7da5e..e64f85c3 100644 --- a/src/Main/StringFormatter.cpp +++ b/src/Main/StringFormatter.cpp @@ -3,9 +3,9 @@ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed by the TrueCrypt License 3.0. Modifications and additions to the original source code (contained in this file) - and all other portions of this file are Copyright (c) 2013-2016 IDRIX + and all other portions of this file are Copyright (c) 2013-2017 IDRIX and are governed by the Apache License 2.0 the full text of which is contained in the file License.txt included in VeraCrypt binary and source code distribution packages. */ @@ -19,9 +19,20 @@ namespace VeraCrypt StringFormatter::StringFormatter (const wxString &format, StringFormatterArg arg0, StringFormatterArg arg1, StringFormatterArg arg2, StringFormatterArg arg3, StringFormatterArg arg4, StringFormatterArg arg5, StringFormatterArg arg6, StringFormatterArg arg7, StringFormatterArg arg8, StringFormatterArg arg9) { bool numberExpected = false; bool endTagExpected = false; - foreach (wchar_t c, wstring (format)) + + //TODO replace this workaround for %s, %d, %c for printf + wxString text(format); + text.Replace (L"%s", L"{}",true); + text.Replace (L"%d", L"{}",true); + text.Replace (L"%c", L"{}",true); + int i=0; + while (text.find(L"{}") != (size_t) wxNOT_FOUND){ + text.Replace(L"{}",L"{"+wxString::Format(wxT("%i"),i++)+L"}",false); + } + + foreach (wchar_t c, wstring (text)) { if (numberExpected) { endTagExpected = true; |