forked from ShuriZma/suyu
1
0
Fork 0

Merge pull request #892 from zawata/another-warning-fixes

Yet More Warning Fixes
This commit is contained in:
Yuri Kunde Schlesner 2015-07-25 12:50:32 -07:00
commit 9a0f9f12cd
9 changed files with 24 additions and 24 deletions

View File

@ -170,7 +170,7 @@ GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractListModel(p
} }
int GPUCommandListModel::rowCount(const QModelIndex& parent) const { int GPUCommandListModel::rowCount(const QModelIndex& parent) const {
return pica_trace.writes.size(); return static_cast<int>(pica_trace.writes.size());
} }
int GPUCommandListModel::columnCount(const QModelIndex& parent) const { int GPUCommandListModel::columnCount(const QModelIndex& parent) const {

View File

@ -34,7 +34,7 @@ int GraphicsVertexShaderModel::columnCount(const QModelIndex& parent) const {
} }
int GraphicsVertexShaderModel::rowCount(const QModelIndex& parent) const { int GraphicsVertexShaderModel::rowCount(const QModelIndex& parent) const {
return info.code.size(); return static_cast<int>(info.code.size());
} }
QVariant GraphicsVertexShaderModel::headerData(int section, Qt::Orientation orientation, int role) const { QVariant GraphicsVertexShaderModel::headerData(int section, Qt::Orientation orientation, int role) const {

View File

@ -74,7 +74,7 @@ int ProfilerModel::rowCount(const QModelIndex& parent) const
if (parent.isValid()) { if (parent.isValid()) {
return 0; return 0;
} else { } else {
return results.time_per_category.size() + 2; return static_cast<int>(results.time_per_category.size() + 2);
} }
} }

View File

@ -313,7 +313,7 @@ static std::string UTF16ToUTF8(const std::wstring& input)
std::string output; std::string output;
output.resize(size); 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(), static_cast<int>(input.size()), &output[0], static_cast<int>(output.size()), nullptr, nullptr))
output.clear(); output.clear();
return output; return output;

View File

