Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Commit

Permalink
Add exception for Apple macOS result code type
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
cyb3r4nt authored and mrts committed Dec 14, 2022
1 parent e7d702b commit 60a8526
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/SCardCall.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 60a8526

Please sign in to comment.