From 60a8526c94e65130abc27540f22347fa5650cb46 Mon Sep 17 00:00:00 2001 From: cyb3r4nt <104218001+cyb3r4nt@users.noreply.github.com> Date: Tue, 13 Dec 2022 13:48:30 +0200 Subject: [PATCH] Add exception for Apple macOS result code type Apple version of pcsc-lite library is slightly different from official one, and defines result code constants in pcsclite.h as unsigned 32bit integers. Official pcsc-lite version uses LONG type and it is traslated to signed long on most platforms. This implementation difference is solved using pre-processor instructions. ----------------------------------------------------------------- Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file. I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. Signed-off-by: cyb3r4nt <104218001+cyb3r4nt@users.noreply.github.com> --- src/SCardCall.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/SCardCall.hpp b/src/SCardCall.hpp index c93554c..5b248d7 100644 --- a/src/SCardCall.hpp +++ b/src/SCardCall.hpp @@ -47,7 +47,14 @@ void SCardCall(const char* callerFunctionName, const char* file, int line, const char* scardFunctionName, Func scardFunction, Args... args) { // TODO: Add logging - or is exception error message enough? + +#ifdef __APPLE__ + // Apple version of pcsc-lite uses unsigned code constants const uint32_t result = scardFunction(args...); +#else + // Standard version of pcsc-lite uses signed code constants + const LONG result = scardFunction(args...); +#endif // TODO: Add more cases when needed. switch (result) {