From 0ca36e89439fa25403e3805ac931e131d666b632 Mon Sep 17 00:00:00 2001 From: Jonathan Li Date: Tue, 20 Sep 2016 00:40:45 +0100 Subject: [PATCH] cdvdgigaherz: Fix value truncation warnings Fixes warning C4244: conversion to smaller data type, possible loss of data. --- plugins/cdvdGigaherz/src/CDVD.cpp | 7 +++---- plugins/cdvdGigaherz/src/CDVD.h | 10 +++++----- plugins/cdvdGigaherz/src/Windows/IOCtlSrc.cpp | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/plugins/cdvdGigaherz/src/CDVD.cpp b/plugins/cdvdGigaherz/src/CDVD.cpp index 997318a46d..73d347f8fc 100644 --- a/plugins/cdvdGigaherz/src/CDVD.cpp +++ b/plugins/cdvdGigaherz/src/CDVD.cpp @@ -30,8 +30,8 @@ DWORD pidThreadKeepAlive = 0; /////////////////////////////////////////////////////////////////////////////// // State Information // -int strack; -int etrack; +u8 strack; +u8 etrack; track tracks[100]; int curDiskType; @@ -357,7 +357,6 @@ int CALLBACK CDVDgetBuffer2(u8 *dest) s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ *subq) { - int i; // the formatted subq command returns: control/adr, track, index, trk min, trk sec, trk frm, 0x00, abs min, abs sec, abs frm if (lsn > tracks[0].length) // track 0 is total disc. @@ -367,7 +366,7 @@ s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ *subq) lsn_to_msf(&subq->discM, &subq->discS, &subq->discF, lsn + 150); - i = strack; + u8 i = strack; while (i <= etrack) { if (lsn <= tracks[i].length) break; diff --git a/plugins/cdvdGigaherz/src/CDVD.h b/plugins/cdvdGigaherz/src/CDVD.h index 8829d67e4c..df2575076b 100644 --- a/plugins/cdvdGigaherz/src/CDVD.h +++ b/plugins/cdvdGigaherz/src/CDVD.h @@ -23,15 +23,15 @@ #define CDVDdefs #include -typedef struct _track +struct track { u32 start_lba; u32 length; - u32 type; -} track; + u8 type; +}; -extern int strack; -extern int etrack; +extern u8 strack; +extern u8 etrack; extern track tracks[100]; extern int curDiskType; diff --git a/plugins/cdvdGigaherz/src/Windows/IOCtlSrc.cpp b/plugins/cdvdGigaherz/src/Windows/IOCtlSrc.cpp index 40f4143d93..acf00c4a80 100644 --- a/plugins/cdvdGigaherz/src/Windows/IOCtlSrc.cpp +++ b/plugins/cdvdGigaherz/src/Windows/IOCtlSrc.cpp @@ -209,7 +209,7 @@ void IOCtlSrc::SetSpindleSpeed(bool restore_defaults) { DWORD dontcare; - int speed = 0; + USHORT speed = 0; if (GetMediaType() < 0) speed = 4800; // CD-ROM to ~32x (PS2 has 24x (3600 KB/s))