warnings and code formatting

This commit is contained in:
Jordan Cristiano
2013-11-13 04:03:46 -05:00
parent 038ffea369
commit f96e9e1ae4
10 changed files with 37 additions and 21 deletions

View File

@ -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!

View File

@ -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;
}

View File

@ -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];