From 8a624239703c046d89ebeaf3ea13c87af75b550f Mon Sep 17 00:00:00 2001 From: Rohit Nirmal Date: Wed, 3 Dec 2014 12:57:57 -0600 Subject: Change NULLs to nullptrs. --- src/common/string_util.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/common/string_util.cpp') diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index dcec9275f..7fb7ede5e 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -31,7 +31,7 @@ std::string ToUpper(std::string str) { // faster than sscanf bool AsciiToHex(const char* _szValue, u32& result) { - char *endptr = NULL; + char *endptr = nullptr; const u32 value = strtoul(_szValue, &endptr, 16); if (!endptr || *endptr) @@ -69,7 +69,7 @@ bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list ar // will be present in the middle of a multibyte sequence. // // This is why we lookup an ANSI (cp1252) locale here and use _vsnprintf_l. - static locale_t c_locale = NULL; + static locale_t c_locale = nullptr; if (!c_locale) c_locale = _create_locale(LC_ALL, ".1252"); writtenCount = _vsnprintf_l(out, outsize, format, c_locale, args); @@ -92,7 +92,7 @@ bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list ar std::string StringFromFormat(const char* format, ...) { va_list args; - char *buf = NULL; + char *buf = nullptr; #ifdef _WIN32 int required = 0; @@ -162,7 +162,7 @@ std::string StripQuotes(const std::string& s) bool TryParse(const std::string &str, u32 *const output) { - char *endptr = NULL; + char *endptr = nullptr; // Reset errno to a value other than ERANGE errno = 0; -- cgit v1.2.3 From 3d8c6e61beef922f79733718c5314c0d7015e93f Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Sun, 7 Dec 2014 23:36:33 +0100 Subject: StringUtil: Perform some minimal cleanup. --- src/common/string_util.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/common/string_util.cpp') diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 7fb7ede5e..2ec4c8e05 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -2,7 +2,7 @@ // Licensed under GPLv2 // Refer to the license.txt file included. -#include +#include #include "common/common.h" #include "common/string_util.h" @@ -18,13 +18,13 @@ namespace Common { /// Make a string lowercase std::string ToLower(std::string str) { - std::transform(str.begin(), str.end(), str.begin(), ::tolower); + boost::transform(str, str.begin(), ::tolower); return str; } /// Make a string uppercase std::string ToUpper(std::string str) { - std::transform(str.begin(), str.end(), str.begin(), ::toupper); + boost::transform(str, str.begin(), ::toupper); return str; } -- cgit v1.2.3 From 4763fca9f82274de22422c6e6b27aa69401454c2 Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 9 Dec 2014 22:06:53 -0800 Subject: Explicitly specify LE strings to iconv, fixes paths in Steel Diver --- src/common/string_util.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/common/string_util.cpp') diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 7fb7ede5e..19e162c27 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -528,7 +528,7 @@ std::u16string UTF8ToUTF16(const std::string& input) { std::u16string result; - iconv_t const conv_desc = iconv_open("UTF-16", "UTF-8"); + iconv_t const conv_desc = iconv_open("UTF-16LE", "UTF-8"); if ((iconv_t)(-1) == conv_desc) { ERROR_LOG(COMMON, "Iconv initialization failure [UTF-8]: %s", strerror(errno)); @@ -582,7 +582,7 @@ std::u16string UTF8ToUTF16(const std::string& input) std::string UTF16ToUTF8(const std::u16string& input) { - return CodeToUTF8("UTF-16", input); + return CodeToUTF8("UTF-16LE", input); } std::string CP1252ToUTF8(const std::string& input) -- cgit v1.2.3 From 0600e2d8b5b30bd68c8b19cb1f2051e096e7caa9 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Fri, 5 Dec 2014 23:53:49 -0200 Subject: Convert old logging calls to new logging macros --- src/common/string_util.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/common/string_util.cpp') diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 7a8274a91..6d9612fb5 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -107,7 +107,7 @@ std::string StringFromFormat(const char* format, ...) #else va_start(args, format); if (vasprintf(&buf, format, args) < 0) - ERROR_LOG(COMMON, "Unable to allocate memory for string"); + LOG_ERROR(Common, "Unable to allocate memory for string"); va_end(args); std::string temp = buf; @@ -475,7 +475,7 @@ static std::string CodeToUTF8(const char* fromcode, const std::basic_string& iconv_t const conv_desc = iconv_open("UTF-8", fromcode); if ((iconv_t)(-1) == conv_desc) { - ERROR_LOG(COMMON, "Iconv initialization failure [%s]: %s", fromcode, strerror(errno)); + LOG_ERROR(Common, "Iconv initialization failure [%s]: %s", fromcode, strerror(errno)); iconv_close(conv_desc); return {}; } @@ -510,7 +510,7 @@ static std::string CodeToUTF8(const char* fromcode, const std::basic_string& } else { - ERROR_LOG(COMMON, "iconv failure [%s]: %s", fromcode, strerror(errno)); + LOG_ERROR(Common, "iconv failure [%s]: %s", fromcode, strerror(errno)); break; } } @@ -531,7 +531,7 @@ std::u16string UTF8ToUTF16(const std::string& input) iconv_t const conv_desc = iconv_open("UTF-16LE", "UTF-8"); if ((iconv_t)(-1) == conv_desc) { - ERROR_LOG(COMMON, "Iconv initialization failure [UTF-8]: %s", strerror(errno)); + LOG_ERROR(Common, "Iconv initialization failure [UTF-8]: %s", strerror(errno)); iconv_close(conv_desc); return {}; } @@ -566,7 +566,7 @@ std::u16string UTF8ToUTF16(const std::string& input) } else { - ERROR_LOG(COMMON, "iconv failure [UTF-8]: %s", strerror(errno)); + LOG_ERROR(Common, "iconv failure [UTF-8]: %s", strerror(errno)); break; } } -- cgit v1.2.3 From ebfd831ccba32bce097491db3d6bdff0be05935e Mon Sep 17 00:00:00 2001 From: purpasmart96 Date: Tue, 16 Dec 2014 21:38:14 -0800 Subject: License change --- src/common/string_util.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/common/string_util.cpp') diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 6d9612fb5..d919b7a4c 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -1,5 +1,5 @@ -// Copyright 2013 Dolphin Emulator Project -// Licensed under GPLv2 +// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project +// Licensed under GPLv2 or any later version // Refer to the license.txt file included. #include -- cgit v1.2.3