[Pcsclite-cvs-commit] r4731 - in /trunk/PCSC/src: eventhandler.c readerfactory.c readerfactory.h winscard.c winscard_svc.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Feb 9 13:38:05 UTC 2010


Author: rousseau
Date: Tue Feb  9 13:38:04 2010
New Revision: 4731

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4731
Log:
In struct ReaderContext dwLockId is used to store a SCARDHANDLE so
change its type from DWORD to SCARDHANDLE and rename the field to hLockId

Fix 2 compiler warning:
winscard.c: In function 'SCardDisconnect':
winscard.c:847: warning: comparison between signed and unsigned
winscard_svc.c: In function 'MSGRemoveContext':
winscard_svc.c:807: warning: comparison between signed and unsigned

Modified:
    trunk/PCSC/src/eventhandler.c
    trunk/PCSC/src/readerfactory.c
    trunk/PCSC/src/readerfactory.h
    trunk/PCSC/src/winscard.c
    trunk/PCSC/src/winscard_svc.c

Modified: trunk/PCSC/src/eventhandler.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/eventhandler.c?rev=4731&op=diff
==============================================================================
--- trunk/PCSC/src/eventhandler.c (original)
+++ trunk/PCSC/src/eventhandler.c Tue Feb  9 13:38:04 2010
@@ -165,7 +165,7 @@
 	/*
 	 * Set the thread to 0 to exit thread
 	 */
-	rContext->dwLockId = 0xFFFF;
+	rContext->hLockId = 0xFFFF;
 
 	Log1(PCSC_LOG_INFO, "Stomping thread.");
 
@@ -509,14 +509,14 @@
 		else
 			(void)SYS_USleep(PCSCLITE_STATUS_POLL_RATE);
 
-		if (rContext->dwLockId == 0xFFFF)
+		if (rContext->hLockId == 0xFFFF)
 		{
 			/*
 			 * Exit and notify the caller
 			 */
 			(void)EHSignalEventToClients();
 			Log1(PCSC_LOG_INFO, "Die");
-			rContext->dwLockId = 0;
+			rContext->hLockId = 0;
 			(void)SYS_ThreadExit(NULL);
 		}
 	}

Modified: trunk/PCSC/src/readerfactory.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/readerfactory.c?rev=4731&op=diff
==============================================================================
--- trunk/PCSC/src/readerfactory.c (original)
+++ trunk/PCSC/src/readerfactory.c Tue Feb  9 13:38:04 2010
@@ -176,7 +176,7 @@
 	(sReadersContexts[dwContext])->dwBlockStatus = 0;
 	(sReadersContexts[dwContext])->contexts = 0;
 	(sReadersContexts[dwContext])->pthThread = 0;
-	(sReadersContexts[dwContext])->dwLockId = 0;
+	(sReadersContexts[dwContext])->hLockId = 0;
 	(sReadersContexts[dwContext])->LockCount = 0;
 	(sReadersContexts[dwContext])->vHandle = NULL;
 	(sReadersContexts[dwContext])->pdwFeeds = NULL;
@@ -367,7 +367,7 @@
 
 		(sReadersContexts[dwContextB])->dwBlockStatus = 0;
 		(sReadersContexts[dwContextB])->contexts = 0;
-		(sReadersContexts[dwContextB])->dwLockId = 0;
+		(sReadersContexts[dwContextB])->hLockId = 0;
 		(sReadersContexts[dwContextB])->LockCount = 0;
 		(sReadersContexts[dwContextB])->readerState = NULL;
 		(sReadersContexts[dwContextB])->dwIdentity =
@@ -501,7 +501,7 @@
 		sContext->dwBlockStatus = 0;
 		sContext->contexts = 0;
 		sContext->dwSlot = 0;
-		sContext->dwLockId = 0;
+		sContext->hLockId = 0;
 		sContext->LockCount = 0;
 		sContext->vHandle = NULL;
 		sContext->dwIdentity = 0;
@@ -899,7 +899,7 @@
 	return SCARD_S_SUCCESS;
 }
 
-LONG RFCheckSharing(DWORD hCard)
+LONG RFCheckSharing(SCARDHANDLE hCard)
 {
 	LONG rv;
 	READER_CONTEXT * rContext = NULL;
@@ -909,13 +909,13 @@
 	if (rv != SCARD_S_SUCCESS)
 		return rv;
 
-	if (rContext->dwLockId == 0 || rContext->dwLockId == hCard)
+	if (rContext->hLockId == 0 || rContext->hLockId == hCard)
 		return SCARD_S_SUCCESS;
 	else
 		return SCARD_E_SHARING_VIOLATION;
 }
 
-LONG RFLockSharing(DWORD hCard)
+LONG RFLockSharing(SCARDHANDLE hCard)
 {
 	READER_CONTEXT * rContext = NULL;
 	LONG rv;
@@ -927,14 +927,14 @@
 	if (SCARD_S_SUCCESS == rv)
 	{
 		rContext->LockCount += 1;
-		rContext->dwLockId = hCard;
+		rContext->hLockId = hCard;
 	}
 	(void)SYS_MutexUnLock(&LockMutex);
 
 	return rv;
 }
 
-LONG RFUnlockSharing(DWORD hCard)
+LONG RFUnlockSharing(SCARDHANDLE hCard)
 {
 	READER_CONTEXT * rContext = NULL;
 	LONG rv;
@@ -950,14 +950,14 @@
 		if (rContext->LockCount > 0)
 			rContext->LockCount -= 1;
 		if (0 == rContext->LockCount)
-			rContext->dwLockId = 0;
+			rContext->hLockId = 0;
 	}
 	(void)SYS_MutexUnLock(&LockMutex);
 
 	return rv;
 }
 
