From 63c2e32e207d31ecadd9022e1d7cd705c9febac8 Mon Sep 17 00:00:00 2001 From: fearlessTobi Date: Sat, 15 Sep 2018 15:21:06 +0200 Subject: Port #4182 from Citra: "Prefix all size_t with std::" --- src/common/string_util.cpp | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'src/common/string_util.cpp') diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 0ca663032..c9a5425a7 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -37,7 +37,7 @@ std::string ToUpper(std::string str) { } // For Debugging. Read out an u8 array. -std::string ArrayToString(const u8* data, size_t size, int line_len, bool spaces) { +std::string ArrayToString(const u8* data, std::size_t size, int line_len, bool spaces) { std::ostringstream oss; oss << std::setfill('0') << std::hex; @@ -60,7 +60,7 @@ std::string StringFromBuffer(const std::vector& data) { // Turns " hej " into "hej". Also handles tabs. std::string StripSpaces(const std::string& str) { - const size_t s = str.find_first_not_of(" \t\r\n"); + const std::size_t s = str.find_first_not_of(" \t\r\n"); if (str.npos != s) return str.substr(s, str.find_last_not_of(" \t\r\n") - s + 1); @@ -121,10 +121,10 @@ bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _ if (full_path.empty()) return false; - size_t dir_end = full_path.find_last_of("/" + std::size_t dir_end = full_path.find_last_of("/" // windows needs the : included for something like just "C:" to be considered a directory #ifdef _WIN32 - "\\:" + "\\:" #endif ); if (std::string::npos == dir_end) @@ -132,7 +132,7 @@ bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _ else dir_end += 1; - size_t fname_end = full_path.rfind('.'); + std::size_t fname_end = full_path.rfind('.'); if (fname_end < dir_end || std::string::npos == fname_end) fname_end = full_path.size(); @@ -172,7 +172,7 @@ void SplitString(const std::string& str, const char delim, std::vector& return {}; } - const size_t in_bytes = sizeof(T) * input.size(); + const std::size_t in_bytes = sizeof(T) * input.size(); // Multiply by 4, which is the max number of bytes to encode a codepoint - const size_t out_buffer_size = 4 * in_bytes; + const std::size_t out_buffer_size = 4 * in_bytes; std::string out_buffer(out_buffer_size, '\0'); auto src_buffer = &input[0]; - size_t src_bytes = in_bytes; + std::size_t src_bytes = in_bytes; auto dst_buffer = &out_buffer[0]; - size_t dst_bytes = out_buffer.size(); + std::size_t dst_bytes = out_buffer.size(); while (0 != src_bytes) { - size_t const iconv_result = + std::size_t const iconv_result = iconv(conv_desc, (char**)(&src_buffer), &src_bytes, &dst_buffer, &dst_bytes); - if (static_cast(-1) == iconv_result) { + if (static_cast(-1) == iconv_result) { if (EILSEQ == errno || EINVAL == errno) { // Try to skip the bad character if (0 != src_bytes) { @@ -326,22 +326,22 @@ std::u16string UTF8ToUTF16(const std::string& input) { return {}; } - const size_t in_bytes = sizeof(char) * input.size(); + const std::size_t in_bytes = sizeof(char) * input.size(); // Multiply by 4, which is the max number of bytes to encode a codepoint - const size_t out_buffer_size = 4 * sizeof(char16_t) * in_bytes; + const std::size_t out_buffer_size = 4 * sizeof(char16_t) * in_bytes; std::u16string out_buffer(out_buffer_size, char16_t{}); char* src_buffer = const_cast(&input[0]); - size_t src_bytes = in_bytes; + std::size_t src_bytes = in_bytes; char* dst_buffer = (char*)(&out_buffer[0]); - size_t dst_bytes = out_buffer.size(); + std::size_t dst_bytes = out_buffer.size(); while (0 != src_bytes) { - size_t const iconv_result = + std::size_t const iconv_result = iconv(conv_desc, &src_buffer, &src_bytes, &dst_buffer, &dst_bytes); - if (static_cast(-1) == iconv_result) { + if (static_cast(-1) == iconv_result) { if (EILSEQ == errno || EINVAL == errno) { // Try to skip the bad character if (0 != src_bytes) { @@ -381,8 +381,8 @@ std::string SHIFTJISToUTF8(const std::string& input) { #endif -std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, size_t max_len) { - size_t len = 0; +std::string StringFromFixedZeroTerminatedBuffer(const char* buffer, std::size_t max_len) { + std::size_t len = 0; while (len < max_len && buffer[len] != '\0') ++len; -- cgit v1.2.3