diff options
| author | Jordan Cristiano <jordan.cristi [AT] gmail.com> | 2013-11-13 04:03:46 -0500 |
|---|---|---|
| committer | Jordan Cristiano <jordan.cristi [AT] gmail.com> | 2013-11-13 04:03:46 -0500 |
| commit | f96e9e1ae43a510c83087efcbfb5fd57cdfe0b38 (patch) | |
| tree | 2ff9ca309347bcaf9de06f590875cd606a9c21ac /Source/Core/Common | |
| parent | 038ffea369bbe65a7436c81f6ff7fb12d14ee46d (diff) | |
warnings and code formatting
Diffstat (limited to 'Source/Core/Common')
| -rw-r--r-- | Source/Core/Common/Src/ChunkFile.h | 4 | ||||
| -rw-r--r-- | Source/Core/Common/Src/StringUtil.cpp | 12 | ||||
| -rw-r--r-- | Source/Core/Common/Src/SysConf.cpp | 2 |
3 files changed, 12 insertions, 6 deletions
diff --git a/Source/Core/Common/Src/ChunkFile.h b/Source/Core/Common/Src/ChunkFile.h index 5192b4332e..d7aeba0558 100644 --- a/Source/Core/Common/Src/ChunkFile.h +++ b/Source/Core/Common/Src/ChunkFile.h @@ -193,10 +193,12 @@ public: void DoPointer(T*& x, T* const base) { // pointers can be more than 2^31 apart, but you're using this function wrong if you need that much range - s32 offset = x - base; + ptrdiff_t offset = x - base; Do(offset); if (mode == MODE_READ) + { x = base + offset; + } } // Let's pretend std::list doesn't exist! diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp index 5243b24260..7ad4ac6ca5 100644 --- a/Source/Core/Common/Src/StringUtil.cpp +++ b/Source/Core/Common/Src/StringUtil.cpp @@ -404,26 +404,30 @@ std::string UriEncode(const std::string & sSrc) std::string UTF16ToUTF8(const std::wstring& input) { - auto const size = WideCharToMultiByte(CP_UTF8, 0, input.data(), input.size(), nullptr, 0, nullptr, nullptr); + auto const size = WideCharToMultiByte(CP_UTF8, 0, input.data(), (int)input.size(), nullptr, 0, nullptr, nullptr); std::string output; output.resize(size); - if (size == 0 || size != WideCharToMultiByte(CP_UTF8, 0, input.data(), input.size(), &output[0], output.size(), nullptr, nullptr)) + if (size == 0 || size != WideCharToMultiByte(CP_UTF8, 0, input.data(), (int)input.size(), &output[0], (int)output.size(), nullptr, nullptr)) + { output.clear(); + } return output; } std::wstring CPToUTF16(u32 code_page, const std::string& input) { - auto const size = MultiByteToWideChar(code_page, 0, input.data(), input.size(), nullptr, 0); + auto const size = MultiByteToWideChar(code_page, 0, input.data(), (int)input.size(), nullptr, 0); std::wstring output; output.resize(size); - if (size == 0 || size != MultiByteToWideChar(code_page, 0, input.data(), input.size(), &output[0], output.size())) + if (size == 0 || size != MultiByteToWideChar(code_page, 0, input.data(), (int)input.size(), &output[0], (int)output.size())) + { output.clear(); + } return output; } diff --git a/Source/Core/Common/Src/SysConf.cpp b/Source/Core/Common/Src/SysConf.cpp index 519765b10d..acfb11b0ed 100644 --- a/Source/Core/Common/Src/SysConf.cpp +++ b/Source/Core/Common/Src/SysConf.cpp @@ -153,7 +153,7 @@ unsigned int create_item(SSysConfEntry &item, SysconfType type, const std::strin { item.offset = offset; item.type = type; - item.nameLength = name.length(); + item.nameLength = (u8)(name.length()); strncpy(item.name, name.c_str(), 32); item.dataLength = data_length; item.data = new u8[data_length]; |
