From 0f0c86de41274174ae7523e013939543067e4e86 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Mon, 16 Sep 2019 21:36:30 -0230 Subject: [PATCH] Fixed remaining size_t vs. uInt32 issues in Windows. --- src/emucore/ControllerDetector.cxx | 37 ++++++++++++++++-------------- src/emucore/ControllerDetector.hxx | 34 +++++++++++++-------------- 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/src/emucore/ControllerDetector.cxx b/src/emucore/ControllerDetector.cxx index 9f51f64be..48487187e 100644 --- a/src/emucore/ControllerDetector.cxx +++ b/src/emucore/ControllerDetector.cxx @@ -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,16 +43,16 @@ Controller::Type ControllerDetector::detectType(const uInt8* image, uInt32 size, } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -string ControllerDetector::detectName(const uInt8* image, uInt32 size, - const Controller::Type controller, const Controller::Jack port, - const Settings& settings) +string ControllerDetector::detectName(const uInt8* image, size_t size, + const Controller::Type controller, const Controller::Jack port, + const Settings& settings) { return Controller::getName(detectType(image, size, controller, port, settings)); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Controller::Type ControllerDetector::autodetectPort(const uInt8* image, uInt32 size, - Controller::Jack port, const Settings& settings) +Controller::Type ControllerDetector::autodetectPort(const uInt8* image, size_t size, + Controller::Jack port, const Settings& settings) { // default type joystick Controller::Type type = Controller::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) diff --git a/src/emucore/ControllerDetector.hxx b/src/emucore/ControllerDetector.hxx index 0eaea7903..16374569f 100644 --- a/src/emucore/ControllerDetector.hxx +++ b/src/emucore/ControllerDetector.hxx @@ -39,9 +39,9 @@ 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, - const Controller::Type controller, const Controller::Jack port, - const Settings& settings); + static Controller::Type detectType(const uInt8* image, size_t size, + const Controller::Type controller, const Controller::Jack port, + const Settings& settings); /** Detects the controller type at the given port if no controller is provided @@ -55,9 +55,9 @@ class ControllerDetector @return The (detected) controller name */ - static string detectName(const uInt8* image, uInt32 size, - const Controller::Type type, const Controller::Jack port, - const Settings& settings); + static string detectName(const uInt8* image, size_t size, + const Controller::Type type, const Controller::Jack port, + const Settings& settings); private: /** @@ -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