-LONG RFUnlockAllSharing(DWORD hCard)
+LONG RFUnlockAllSharing(SCARDHANDLE hCard)
 {
 	READER_CONTEXT * rContext = NULL;
 	LONG rv;
@@ -971,7 +971,7 @@
 	if (SCARD_S_SUCCESS == rv)
 	{
 		rContext->LockCount = 0;
-		rContext->dwLockId = 0;
+		rContext->hLockId = 0;
 	}
 	(void)SYS_MutexUnLock(&LockMutex);
 
@@ -1198,7 +1198,7 @@
 	if (SCARD_REMOVED == dwEvent)
 	{
 		/* unlock the card */
-		rContext->dwLockId = 0;
+		rContext->hLockId = 0;
 		rContext->LockCount = 0;
 	}
 

Modified: trunk/PCSC/src/readerfactory.h
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/readerfactory.h?rev=4731&op=diff
==============================================================================
--- trunk/PCSC/src/readerfactory.h (original)
+++ trunk/PCSC/src/readerfactory.h Tue Feb  9 13:38:04 2010
@@ -125,7 +125,7 @@
 		DWORD dwPort;			/**< Port ID */
 		DWORD dwSlot;			/**< Current Reader Slot */
 		DWORD dwBlockStatus;	/**< Current blocking status */
-		DWORD dwLockId;			/**< Lock Id */
+		SCARDHANDLE hLockId;	/**< Lock Id */
 		DWORD dwIdentity;		/**< Shared ID High Nibble */
 		int LockCount;			/**< number of recursive locks */
 		int32_t contexts;		/**< Number of open contexts */
@@ -146,10 +146,10 @@
 	LONG RFReaderInfo(LPSTR, /*@out@*/ struct ReaderContext **);
 	LONG RFReaderInfoNamePort(DWORD, LPSTR, /*@out@*/ struct ReaderContext **);
 	LONG RFReaderInfoById(DWORD, /*@out@*/ struct ReaderContext **);
-	LONG RFCheckSharing(DWORD);
-	LONG RFLockSharing(DWORD);
-	LONG RFUnlockSharing(DWORD);
-	LONG RFUnlockAllSharing(DWORD);
+	LONG RFCheckSharing(SCARDHANDLE);
+	LONG RFLockSharing(SCARDHANDLE);
+	LONG RFUnlockSharing(SCARDHANDLE);
+	LONG RFUnlockAllSharing(SCARDHANDLE);
 	LONG RFLoadReader(READER_CONTEXT *);
 	LONG RFBindFunctions(READER_CONTEXT *);
 	LONG RFUnBindFunctions(READER_CONTEXT *);

Modified: trunk/PCSC/src/winscard.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard.c?rev=4731&op=diff
==============================================================================
--- trunk/PCSC/src/winscard.c (original)
+++ trunk/PCSC/src/winscard.c Tue Feb  9 13:38:04 2010
@@ -310,10 +310,10 @@
 	/*
 	 * wait until a possible transaction is finished
 	 */
-	if (rContext->dwLockId != 0)
+	if (rContext->hLockId != 0)
 	{
 		Log1(PCSC_LOG_INFO, "Waiting for release of lock");
-		while (rContext->dwLockId != 0)
+		while (rContext->hLockId != 0)
 			(void)SYS_USleep(PCSCLITE_LOCK_POLL_RATE);
 		Log1(PCSC_LOG_INFO, "Lock released");
 	}
@@ -843,11 +843,11 @@
 	/*
 	 * wait until a possible transaction is finished
 	 */
-	if ((dwDisposition != SCARD_LEAVE_CARD) && (rContext->dwLockId != 0)
-		&& (rContext->dwLockId != hCard))
+	if ((dwDisposition != SCARD_LEAVE_CARD) && (rContext->hLockId != 0)
+		&& (rContext->hLockId != hCard))
 	{
 		Log1(PCSC_LOG_INFO, "Waiting for release of lock");
-		while (rContext->dwLockId != 0)
+		while (rContext->hLockId != 0)
 			(void)SYS_USleep(PCSCLITE_LOCK_POLL_RATE);
 		Log1(PCSC_LOG_INFO, "Lock released");
 	}

Modified: trunk/PCSC/src/winscard_svc.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_svc.c?rev=4731&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_svc.c (original)
+++ trunk/PCSC/src/winscard_svc.c Tue Feb  9 13:38:04 2010
@@ -779,8 +779,7 @@
 	while (list_size(&(threadContext->cardsList)) != 0)
 	{
 		READER_CONTEXT * rContext = NULL;
-		DWORD dwLockId;
-		SCARDHANDLE hCard;
+		SCARDHANDLE hCard, hLockId;
 		void *ptr;
 
 		/*
@@ -801,10 +800,10 @@
 		if (rv != SCARD_S_SUCCESS)
 			return rv;
 
-		dwLockId = rContext->dwLockId;
-		rContext->dwLockId = 0;
-
-		if (hCard != dwLockId)
+		hLockId = rContext->hLockId;
+		rContext->hLockId = 0;
+
+		if (hCard != hLockId)
 		{
 			/*
 			 * if the card is locked by someone else we do not reset it




More information about the Pcsclite-cvs-commit mailing list