[Pcsclite-cvs-commit] r3043 - /trunk/PCSC/src/winscard_clnt.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Fri Jul 4 09:23:12 UTC 2008
Author: rousseau
Date: Fri Jul 4 09:23:12 2008
New Revision: 3043
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=3043
Log:
SCardGetStatusChange(): move check for break conditions code
Modified:
trunk/PCSC/src/winscard_clnt.c
Modified: trunk/PCSC/src/winscard_clnt.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_clnt.c?rev=3043&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_clnt.c (original)
+++ trunk/PCSC/src/winscard_clnt.c Fri Jul 4 09:23:12 2008
@@ -2164,60 +2164,48 @@
/*
* Counter and resetter
*/
- j = j + 1;
+ j++;
if (j == cReaders)
{
- if (!dwBreakFlag)
+ /* go back to the first reader */
+ j = 0;
+
+ /* Declare all the break conditions */
+
+ /* break if the reader count changed,
+ * so that the calling application can update
+ * the reader list
+ */
+ if (ReaderCountChanged)
+ break;
+
+ /* Break if UNAWARE is set and all readers have been checked */
+ if (dwBreakFlag == 1)
+ break;
+
+ /* Timeout has occurred and all readers checked */
+ if (0 == dwTimeout)
+ break;
+
+ if (BLOCK_STATUS_RESUME
+ == psContextMap[dwContextIndex].contextBlockStatus)
+ break;
+
+ if (dwTimeout != INFINITE && dwTimeout != 0)
{
- /* break if the reader count changed,
- * so that the calling application can update
- * the reader list
+ /*
+ * If time is greater than timeout and all readers have been
+ * checked
*/
- if (ReaderCountChanged)
- break;
+ if (dwTime >= (dwTimeout * 1000))
+ {
+ SYS_MutexUnLock(psContextMap[dwContextIndex].mMutex);
+ PROFILE_END(SCARD_E_TIMEOUT)
+ return SCARD_E_TIMEOUT;
+ }
}
- j = 0;
- }
-
- /*
- * Declare all the break conditions
- */
-
- if (psContextMap[dwContextIndex].contextBlockStatus
- == BLOCK_STATUS_RESUME)
- break;
-
- /*
- * Break if UNAWARE is set and all readers have been checked
- */
- if ((dwBreakFlag == 1) && (j == 0))
- break;
-
- /*
- * Timeout has occurred and all readers checked
- */
- if ((dwTimeout == 0) && (j == 0))
- break;
-
- if (dwTimeout != INFINITE && dwTimeout != 0)
- {
- /*
- * If time is greater than timeout and all readers have been
- * checked
- */
- if ((dwTime >= (dwTimeout * 1000)) && (j == 0))
- {
- SYS_MutexUnLock(psContextMap[dwContextIndex].mMutex);
- PROFILE_END(SCARD_E_TIMEOUT)
- return SCARD_E_TIMEOUT;
- }
- }
-
- /*
- * Only sleep once for each cycle of reader checks.
- */
- if (j == 0)
- {
+
+ /* Only sleep once for each cycle of reader checks. */
SYS_USleep(PCSCLITE_STATUS_WAIT);
dwTime += PCSCLITE_STATUS_WAIT;
}
More information about the Pcsclite-cvs-commit
mailing list