From 26301692290a30bc426f82a96324285909617127 Mon Sep 17 00:00:00 2001 From: comex Date: Fri, 30 Aug 2013 00:43:21 -0400 Subject: [PATCH] More warnings: mark/avert truncating conversions from float. --- .../Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXWii.cpp | 2 +- Source/Core/Core/Src/HW/GCPadEmu.cpp | 2 +- Source/Core/DolphinWX/Src/InputConfigDiagBitmaps.cpp | 12 ++++++------ Source/Plugins/Plugin_VideoDX9/Src/Render.cpp | 2 +- Source/Plugins/Plugin_VideoOGL/Src/RasterFont.cpp | 6 +++--- Source/Plugins/Plugin_VideoSoftware/Src/Tev.cpp | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXWii.cpp b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXWii.cpp index 63f29c5a33..a67d5538ee 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXWii.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AXWii.cpp @@ -364,7 +364,7 @@ void CUCode_AXWii::GenerateVolumeRamp(u16* output, u16 vol1, u16 vol2, size_t nv for (size_t i = 0; i < nvals; ++i) { curr += (vol2 - vol1) / (float)nvals; - output[i] = curr; + output[i] = (u16) curr; } } diff --git a/Source/Core/Core/Src/HW/GCPadEmu.cpp b/Source/Core/Core/Src/HW/GCPadEmu.cpp index af4130b1bc..a1e07794c7 100644 --- a/Source/Core/Core/Src/HW/GCPadEmu.cpp +++ b/Source/Core/Core/Src/HW/GCPadEmu.cpp @@ -119,7 +119,7 @@ void GCPad::GetInput(SPADStatus* const pad) void GCPad::SetMotor(const u8 on) { float state = (float)on / 255; - float force = abs(state - 0.5) * 2; + float force = abs(state - 0.5f) * 2; if (state < 0.5) force = -force; diff --git a/Source/Core/DolphinWX/Src/InputConfigDiagBitmaps.cpp b/Source/Core/DolphinWX/Src/InputConfigDiagBitmaps.cpp index 03c140b992..6aa37d78e9 100644 --- a/Source/Core/DolphinWX/Src/InputConfigDiagBitmaps.cpp +++ b/Source/Core/DolphinWX/Src/InputConfigDiagBitmaps.cpp @@ -109,18 +109,18 @@ void InputConfigDialog::UpdateBitmaps(wxTimerEvent& WXUNUSED(event)) if (strcmp((*g)->control_group->name, "Main Stick") == 0) { - max = (87.0 / 127.0) * 100; - diagonal = (55.0 / 127.0) * 100.0; + max = (87.0f / 127.0f) * 100; + diagonal = (55.0f / 127.0f) * 100.0; } else if (strcmp((*g)->control_group->name,"C-Stick") == 0) { - max = (74.0 / 127.0) * 100; - diagonal = (46.0 / 127.0) * 100; + max = (74.0f / 127.0f) * 100; + diagonal = (46.0f / 127.0f) * 100; } else { - max = (82.0 / 127.0) * 100; - diagonal = (58.0 / 127.0) * 100; + max = (82.0f / 127.0f) * 100; + diagonal = (58.0f / 127.0f) * 100; } // polygon corners diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index bd4f9fed98..f11d7afd0b 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -1318,7 +1318,7 @@ void Renderer::SetLineWidth() // We can't change line width in D3D unless we use ID3DXLine float fratio = xfregs.viewport.wd != 0 ? Renderer::EFBToScaledXf(1.f) : 1.0f; float psize = bpmem.lineptwidth.pointsize * fratio / 6.0f; - psize = psize > 0 ? psize : 1.0; + psize = psize > 0 ? psize : 1.0f; if (psize > m_fMaxPointSize) { psize = m_fMaxPointSize; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/RasterFont.cpp b/Source/Plugins/Plugin_VideoOGL/Src/RasterFont.cpp index 9011b072e8..9e46a5eb86 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/RasterFont.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/RasterFont.cpp @@ -189,8 +189,8 @@ void RasterFont::printMultilineText(const char *text, double start_x, double sta int usage = 0; GLfloat delta_x = GLfloat(2*char_width)/GLfloat(bbWidth); GLfloat delta_y = GLfloat(2*char_height)/GLfloat(bbHeight); - GLfloat border_x = 2.0/GLfloat(bbWidth); - GLfloat border_y = 4.0/GLfloat(bbHeight); + GLfloat border_x = 2.0f/GLfloat(bbWidth); + GLfloat border_y = 4.0f/GLfloat(bbHeight); GLfloat x = GLfloat(start_x); GLfloat y = GLfloat(start_y); @@ -199,7 +199,7 @@ void RasterFont::printMultilineText(const char *text, double start_x, double sta u8 c = text[i]; if(c == '\n') { - x = start_x; + x = GLfloat(start_x); y -= delta_y + border_y; continue; } diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/Tev.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/Tev.cpp index 7ab798e2fb..effe1d3261 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/Tev.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/Tev.cpp @@ -755,7 +755,7 @@ void Tev::Draw() // First, calculate the offset from the viewport center (normalized to 0..1) float offset = (Position[0] - (bpmem.fogRange.Base.Center - 342)) / (float)swxfregs.viewport.wd; // Based on that, choose the index such that points which are far away from the z-axis use the 10th "k" value and such that central points use the first value. - int index = 9 - std::abs(offset) * 9.f; + int index = (int) (9 - std::abs(offset) * 9.f); index = (index < 0) ? 0 : (index > 9) ? 9 : index; // TODO: Shouldn't be necessary! // Look up coefficient... Seems like multiplying by 4 makes Fortune Street work properly (fog is too strong without the factor) float k = bpmem.fogRange.K[index/2].GetValue(index%2) * 4.f;