From 913087c21fbdeffe8d2bfea51c38382981430665 Mon Sep 17 00:00:00 2001 From: RadWolfie Date: Wed, 16 May 2018 18:22:19 -0500 Subject: [PATCH] Fix warning messages * \src\cxbxkrnl\emursa.cpp(1032): warning C4018: '<': signed/unsigned mismatch * \src\cxbxkrnl\emursa.cpp(1034): warning C4018: '<=': signed/unsigned mismatch * \src\cxbxkrnl\emuxapi.cpp(256): warning C4018: '<': signed/unsigned mismatch * \src\cxbxkrnl\emufile.cpp(331): warning C4267: '=': conversion from 'size_t' to 'xboxkrnl::USHORT', possible loss of data * \src\cxbxkrnl\emuxinput.cpp(63): warning C4789: buffer 'g_Controller' of size 16 bytes will be overrun; 24 bytes will be written starting at offset 0 * \src\cxbxkrnl\emud3d8\convert.cpp(769): warning C4244: '=': conversion from 'uint32' to 'uint8', possible loss of data * \src\cxbxkrnl\emud3d8\convert.cpp(770): warning C4244: '=': conversion from 'uint32' to 'uint8', possible loss of data * \src\cxbxkrnl\emud3d8\convert.cpp(771): warning C4244: '=': conversion from 'uint32' to 'uint8', possible loss of data * \src\cxbxkrnl\gloffscreen\gloffscreen_common.cpp(64): warning C4018: '<': signed/unsigned mismatch * \src\devices\video\emunv2a_pfifo.cpp(81): warning C4805: '|': unsafe mix of type 'xbaddr' and type 'bool' in operation * \src\devices\video\emunv2a_pgraph.cpp(3103): warning C4838: conversion from 'int' to 'unsigned int' requires a narrowing conversion * \src\devices\video\nv2a_vsh.cpp(704): warning C4018: '<': signed/unsigned mismatch * \src\devices\video\nv2a_shaders.cpp(231): warning C4018: '<': signed/unsigned mismatch * \src\devices\video\emunv2a_pgraph.cpp(2938): warning C4018: '<': signed/unsigned mismatch * \src\devices\video\emunv2a_pgraph.cpp(3749): warning C4018: '<': signed/unsigned mismatch * \src\devices\video\emunv2a_pgraph.cpp(2972): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data * \src\devices\video\emunv2a_pgraph.cpp(2973): warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data --- src/CxbxKrnl/EmuD3D8/Convert.cpp | 6 +++--- src/CxbxKrnl/EmuFile.cpp | 2 +- src/CxbxKrnl/EmuRsa.cpp | 2 +- src/CxbxKrnl/EmuXInput.cpp | 2 +- src/CxbxKrnl/EmuXapi.cpp | 2 +- src/CxbxKrnl/gloffscreen/gloffscreen_common.cpp | 2 +- src/HighPerformanceGraphicsEnabler.c | 2 +- src/devices/video/EmuNV2A_PFIFO.cpp | 2 +- src/devices/video/EmuNV2A_PGRAPH.cpp | 10 +++++----- src/devices/video/nv2a_shaders.cpp | 2 +- src/devices/video/nv2a_vsh.cpp | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/CxbxKrnl/EmuD3D8/Convert.cpp b/src/CxbxKrnl/EmuD3D8/Convert.cpp index 37e4b346f..86e724114 100755 --- a/src/CxbxKrnl/EmuD3D8/Convert.cpp +++ b/src/CxbxKrnl/EmuD3D8/Convert.cpp @@ -766,9 +766,9 @@ static __inline void YuvPixel(uint8 y, uint8 u, uint8 v, int yg = yuvconstants->kYToRgb[0]; uint32 y1 = (uint32)(y * 0x0101 * yg) >> 16; - *b = Clamp((int32)(-(u * ub) + y1 + bb) >> 6); - *g = Clamp((int32)(-(u * ug + v * vg) + y1 + bg) >> 6); - *r = Clamp((int32)(-(v * vr) + y1 + br) >> 6); + *b = (uint8)Clamp((int32)(-(u * ub) + y1 + bb) >> 6); + *g = (uint8)Clamp((int32)(-(u * ug + v * vg) + y1 + bg) >> 6); + *r = (uint8)Clamp((int32)(-(v * vr) + y1 + br) >> 6); } void ____YUY2ToARGBRow_C(const uint8* src_yuy2, diff --git a/src/CxbxKrnl/EmuFile.cpp b/src/CxbxKrnl/EmuFile.cpp index 59475a2d1..5a7ba3636 100644 --- a/src/CxbxKrnl/EmuFile.cpp +++ b/src/CxbxKrnl/EmuFile.cpp @@ -328,7 +328,7 @@ std::string PSTRING_to_string(xboxkrnl::PSTRING const & src) void copy_string_to_PSTRING_to(std::string const & src, const xboxkrnl::PSTRING & dest) { - dest->Length = src.size(); + dest->Length = (USHORT)src.size(); memcpy(dest->Buffer, src.c_str(), src.size()); } diff --git a/src/CxbxKrnl/EmuRsa.cpp b/src/CxbxKrnl/EmuRsa.cpp index d02c003d2..a118763db 100644 --- a/src/CxbxKrnl/EmuRsa.cpp +++ b/src/CxbxKrnl/EmuRsa.cpp @@ -1011,7 +1011,7 @@ void grammarsquareg(giant a) { unsigned int cur_term; unsigned int prod, carry = 0, temp; - int asize = abs(a->sign), max = asize * 2 - 1; + unsigned int asize = abs(a->sign), max = asize * 2 - 1; unsigned short *ptr = a->n, *ptr1, *ptr2; giant scratch; diff --git a/src/CxbxKrnl/EmuXInput.cpp b/src/CxbxKrnl/EmuXInput.cpp index 4148a37f3..ef0b096fe 100644 --- a/src/CxbxKrnl/EmuXInput.cpp +++ b/src/CxbxKrnl/EmuXInput.cpp @@ -60,7 +60,7 @@ DWORD XTL::XInputGamepad_Connected(void) DWORD gamepad_connected = 0; for (DWORD i = 0; i< 4; i++) { - ZeroMemory(&g_Controller, sizeof(XINPUT_STATE)); + ZeroMemory(&g_Controller, sizeof(::XINPUT_STATE)); // query each port for gamepad state dwResult = XInputGetState(i, &g_Controller); diff --git a/src/CxbxKrnl/EmuXapi.cpp b/src/CxbxKrnl/EmuXapi.cpp index f9710a005..58e11cec4 100644 --- a/src/CxbxKrnl/EmuXapi.cpp +++ b/src/CxbxKrnl/EmuXapi.cpp @@ -253,7 +253,7 @@ DWORD WINAPI XTL::EMUPATCH(XGetDevices) // If this is for getting gamepad devices, and no gamepad was previously detected, connect one if (DeviceType == gDeviceType_Gamepad && DeviceType->CurrentConnected == 0) { - for (int i = 0; i < total_xinput_gamepad; i++) + for (unsigned int i = 0; i < total_xinput_gamepad; i++) { DeviceType->CurrentConnected |= 1<pfifo.cache1.subroutine_return - | d->pfifo.cache1.subroutine_active; + | (xbaddr)d->pfifo.cache1.subroutine_active; break; case NV_PFIFO_CACHE1_PULL0: { qemu_mutex_lock(&d->pfifo.cache1.cache_lock); diff --git a/src/devices/video/EmuNV2A_PGRAPH.cpp b/src/devices/video/EmuNV2A_PGRAPH.cpp index 6900a57fb..7a51ccaf1 100644 --- a/src/devices/video/EmuNV2A_PGRAPH.cpp +++ b/src/devices/video/EmuNV2A_PGRAPH.cpp @@ -2837,7 +2837,7 @@ static void pgraph_shader_update_constants(PGRAPHState *pg, { assert(pg->opengl_enabled); - int i, j; + unsigned int i, j; /* update combiner constants */ for (i = 0; i<= 8; i++) { @@ -2969,8 +2969,8 @@ static void pgraph_shader_update_constants(PGRAPHState *pg, /* estimate the viewport by assuming it matches the surface ... */ //FIXME: Get surface dimensions? - float m11 = 0.5 * pg->surface_shape.clip_width; - float m22 = -0.5 * pg->surface_shape.clip_height; + float m11 = 0.5f * pg->surface_shape.clip_width; + float m22 = -0.5f * pg->surface_shape.clip_height; float m33 = zclip_max - zclip_min; //float m41 = m11; //float m42 = -m22; @@ -3021,7 +3021,7 @@ static void pgraph_bind_shaders(PGRAPHState *pg) { assert(pg->opengl_enabled); - int i, j; + unsigned int i, j; bool vertex_program = GET_MASK(pg->regs[NV_PGRAPH_CSV0_D], NV_PGRAPH_CSV0_D_MODE) == 2; @@ -3744,7 +3744,7 @@ static void pgraph_bind_textures(NV2AState *d) } else { if (dimensionality >= 2) { unsigned int w = width, h = height; - int level; + unsigned int level; if (f.gl_format != 0) { for (level = 0; level < levels; level++) { w = MAX(w, 1); h = MAX(h, 1); diff --git a/src/devices/video/nv2a_shaders.cpp b/src/devices/video/nv2a_shaders.cpp index 7f32d9e18..579c7ddef 100644 --- a/src/devices/video/nv2a_shaders.cpp +++ b/src/devices/video/nv2a_shaders.cpp @@ -227,7 +227,7 @@ static void append_skinning_code(QString* str, bool mix, } } else { /* Individual matrices */ - int i; + unsigned int i; for (i = 0; i < count; i++) { char c = "xyzw"[i]; qstring_append_fmt(str, "%s += (%s * %s%d * weight.%c).%s;\n", diff --git a/src/devices/video/nv2a_vsh.cpp b/src/devices/video/nv2a_vsh.cpp index aa02abff2..38b9af830 100644 --- a/src/devices/video/nv2a_vsh.cpp +++ b/src/devices/video/nv2a_vsh.cpp @@ -700,7 +700,7 @@ void vsh_translate(uint16_t version, qstring_append(header, vsh_header); bool has_final = false; - int slot; + unsigned int slot; for (slot=0; slot < length; slot++) { const uint32_t* cur_token = &tokens[slot * VSH_TOKEN_SIZE]; QString *token_str = decode_token(cur_token);