@ -502,7 +502,7 @@ void Advance() {
Core::g_app_core->down_count += diff; Core::g_app_core->down_count += diff;
} }
if (advance_callback) if (advance_callback)
advance_callback(cycles_executed); advance_callback(static_cast<int>(cycles_executed));
} }
void LogPendingEvents() { void LogPendingEvents() {

View File

@ -191,7 +191,7 @@ static THREEDSX_Error Load3DSXFile(FileUtil::IOFile& file, u32 base_addr, Shared
*pos = (addr); *pos = (addr);
break; break;
case 1: case 1:
*pos = (addr - in_addr); *pos = static_cast<u32>(addr - in_addr);
break; break;
default: default:
break; //this should never happen break; //this should never happen

View File

@ -103,7 +103,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
case PICA_REG_INDEX_WORKAROUND(command_buffer.trigger[0], 0x23c): case PICA_REG_INDEX_WORKAROUND(command_buffer.trigger[0], 0x23c):
case PICA_REG_INDEX_WORKAROUND(command_buffer.trigger[1], 0x23d): case PICA_REG_INDEX_WORKAROUND(command_buffer.trigger[1], 0x23d):
{ {
unsigned index = id - PICA_REG_INDEX(command_buffer.trigger[0]); unsigned index = static_cast<unsigned>(id - PICA_REG_INDEX(command_buffer.trigger[0]));
u32* head_ptr = (u32*)Memory::GetPhysicalPointer(regs.command_buffer.GetPhysicalAddress(index)); u32* head_ptr = (u32*)Memory::GetPhysicalPointer(regs.command_buffer.GetPhysicalAddress(index));
g_state.cmd_list.head_ptr = g_state.cmd_list.current_ptr = head_ptr; g_state.cmd_list.head_ptr = g_state.cmd_list.current_ptr = head_ptr;
g_state.cmd_list.length = regs.command_buffer.GetSize(index) / sizeof(u32); g_state.cmd_list.length = regs.command_buffer.GetSize(index) / sizeof(u32);

View File

@ -85,7 +85,7 @@ void GeometryDumper::AddTriangle(Vertex& v0, Vertex& v1, Vertex& v2) {
vertices.push_back(v1); vertices.push_back(v1);
vertices.push_back(v2); vertices.push_back(v2);
int num_vertices = vertices.size(); size_t num_vertices = vertices.size();
faces.push_back({ num_vertices-3, num_vertices-2, num_vertices-1 }); faces.push_back({ num_vertices-3, num_vertices-2, num_vertices-1 });
} }
@ -241,8 +241,8 @@ void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data
dvle.main_offset_words = main_offset; dvle.main_offset_words = main_offset;
dvle.output_register_table_offset = write_offset - dvlb.dvle_offset; dvle.output_register_table_offset = write_offset - dvlb.dvle_offset;
dvle.output_register_table_size = output_info_table.size(); dvle.output_register_table_size = static_cast<uint32_t>(output_info_table.size());
QueueForWriting((u8*)output_info_table.data(), output_info_table.size() * sizeof(OutputRegisterInfo)); QueueForWriting((u8*)output_info_table.data(), static_cast<u32>(output_info_table.size() * sizeof(OutputRegisterInfo)));
// TODO: Create a label table for "main" // TODO: Create a label table for "main"
@ -497,31 +497,31 @@ const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const Texture
// Lookup base value // Lookup base value
Math::Vec3<int> ret; Math::Vec3<int> ret;
if (differential_mode) { if (differential_mode) {
ret.r() = differential.r; ret.r() = static_cast<int>(differential.r);
ret.g() = differential.g; ret.g() = static_cast<int>(differential.g);
ret.b() = differential.b; ret.b() = static_cast<int>(differential.b);
if (x >= 2) { if (x >= 2) {
ret.r() += differential.dr; ret.r() += static_cast<int>(differential.dr);
ret.g() += differential.dg; ret.g() += static_cast<int>(differential.dg);
ret.b() += differential.db; ret.b() += static_cast<int>(differential.db);
} }
ret.r() = Color::Convert5To8(ret.r()); ret.r() = Color::Convert5To8(ret.r());
ret.g() = Color::Convert5To8(ret.g()); ret.g() = Color::Convert5To8(ret.g());
ret.b() = Color::Convert5To8(ret.b()); ret.b() = Color::Convert5To8(ret.b());
} else { } else {
if (x < 2) { if (x < 2) {
ret.r() = Color::Convert4To8(separate.r1); ret.r() = Color::Convert4To8(static_cast<u8>(separate.r1));
ret.g() = Color::Convert4To8(separate.g1); ret.g() = Color::Convert4To8(static_cast<u8>(separate.g1));
ret.b() = Color::Convert4To8(separate.b1); ret.b() = Color::Convert4To8(static_cast<u8>(separate.b1));
} else { } else {
ret.r() = Color::Convert4To8(separate.r2); ret.r() = Color::Convert4To8(static_cast<u8>(separate.r2));
ret.g() = Color::Convert4To8(separate.g2); ret.g() = Color::Convert4To8(static_cast<u8>(separate.g2));
ret.b() = Color::Convert4To8(separate.b2); ret.b() = Color::Convert4To8(static_cast<u8>(separate.b2));
} }
} }
// Add modifier // Add modifier
unsigned table_index = (x < 2) ? table_index_1.Value() : table_index_2.Value(); unsigned table_index = static_cast<int>((x < 2) ? table_index_1.Value() : table_index_2.Value());
static const std::array<std::array<u8, 2>, 8> etc1_modifier_table = {{ static const std::array<std::array<u8, 2>, 8> etc1_modifier_table = {{
{ 2, 8 }, { 5, 17 }, { 9, 29 }, { 13, 42 }, { 2, 8 }, { 5, 17 }, { 9, 29 }, { 13, 42 },

View File

@ -913,7 +913,7 @@ struct Regs {
#define ADD_FIELD(name) \ #define ADD_FIELD(name) \
do { \ do { \
map.insert({PICA_REG_INDEX(name), #name}); \ map.insert({static_cast<u32>(PICA_REG_INDEX(name)), #name}); \
/* TODO: change to Regs::name when VS2015 and other compilers support it */ \ /* TODO: change to Regs::name when VS2015 and other compilers support it */ \
for (u32 i = PICA_REG_INDEX(name) + 1; i < PICA_REG_INDEX(name) + sizeof(Regs().name) / 4; ++i) \ for (u32 i = PICA_REG_INDEX(name) + 1; i < PICA_REG_INDEX(name) + sizeof(Regs().name) / 4; ++i) \
map.insert({i, #name + std::string("+") + std::to_string(i-PICA_REG_INDEX(name))}); \ map.insert({i, #name + std::string("+") + std::to_string(i-PICA_REG_INDEX(name))}); \