Fixed remaining size_t vs. uInt32 issues in Windows.

This commit is contained in:
Stephen Anthony 2019-09-16 21:36:30 -02:30
parent 218969eb59
commit 0f0c86de41
2 changed files with 37 additions and 34 deletions

View File

@ -22,9 +22,8 @@
#include "ControllerDetector.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Controller::Type ControllerDetector::detectType(const uInt8* image, uInt32 size,
const Controller::Type type, const Controller::Jack port,
const Settings& settings)
Controller::Type ControllerDetector::detectType(const uInt8* image, size_t size,
const Controller::Type type, const Controller::Jack port, const Settings& settings)
{
if(type == Controller::Type::Unknown || settings.getBool("rominfo"))
{
@ -44,7 +43,7 @@ Controller::Type ControllerDetector::detectType(const uInt8* image, uInt32 size,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string ControllerDetector::detectName(const uInt8* image, uInt32 size,
string ControllerDetector::detectName(const uInt8* image, size_t size,
const Controller::Type controller, const Controller::Jack port,
const Settings& settings)
{
@ -52,7 +51,7 @@ string ControllerDetector::detectName(const uInt8* image, uInt32 size,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Controller::Type ControllerDetector::autodetectPort(const uInt8* image, uInt32 size,
Controller::Type ControllerDetector::autodetectPort(const uInt8* image, size_t size,
Controller::Jack port, const Settings& settings)
{
// default type joystick
@ -85,7 +84,7 @@ Controller::Type ControllerDetector::autodetectPort(const uInt8* image, uInt32 s
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool ControllerDetector::searchForBytes(const uInt8* image, uInt32 imagesize,
bool ControllerDetector::searchForBytes(const uInt8* image, size_t imagesize,
const uInt8* signature, uInt32 sigsize)
{
if (imagesize >= sigsize)
@ -109,7 +108,8 @@ bool ControllerDetector::searchForBytes(const uInt8* image, uInt32 imagesize,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool ControllerDetector::usesJoystickButton(const uInt8* image, uInt32 size, Controller::Jack port)
bool ControllerDetector::usesJoystickButton(const uInt8* image, size_t size,
Controller::Jack port)
{
if(port == Controller::Jack::Left)
{
@ -238,7 +238,8 @@ bool ControllerDetector::usesJoystickButton(const uInt8* image, uInt32 size, Con
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool ControllerDetector::usesKeyboard(const uInt8* image, uInt32 size, Controller::Jack port)
bool ControllerDetector::usesKeyboard(const uInt8* image, size_t size,
Controller::Jack port)
{
if(port == Controller::Jack::Left)
{
@ -376,7 +377,8 @@ bool ControllerDetector::usesKeyboard(const uInt8* image, uInt32 size, Controlle
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool ControllerDetector::usesGenesisButton(const uInt8* image, uInt32 size, Controller::Jack port)
bool ControllerDetector::usesGenesisButton(const uInt8* image, size_t size,
Controller::Jack port)
{
if(port == Controller::Jack::Left)
{
@ -432,7 +434,7 @@ bool ControllerDetector::usesGenesisButton(const uInt8* image, uInt32 size, Cont
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool ControllerDetector::usesPaddle(const uInt8* image, uInt32 size,
bool ControllerDetector::usesPaddle(const uInt8* image, size_t size,
Controller::Jack port, const Settings& settings)
{
if(port == Controller::Jack::Left)
@ -540,7 +542,7 @@ bool ControllerDetector::usesPaddle(const uInt8* image, uInt32 size,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool ControllerDetector::isProbablyTrakBall(const uInt8* image, uInt32 size)
bool ControllerDetector::isProbablyTrakBall(const uInt8* image, size_t size)
{
// check for TrakBall tables
const int NUM_SIGS = 3;
@ -559,7 +561,7 @@ bool ControllerDetector::isProbablyTrakBall(const uInt8* image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool ControllerDetector::isProbablyAtariMouse(const uInt8* image, uInt32 size)
bool ControllerDetector::isProbablyAtariMouse(const uInt8* image, size_t size)
{
// check for Atari Mouse tables
const int NUM_SIGS = 3;
@ -578,7 +580,7 @@ bool ControllerDetector::isProbablyAtariMouse(const uInt8* image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool ControllerDetector::isProbablyAmigaMouse(const uInt8* image, uInt32 size)
bool ControllerDetector::isProbablyAmigaMouse(const uInt8* image, size_t size)
{
// check for Amiga Mouse tables
const int NUM_SIGS = 4;
@ -598,7 +600,8 @@ bool ControllerDetector::isProbablyAmigaMouse(const uInt8* image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool ControllerDetector::isProbablySaveKey(const uInt8* image, uInt32 size, Controller::Jack port)
bool ControllerDetector::isProbablySaveKey(const uInt8* image, size_t size,
Controller::Jack port)
{
// check for known SaveKey code, only supports right port
if(port == Controller::Jack::Right)

View File

@ -39,7 +39,7 @@ class ControllerDetector
@param settings A reference to the various settings (read-only)
@return The detected controller type
*/
static Controller::Type detectType(const uInt8* image, uInt32 size,
static Controller::Type detectType(const uInt8* image, size_t size,
const Controller::Type controller, const Controller::Jack port,
const Settings& settings);
@ -55,7 +55,7 @@ class ControllerDetector
@return The (detected) controller name
*/
static string detectName(const uInt8* image, uInt32 size,
static string detectName(const uInt8* image, size_t size,
const Controller::Type type, const Controller::Jack port,
const Settings& settings);
@ -70,8 +70,8 @@ class ControllerDetector
@return The detected controller type
*/
static Controller::Type autodetectPort(const uInt8* image, uInt32 size, Controller::Jack port,
const Settings& settings);
static Controller::Type autodetectPort(const uInt8* image, size_t size,
Controller::Jack port, const Settings& settings);
/**
Search the image for the specified byte signature.
@ -83,33 +83,33 @@ class ControllerDetector
@return True if the signature was found, else false
*/
static bool searchForBytes(const uInt8* image, uInt32 imagesize,
static bool searchForBytes(const uInt8* image, size_t imagesize,
const uInt8* signature, uInt32 sigsize);
// Returns true if the port's joystick button access code is found.
static bool usesJoystickButton(const uInt8* image, uInt32 size, Controller::Jack port);
static bool usesJoystickButton(const uInt8* image, size_t size, Controller::Jack port);
// Returns true if the port's keyboard access code is found.
static bool usesKeyboard(const uInt8* image, uInt32 size, Controller::Jack port);
static bool usesKeyboard(const uInt8* image, size_t size, Controller::Jack port);
// Returns true if the port's 2nd Genesis button access code is found.
static bool usesGenesisButton(const uInt8* image, uInt32 size, Controller::Jack port);
static bool usesGenesisButton(const uInt8* image, size_t size, Controller::Jack port);
// Returns true if the port's paddle button access code is found.
static bool usesPaddle(const uInt8* image, uInt32 size, Controller::Jack port,
static bool usesPaddle(const uInt8* image, size_t size, Controller::Jack port,
const Settings& settings);
// Returns true if a Trak-Ball table is found.
static bool isProbablyTrakBall(const uInt8* image, uInt32 size);
static bool isProbablyTrakBall(const uInt8* image, size_t size);
// Returns true if an Atari Mouse table is found.
static bool isProbablyAtariMouse(const uInt8* image, uInt32 size);
static bool isProbablyAtariMouse(const uInt8* image, size_t size);
// Returns true if an Amiga Mouse table is found.
static bool isProbablyAmigaMouse(const uInt8* image, uInt32 size);
static bool isProbablyAmigaMouse(const uInt8* image, size_t size);
// Returns true if a SaveKey code pattern is found.
static bool isProbablySaveKey(const uInt8* image, uInt32 size, Controller::Jack port);
static bool isProbablySaveKey(const uInt8* image, size_t size, Controller::Jack port);
private:
// Following constructors and assignment operators not supported