From 72661e7c16ef3f638db6be0c85e93a84377ba177 Mon Sep 17 00:00:00 2001 From: Akash Date: Wed, 29 Jun 2016 23:00:15 +0530 Subject: [PATCH 1/5] PCSX2-Core: Clean up some warnings on MSVC x86emitter : Convert variable type from u8 to bool. recVTLB: Cast "sign" to bool to prevent a warning. R5900OpcodeImpl: Cast all the values in array to u64 instead of s64. --- common/src/x86emitter/x86emitter.cpp | 8 ++++---- pcsx2/R5900OpcodeImpl.cpp | 16 ++++++++-------- pcsx2/x86/ix86-32/recVTLB.cpp | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/common/src/x86emitter/x86emitter.cpp b/common/src/x86emitter/x86emitter.cpp index b19694f997..fc14e30707 100644 --- a/common/src/x86emitter/x86emitter.cpp +++ b/common/src/x86emitter/x86emitter.cpp @@ -426,10 +426,10 @@ void EmitRex( const xRegisterBase& reg1, const void* src ) void EmitRex( const xRegisterBase& reg1, const xIndirectVoid& sib ) { - u8 w = reg1.IsWide(); - u8 r = reg1.IsExtended(); - u8 x = sib.Index.IsExtended(); - u8 b = sib.Base.IsExtended(); + bool w = reg1.IsWide(); + bool r = reg1.IsExtended(); + bool x = sib.Index.IsExtended(); + bool b = sib.Base.IsExtended(); EmitRex(w, r, x, b); } diff --git a/pcsx2/R5900OpcodeImpl.cpp b/pcsx2/R5900OpcodeImpl.cpp index 8e0fb36fdd..7a465746ef 100644 --- a/pcsx2/R5900OpcodeImpl.cpp +++ b/pcsx2/R5900OpcodeImpl.cpp @@ -666,12 +666,12 @@ void LD() } static const u64 LDL_MASK[8] = -{ 0x00ffffffffffffffLL, 0x0000ffffffffffffLL, 0x000000ffffffffffLL, 0x00000000ffffffffLL, - 0x0000000000ffffffLL, 0x000000000000ffffLL, 0x00000000000000ffLL, 0x0000000000000000LL +{ 0x00ffffffffffffffULL, 0x0000ffffffffffffULL, 0x000000ffffffffffULL, 0x00000000ffffffffULL, + 0x0000000000ffffffULL, 0x000000000000ffffULL, 0x00000000000000ffULL, 0x0000000000000000ULL }; static const u64 LDR_MASK[8] = -{ 0x0000000000000000LL, 0xff00000000000000LL, 0xffff000000000000LL, 0xffffff0000000000LL, - 0xffffffff00000000LL, 0xffffffffff000000LL, 0xffffffffffff0000LL, 0xffffffffffffff00LL +{ 0x0000000000000000ULL, 0xff00000000000000ULL, 0xffff000000000000ULL, 0xffffff0000000000ULL, + 0xffffffff00000000ULL, 0xffffffffff000000ULL, 0xffffffffffff0000ULL, 0xffffffffffffff00ULL }; static const u8 LDR_SHIFT[8] = { 0, 8, 16, 24, 32, 40, 48, 56 }; @@ -797,12 +797,12 @@ void SD() } static const u64 SDL_MASK[8] = -{ 0xffffffffffffff00LL, 0xffffffffffff0000LL, 0xffffffffff000000LL, 0xffffffff00000000LL, - 0xffffff0000000000LL, 0xffff000000000000LL, 0xff00000000000000LL, 0x0000000000000000LL +{ 0xffffffffffffff00ULL, 0xffffffffffff0000ULL, 0xffffffffff000000ULL, 0xffffffff00000000ULL, + 0xffffff0000000000ULL, 0xffff000000000000ULL, 0xff00000000000000ULL, 0x0000000000000000ULL }; static const u64 SDR_MASK[8] = -{ 0x0000000000000000LL, 0x00000000000000ffLL, 0x000000000000ffffLL, 0x0000000000ffffffLL, - 0x00000000ffffffffLL, 0x000000ffffffffffLL, 0x0000ffffffffffffLL, 0x00ffffffffffffffLL +{ 0x0000000000000000ULL, 0x00000000000000ffULL, 0x000000000000ffffULL, 0x0000000000ffffffULL, + 0x00000000ffffffffULL, 0x000000ffffffffffULL, 0x0000ffffffffffffULL, 0x00ffffffffffffffULL }; static const u8 SDL_SHIFT[8] = { 56, 48, 40, 32, 24, 16, 8, 0 }; diff --git a/pcsx2/x86/ix86-32/recVTLB.cpp b/pcsx2/x86/ix86-32/recVTLB.cpp index 0d6b218b2c..b99f095cb1 100644 --- a/pcsx2/x86/ix86-32/recVTLB.cpp +++ b/pcsx2/x86/ix86-32/recVTLB.cpp @@ -327,7 +327,7 @@ void vtlb_dynarec_init() { xSetPtr( GetIndirectDispatcherPtr( mode, bits, !!sign ) ); - DynGen_IndirectTlbDispatcher( mode, bits, sign ); + DynGen_IndirectTlbDispatcher( mode, bits, !!sign ); } } } From 4cfb2b248ec6db7d8a7c7cd6c2756eeab7c6dcfb Mon Sep 17 00:00:00 2001 From: Akash Date: Wed, 29 Jun 2016 23:12:05 +0530 Subject: [PATCH 2/5] GSDX: Clean up warnings on MSVC GLLoader: cast passed parameters to required type. GSDeviceOGL: cast variables to required type and silence warnings. GSRendererOGL: cast variables to required type and silence warnings. --- plugins/GSdx/GLLoader.cpp | 2 +- plugins/GSdx/GSDeviceOGL.cpp | 4 ++-- plugins/GSdx/GSRendererOGL.cpp | 18 +++++++++--------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/plugins/GSdx/GLLoader.cpp b/plugins/GSdx/GLLoader.cpp index 46825cc2c7..7f5badecf7 100644 --- a/plugins/GSdx/GLLoader.cpp +++ b/plugins/GSdx/GLLoader.cpp @@ -184,7 +184,7 @@ namespace ReplaceGL { void APIENTRY ViewportIndexedf(GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h) { - glViewport(x, y, w, h); + glViewport(GLint(x), GLint(y), GLsizei(w), GLsizei(h)); } } diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index f83c944bc0..31e6367005 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -163,7 +163,7 @@ void GSDeviceOGL::GenerateProfilerData() double ms = 0.000001; float replay = (float)(theApp.GetConfigI("linux_replay")); - int first_query = (float)m_profiler.last_query / replay; + int first_query = static_cast((float)m_profiler.last_query / replay); glGetQueryObjectui64v(m_profiler.timer_query[first_query], GL_QUERY_RESULT, &time_start); for (uint32 q = first_query + 1; q < m_profiler.last_query; q++) { @@ -1658,7 +1658,7 @@ void GSDeviceOGL::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVecto { GLState::viewport = size; // FIXME ViewportIndexedf or ViewportIndexedfv (GL4.1) - glViewportIndexedf(0, 0, 0, size.x, size.y); + glViewportIndexedf(0, 0, 0, GLfloat(size.x), GLfloat(size.y)); } GSVector4i r = scissor ? *scissor : GSVector4i(size).zwxy(); diff --git a/plugins/GSdx/GSRendererOGL.cpp b/plugins/GSdx/GSRendererOGL.cpp index bb5c86c345..4470ff2409 100644 --- a/plugins/GSdx/GSRendererOGL.cpp +++ b/plugins/GSdx/GSRendererOGL.cpp @@ -612,7 +612,7 @@ void GSRendererOGL::EmulateTextureSampler(const GSTextureCache::Source* tex) const uint8 wms = m_context->CLAMP.WMS; const uint8 wmt = m_context->CLAMP.WMT; - bool complex_wms_wmt = (wms | wmt) & 2; + bool complex_wms_wmt = !!((wms | wmt) & 2); bool bilinear = m_filter == 2 ? m_vt.IsLinear() : m_filter != 0; bool simple_sample = !tex->m_palette && cpsm.fmt == 0 && !complex_wms_wmt && !psm.depth; @@ -998,15 +998,15 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour // Replace all sprite with a single fullscreen sprite. GSVertex* s = &m_vertex.buff[0]; - s[0].XYZ.X = (16.0f * m_vt.m_min.p.x) + m_context->XYOFFSET.OFX; - s[1].XYZ.X = (16.0f * m_vt.m_max.p.x) + m_context->XYOFFSET.OFX; - s[0].XYZ.Y = (16.0f * m_vt.m_min.p.y) + m_context->XYOFFSET.OFY; - s[1].XYZ.Y = (16.0f * m_vt.m_max.p.y) + m_context->XYOFFSET.OFY; + s[0].XYZ.X = static_cast((16.0f * m_vt.m_min.p.x) + m_context->XYOFFSET.OFX); + s[1].XYZ.X = static_cast((16.0f * m_vt.m_max.p.x) + m_context->XYOFFSET.OFX); + s[0].XYZ.Y = static_cast((16.0f * m_vt.m_min.p.y) + m_context->XYOFFSET.OFY); + s[1].XYZ.Y = static_cast((16.0f * m_vt.m_max.p.y) + m_context->XYOFFSET.OFY); - s[0].U = 16.0f * m_vt.m_min.t.x; - s[0].V = 16.0f * m_vt.m_min.t.y; - s[1].U = 16.0f * m_vt.m_max.t.x; - s[1].V = 16.0f * m_vt.m_max.t.y; + s[0].U = static_cast(16.0f * m_vt.m_min.t.x); + s[0].V = static_cast(16.0f * m_vt.m_min.t.y); + s[1].U = static_cast(16.0f * m_vt.m_max.t.x); + s[1].V = static_cast(16.0f * m_vt.m_max.t.y); m_vertex.head = m_vertex.tail = m_vertex.next = 2; m_index.tail = 2; From 264eb52d6155a38d6e3a6c6906297c99a320578c Mon Sep 17 00:00:00 2001 From: Akash Date: Wed, 29 Jun 2016 23:28:14 +0530 Subject: [PATCH 3/5] USBqemu : Clean up warnings on MSVC usb-kbd: Remove unused variable. usb-ohci: Add proper casts for the variables. vl: Add proper casts for the variables. USB: Add proper casts for the variables. --- plugins/USBqemu/USB.cpp | 4 ++-- plugins/USBqemu/qemu-usb/usb-kbd.cpp | 2 +- plugins/USBqemu/qemu-usb/usb-ohci.cpp | 16 ++++++++-------- plugins/USBqemu/qemu-usb/vl.cpp | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/plugins/USBqemu/USB.cpp b/plugins/USBqemu/USB.cpp index a76fbca31b..dcf6671c55 100644 --- a/plugins/USBqemu/USB.cpp +++ b/plugins/USBqemu/USB.cpp @@ -266,8 +266,8 @@ s32 CALLBACK USBfreeze(int mode, freezeData *data) { usbd = *(USBfreezeData*)data->data; usbd.freezeID[9] = 0; - usbd.cycles = clocks; - usbd.remaining = remaining; + usbd.cycles = static_cast(clocks); + usbd.remaining = static_cast(remaining); if( strcmp(usbd.freezeID, USBfreezeID) != 0) { diff --git a/plugins/USBqemu/qemu-usb/usb-kbd.cpp b/plugins/USBqemu/qemu-usb/usb-kbd.cpp index ef8762934a..3f07ecf215 100644 --- a/plugins/USBqemu/qemu-usb/usb-kbd.cpp +++ b/plugins/USBqemu/qemu-usb/usb-kbd.cpp @@ -616,7 +616,7 @@ static const uint8_t qemu_keyboard_hid_report_descriptor[] = { static int usb_keyboard_poll(USBKeyboardState *s, uint8_t *buf, int len) { static unsigned char keys[256]; - int i,l; + int l; if (!s->keyboard_grabbed) { //qemu_add_keyboard_event_handler(usb_keyboard_event, s, 0); diff --git a/plugins/USBqemu/qemu-usb/usb-ohci.cpp b/plugins/USBqemu/qemu-usb/usb-ohci.cpp index 3f7e0c5a17..083df5a777 100644 --- a/plugins/USBqemu/qemu-usb/usb-ohci.cpp +++ b/plugins/USBqemu/qemu-usb/usb-ohci.cpp @@ -349,7 +349,7 @@ static inline int ohci_put_hcca(OHCIState *ohci, /* Read/Write the contents of a TD from/to main memory. */ static void ohci_copy_td(OHCIState *ohci, struct ohci_td *td, - uint8_t *buf, int len, int write) + uint8_t *buf, size_t len, int write) { uint32_t ptr; uint32_t n; @@ -369,7 +369,7 @@ static void ohci_copy_td(OHCIState *ohci, struct ohci_td *td, /* Read/Write the contents of an ISO TD from/to main memory. */ static void ohci_copy_iso_td(OHCIState *ohci, uint32_t start_addr, uint32_t end_addr, - uint8_t *buf, int len, int write) + uint8_t *buf, size_t len, int write) { uint32_t ptr; uint32_t n; @@ -577,7 +577,7 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed, #endif /* Writeback */ - if (dir == OHCI_TD_DIR_IN && ret >= 0 && ret <= len) { + if (dir == OHCI_TD_DIR_IN && ret >= 0 && ret <= static_cast(len)) { /* IN transfer succeeded */ ohci_copy_iso_td(ohci, start_addr, end_addr, ohci->usb_buf, ret, 1); OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_CC, @@ -1117,7 +1117,7 @@ static uint32_t ohci_get_frame_remaining(OHCIState *ohci) if (tks >= usb_frame_time) return (ohci->frt << 31); - tks = muldiv64(1, tks, usb_bit_time); + tks = muldiv64(1, static_cast(tks), static_cast(usb_bit_time)); fr = (uint16_t)(ohci->fi - tks); return (ohci->frt << 31) | fr; @@ -1216,7 +1216,7 @@ uint32_t ohci_mem_read(void *ptr, target_phys_addr_t addr) if (addr & 3) { fprintf(stderr, "usb-ohci: Mis-aligned read\n"); return 0xffffffff; - } else if (addr >= 0x54 && addr < 0x54 + ohci->num_ports * 4) { + } else if (addr >= 0x54 && addr < 0x54U + ohci->num_ports * 4) { /* HcRhPortStatus */ retval = ohci->rhport[(addr - 0x54) >> 2].ctrl | OHCI_PORT_PPS; } else { @@ -1340,7 +1340,7 @@ void ohci_mem_write(void *ptr, target_phys_addr_t addr, uint32_t val) return; } - if (addr >= 0x54 && addr < 0x54 + ohci->num_ports * 4) { + if (addr >= 0x54 && addr < 0x54U + ohci->num_ports * 4) { /* HcRhPortStatus */ ohci_port_set_status(ohci, (addr - 0x54) >> 2, val); return; @@ -1488,9 +1488,9 @@ OHCIState *ohci_create(uint32_t base, int ports) usb_frame_time = get_ticks_per_sec(); usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ/1000); #else - usb_frame_time = muldiv64(1, get_ticks_per_sec(), 1000); + usb_frame_time = muldiv64(1, static_cast(get_ticks_per_sec()), 1000U); if (get_ticks_per_sec() >= USB_HZ) { - usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ); + usb_bit_time = muldiv64(1U, static_cast(get_ticks_per_sec()), USB_HZ); } else { usb_bit_time = 1; } diff --git a/plugins/USBqemu/qemu-usb/vl.cpp b/plugins/USBqemu/qemu-usb/vl.cpp index 809b36305b..08657eca74 100644 --- a/plugins/USBqemu/qemu-usb/vl.cpp +++ b/plugins/USBqemu/qemu-usb/vl.cpp @@ -25,7 +25,7 @@ uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c) rl = (uint64_t)u.l.low * (uint64_t)b; rh = (uint64_t)u.l.high * (uint64_t)b; rh += (rl >> 32); - res.l.high = rh / c; + res.l.high = static_cast(rh / c); res.l.low = (((rh % c) << 32) + (rl & 0xffffffff)) / c; return res.ll; } From 1bcb5e0cc1fabb245928e20e4b808f10d98174b1 Mon Sep 17 00:00:00 2001 From: Akash Date: Wed, 29 Jun 2016 23:35:23 +0530 Subject: [PATCH 4/5] dev9ghzdrk: Clean up warnings on MSVC pcap_io: cast ``pcap_io_running`` to bool. --- plugins/dev9ghzdrk/pcap_io.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/dev9ghzdrk/pcap_io.cpp b/plugins/dev9ghzdrk/pcap_io.cpp index fc7306c835..00cb031ca1 100644 --- a/plugins/dev9ghzdrk/pcap_io.cpp +++ b/plugins/dev9ghzdrk/pcap_io.cpp @@ -435,7 +435,7 @@ bool PCAPAdapter::blocks() } bool PCAPAdapter::isInitialised() { - return pcap_io_running; + return !!pcap_io_running; } //gets a packet.rv :true success bool PCAPAdapter::recv(NetPacket* pkt) From d69f2b6cc5d682727b190fb909277905d98c1396 Mon Sep 17 00:00:00 2001 From: Akash Date: Thu, 30 Jun 2016 16:35:10 +0530 Subject: [PATCH 5/5] cdvdGigaherz: Clean up warnings on MSVC SectorConverters: convert variables to u8. --- plugins/cdvdGigaherz/src/SectorConverters.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/cdvdGigaherz/src/SectorConverters.h b/plugins/cdvdGigaherz/src/SectorConverters.h index a28406b2a1..eb9a998bb1 100644 --- a/plugins/cdvdGigaherz/src/SectorConverters.h +++ b/plugins/cdvdGigaherz/src/SectorConverters.h @@ -42,11 +42,11 @@ int Convert<2352,2048>(char *dest, const char* psrc, int lsn) template<> int Convert<2048,2352>(char *dest, const char* psrc, int lsn) { - int m = lsn / (75*60); - int s = (lsn/75) % 60; - int f = lsn%75; - unsigned char header[16] = { - 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00, m, s, f,0x02 + u8 m = lsn / (75*60); + u8 s = (lsn/75) % 60; + u8 f = lsn%75; + u8 header[16] = { + 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,m,s,f,0x02 }; memcpy(dest,header,16);