[Pcsclite-cvs-commit] r5300 - in /trunk/PCSC/src: eventhandler.c winscard.c winscard_clnt.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Tue Oct 12 09:24:11 UTC 2010
Author: rousseau
Date: Tue Oct 12 09:24:10 2010
New Revision: 5300
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5300
Log:
Use uint32_t readerState instead of DWORD dwStatus to store the state of
the reader.
DWORD and uint32_t may be different.
Modified:
trunk/PCSC/src/eventhandler.c
trunk/PCSC/src/winscard.c
trunk/PCSC/src/winscard_clnt.c
Modified: trunk/PCSC/src/eventhandler.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/eventhandler.c?rev=5300&op=diff
==============================================================================
--- trunk/PCSC/src/eventhandler.c (original)
+++ trunk/PCSC/src/eventhandler.c Tue Oct 12 09:24:10 2010
@@ -237,6 +237,7 @@
LONG rv;
const char *readerName;
DWORD dwStatus;
+ uint32_t readerState;
int32_t readerSharing;
DWORD dwCurrentState;
DWORD dwAtrLen;
@@ -267,7 +268,7 @@
if (rv == IFD_SUCCESS)
{
- dwStatus = SCARD_PRESENT | SCARD_POWERED | SCARD_NEGOTIABLE;
+ readerState = SCARD_PRESENT | SCARD_POWERED | SCARD_NEGOTIABLE;
if (rContext->readerState->cardAtrLength > 0)
{
@@ -280,7 +281,7 @@
}
else
{
- dwStatus = SCARD_PRESENT | SCARD_SWALLOWED;
+ readerState = SCARD_PRESENT | SCARD_SWALLOWED;
Log3(PCSC_LOG_ERROR, "Error powering up card: %d 0x%04X", rv, rv);
}
@@ -288,7 +289,7 @@
}
else
{
- dwStatus = SCARD_ABSENT;
+ readerState = SCARD_ABSENT;
rContext->readerState->cardAtrLength = 0;
rContext->readerState->cardProtocol = SCARD_PROTOCOL_UNDEFINED;
@@ -298,7 +299,7 @@
/*
* Set all the public attributes to this reader
*/
- rContext->readerState->readerState = dwStatus;
+ rContext->readerState->readerState = readerState;
rContext->readerState->readerSharing = readerSharing = rContext->contexts;
(void)EHSignalEventToClients();
Modified: trunk/PCSC/src/winscard.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard.c?rev=5300&op=diff
==============================================================================
--- trunk/PCSC/src/winscard.c (original)
+++ trunk/PCSC/src/winscard.c Tue Oct 12 09:24:10 2010
@@ -250,7 +250,7 @@
{
LONG rv;
READER_CONTEXT * rContext = NULL;
- DWORD dwStatus;
+ uint32_t readerState;
(void)hContext;
PROFILE_START
@@ -325,17 +325,17 @@
* presence of a card or not
*
*******************************************/
- dwStatus = rContext->readerState->readerState;
+ readerState = rContext->readerState->readerState;
if (dwShareMode != SCARD_SHARE_DIRECT)
{
- if (!(dwStatus & SCARD_PRESENT))
+ if (!(readerState & SCARD_PRESENT))
{
Log1(PCSC_LOG_ERROR, "Card Not Inserted");
return SCARD_E_NO_SMARTCARD;
}
- if (dwStatus & SCARD_SWALLOWED)
+ if (readerState & SCARD_SWALLOWED)
{
Log1(PCSC_LOG_ERROR, "Card Not Powered");
return SCARD_W_UNPOWERED_CARD;
@@ -593,7 +593,7 @@
rContext->readerState->cardProtocol = SCARD_PROTOCOL_UNDEFINED;
/*
- * Set up the status bit masks on dwStatus
+ * Set up the status bit masks on readerState
*/
if (rv == SCARD_S_SUCCESS)
{
@@ -640,13 +640,13 @@
else
if (dwInitialization == SCARD_LEAVE_CARD)
{
- DWORD dwStatus = rContext->readerState->readerState;
-
- if (dwStatus & SCARD_ABSENT)
+ uint32_t readerState = rContext->readerState->readerState;
+
+ if (readerState & SCARD_ABSENT)
return SCARD_E_NO_SMARTCARD;
- if ((dwStatus & SCARD_PRESENT)
- && (dwStatus & SCARD_SWALLOWED))
+ if ((readerState & SCARD_PRESENT)
+ && (readerState & SCARD_SWALLOWED))
return SCARD_W_UNRESPONSIVE_CARD;
}
@@ -877,7 +877,7 @@
rContext->readerState->cardProtocol = SCARD_PROTOCOL_UNDEFINED;
/*
- * Set up the status bit masks on dwStatus
+ * Set up the status bit masks on readerState
*/
if (rv == SCARD_S_SUCCESS)
{
@@ -1088,7 +1088,7 @@
(void)RFSetReaderEventState(rContext, SCARD_RESET);
/*
- * Set up the status bit masks on dwStatus
+ * Set up the status bit masks on readerState
*/
if (rv == SCARD_S_SUCCESS)
{
Modified: trunk/PCSC/src/winscard_clnt.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_clnt.c?rev=5300&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_clnt.c (original)
+++ trunk/PCSC/src/winscard_clnt.c Tue Oct 12 09:24:10 2010
@@ -1871,7 +1871,6 @@
SCARD_READERSTATE *currReader;
READER_STATE *rContext;
long dwTime;
- DWORD dwState;
DWORD dwBreakFlag = 0;
unsigned int j;
SCONTEXTMAP * currentContextMap;
@@ -2007,6 +2006,8 @@
}
else
{
+ uint32_t readerState;
+
/* The reader has come back after being away */
if (currReader->dwCurrentState & SCARD_STATE_UNKNOWN)
{
@@ -2022,7 +2023,7 @@
rContext = &readerStates[i];
/* Now we check all the Reader States */
- dwState = rContext->readerState;
+ readerState = rContext->readerState;
/* only if current state has an non null event counter */
if (currReader->dwCurrentState & 0xFFFF0000)
@@ -2045,7 +2046,7 @@
| (rContext->eventCounter << 16));
/*********** Check if the reader is in the correct state ********/
- if (dwState & SCARD_UNKNOWN)
+ if (readerState & SCARD_UNKNOWN)
{
/* reader is in bad state */
currReader->dwEventState = SCARD_STATE_UNAVAILABLE;
@@ -2071,7 +2072,7 @@
/********** Check for card presence in the reader **************/
- if (dwState & SCARD_PRESENT)
+ if (readerState & SCARD_PRESENT)
{
/* card present but not yet powered up */
if (0 == rContext->cardAtrLength)
@@ -2086,7 +2087,7 @@
currReader->cbAtr = 0;
/* Card is now absent */
- if (dwState & SCARD_ABSENT)
+ if (readerState & SCARD_ABSENT)
{
currReader->dwEventState |= SCARD_STATE_EMPTY;
currReader->dwEventState &= ~SCARD_STATE_PRESENT;
@@ -2107,7 +2108,7 @@
}
}
/* Card is now present */
- else if (dwState & SCARD_PRESENT)
+ else if (readerState & SCARD_PRESENT)
{
currReader->dwEventState |= SCARD_STATE_PRESENT;
currReader->dwEventState &= ~SCARD_STATE_EMPTY;
@@ -2124,7 +2125,7 @@
dwBreakFlag = 1;
}
- if (dwState & SCARD_SWALLOWED)
+ if (readerState & SCARD_SWALLOWED)
{
currReader->dwEventState |= SCARD_STATE_MUTE;
if (!(currReader->dwCurrentState & SCARD_STATE_MUTE))
@@ -2161,7 +2162,7 @@
else if (rContext->readerSharing >= SCARD_LAST_CONTEXT)
{
/* A card must be inserted for it to be INUSE */
- if (dwState & SCARD_PRESENT)
+ if (readerState & SCARD_PRESENT)
{
currReader->dwEventState |= SCARD_STATE_INUSE;
currReader->dwEventState &= ~SCARD_STATE_EXCLUSIVE;
More information about the Pcsclite-cvs-commit
mailing list