[Pcsclite-cvs-commit] r4737 - in /trunk/PCSC/src: ifdwrapper.c readerfactory.c readerfactory.h

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Feb 9 14:37:50 UTC 2010


Author: rousseau
Date: Tue Feb  9 14:37:48 2010
New Revision: 4737

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4737
Log:
In struct ReaderContext change dwPort from DWORD to int and rename it to
port

Fix a compiler warning
readerfactory.c: In function ‘RFReCheckReaderConf’:
readerfactory.c:1393: warning: comparison between signed and unsigned

Modified:
    trunk/PCSC/src/ifdwrapper.c
    trunk/PCSC/src/readerfactory.c
    trunk/PCSC/src/readerfactory.h

Modified: trunk/PCSC/src/ifdwrapper.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/ifdwrapper.c?rev=4737&op=diff
==============================================================================
--- trunk/PCSC/src/ifdwrapper.c (original)
+++ trunk/PCSC/src/ifdwrapper.c Tue Feb  9 14:37:48 2010
@@ -138,30 +138,30 @@
 #ifndef PCSCLITE_STATIC_DRIVER
 	if (rContext->dwVersion == IFD_HVERSION_1_0)
 	{
-		rv = (*IO_create_channel) (rContext->dwPort);
+		rv = (*IO_create_channel) (rContext->port);
 	} else if (rContext->dwVersion == IFD_HVERSION_2_0)
 	{
-		rv = (*IFDH_create_channel) (rContext->dwSlot, rContext->dwPort);
+		rv = (*IFDH_create_channel) (rContext->dwSlot, rContext->port);
 	} else
 	{
 		/* use device name only if defined */
 		if (rContext->lpcDevice[0] != '\0')
 			rv = (*IFDH_create_channel_by_name) (rContext->dwSlot, rContext->lpcDevice);
 		else
-			rv = (*IFDH_create_channel) (rContext->dwSlot, rContext->dwPort);
-	}
-#else
-#ifdef IFDHANDLERv1
-	rv = IO_Create_Channel(rContext->dwPort);
+			rv = (*IFDH_create_channel) (rContext->dwSlot, rContext->port);
+	}
+#else
+#ifdef IFDHANDLERv1
+	rv = IO_Create_Channel(rContext->port);
 #elif IFDHANDLERv2
-	rv = IFDHCreateChannel(rContext->dwSlot, rContext->dwPort);
+	rv = IFDHCreateChannel(rContext->dwSlot, rContext->port);
 #else
 	{
 		/* Use device name only if defined */
 		if (rContext->lpcDevice[0] != '\0')
 			rv = IFDHCreateChannelByName(rContext->dwSlot, rContext->lpcDevice);
 		else
-			rv = IFDHCreateChannel(rContext->dwSlot, rContext->dwPort);
+			rv = IFDHCreateChannel(rContext->dwSlot, rContext->port);
 	}
 #endif
 #endif

Modified: trunk/PCSC/src/readerfactory.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/readerfactory.c?rev=4737&op=diff
==============================================================================
--- trunk/PCSC/src/readerfactory.c (original)
+++ trunk/PCSC/src/readerfactory.c Tue Feb  9 14:37:48 2010
@@ -92,7 +92,7 @@
 	return EHInitializeEventStructures();
 }
 
-LONG RFAddReader(LPSTR lpcReader, DWORD dwPort, LPSTR lpcLibrary, LPSTR lpcDevice)
+LONG RFAddReader(LPSTR lpcReader, int port, LPSTR lpcLibrary, LPSTR lpcDevice)
 {
 	DWORD dwContext = 0, dwGetSize;
 	UCHAR ucGetData[1], ucThread[1];
@@ -136,7 +136,7 @@
 				lpcStripReader[tmplen - 6] = 0;
 
 				if ((strcmp(lpcReader, lpcStripReader) == 0) &&
-					(dwPort == (sReadersContexts[i])->dwPort))
+					(port == (sReadersContexts[i])->port))
 				{
 					Log1(PCSC_LOG_ERROR, "Duplicate reader found.");
 					return SCARD_E_DUPLICATE_READER;
@@ -163,7 +163,7 @@
 
 	/* Check and set the readername to see if it must be enumerated */
 	parentNode = RFSetReaderName(sReadersContexts[dwContext], lpcReader,
-		lpcLibrary, dwPort, 0);
+		lpcLibrary, port, 0);
 	if (parentNode < -1)
 		return SCARD_E_NO_MEMORY;
 
@@ -171,7 +171,7 @@
 	(void)strlcpy((sReadersContexts[dwContext])->lpcDevice, lpcDevice,
 		sizeof((sReadersContexts[dwContext])->lpcDevice));
 	(sReadersContexts[dwContext])->dwVersion = 0;
-	(sReadersContexts[dwContext])->dwPort = dwPort;
+	(sReadersContexts[dwContext])->port = port;
 	(sReadersContexts[dwContext])->mMutex = NULL;
 	(sReadersContexts[dwContext])->dwBlockStatus = 0;
 	(sReadersContexts[dwContext])->contexts = 0;
@@ -260,7 +260,7 @@
 	{
 		/* Cannot connect to reader. Exit gracefully */
 		Log2(PCSC_LOG_ERROR, "%s init failed.", lpcReader);
-		(void)RFRemoveReader(lpcReader, dwPort);
+		(void)RFRemoveReader(lpcReader, port);
 		return rv;
 	}
 
@@ -284,7 +284,7 @@
 		if (rv != SCARD_S_SUCCESS)
 		{
 			Log2(PCSC_LOG_ERROR, "%s init failed.", lpcReader);
-			(void)RFRemoveReader(lpcReader, dwPort);
+			(void)RFRemoveReader(lpcReader, port);
 			return rv;
 		}
 	}
@@ -328,7 +328,7 @@
 		if (i == PCSCLITE_MAX_READERS_CONTEXTS)
 		{
 			/* No more slot left return */
-			rv = RFRemoveReader(lpcReader, dwPort);
+			rv = RFRemoveReader(lpcReader, port);
 			return SCARD_E_NO_MEMORY;
 		}
 
@@ -344,8 +344,8 @@
 			sizeof((sReadersContexts[dwContextB])->lpcDevice));
 		(sReadersContexts[dwContextB])->dwVersion =
 		  (sReadersContexts[dwContext])->dwVersion;
-		(sReadersContexts[dwContextB])->dwPort =
-		  (sReadersContexts[dwContext])->dwPort;
+		(sReadersContexts[dwContextB])->port =
+		  (sReadersContexts[dwContext])->port;
 		(sReadersContexts[dwContextB])->vHandle =
 		  (sReadersContexts[dwContext])->vHandle;
 		(sReadersContexts[dwContextB])->mMutex =
@@ -412,7 +412,7 @@
 		if (rv != SCARD_S_SUCCESS)
 		{
 			/* Cannot connect to slot. Exit gracefully */
-			(void)RFRemoveReader(lpcReader, dwPort);
+			(void)RFRemoveReader(lpcReader, port);
 			return rv;
 		}
 
@@ -433,7 +433,7 @@
 		if (rv != SCARD_S_SUCCESS)
 		{
 			Log2(PCSC_LOG_ERROR, "%s init failed.", lpcReader);
-			(void)RFRemoveReader(lpcReader, dwPort);
+			(void)RFRemoveReader(lpcReader, port);
 			return rv;
 		}
 	}
@@ -441,7 +441,7 @@
 	return SCARD_S_SUCCESS;
 }
 
-LONG RFRemoveReader(LPSTR lpcReader, DWORD dwPort)
+LONG RFRemoveReader(LPSTR lpcReader, int port)
 {
 	LONG rv;
 	READER_CONTEXT * sContext;
@@ -450,7 +450,7 @@
 		return SCARD_E_INVALID_VALUE;
 
 	while (SCARD_S_SUCCESS ==
-		RFReaderInfoNamePort(dwPort, lpcReader, &sContext))
+		RFReaderInfoNamePort(port, lpcReader, &sContext))
 	{
 
 		/* Try to destroy the thread */
@@ -496,7 +496,7 @@
 
 		sContext->lpcDevice[0] = 0;
 		sContext->dwVersion = 0;
-		sContext->dwPort = 0;
+		sContext->port = 0;
 		sContext->mMutex = NULL;
 		sContext->dwBlockStatus = 0;
 		sContext->contexts = 0;
@@ -531,7 +531,7 @@
 }
 
 LONG RFSetReaderName(READER_CONTEXT * rContext, LPSTR readerName,
-	LPSTR libraryName, DWORD dwPort, DWORD dwSlot)
+	LPSTR libraryName, int port, DWORD dwSlot)
 {
 	LONG parent = -1;	/* reader number of the parent of the clone */
 	DWORD valueLength;
@@ -572,9 +572,9 @@
 						supportedChannels = 1;
 
 					/* Check to see if it is a hotplug reader and different */
-					if (((((sReadersContexts[i])->dwPort & 0xFFFF0000) ==
+					if (((((sReadersContexts[i])->port & 0xFFFF0000) ==
 							PCSCLITE_HP_BASE_PORT)
-						&& ((sReadersContexts[i])->dwPort != dwPort))
+						&& ((sReadersContexts[i])->port != port))
 						|| (supportedChannels > 1))
 					{
 						char *lpcReader = sReadersContexts[i]->lpcReader;
@@ -660,7 +660,7 @@
 	return SCARD_E_UNKNOWN_READER;
 }
 
-LONG RFReaderInfoNamePort(DWORD dwPort, LPSTR lpcReader,
+LONG RFReaderInfoNamePort(int port, LPSTR lpcReader,
 	READER_CONTEXT * * sReader)
 {
 	char lpcStripReader[MAX_READERNAME];
@@ -678,7 +678,7 @@
 			lpcStripReader[tmplen - 6] = 0;
 
 			if ((strcmp(lpcReader, lpcStripReader) == 0) &&
-				(dwPort == (sReadersContexts[i])->dwPort))
+				(port == (sReadersContexts[i])->port))
 			{
 				*sReader = sReadersContexts[i];
 				return SCARD_S_SUCCESS;
@@ -1015,7 +1015,7 @@
 	if (rv != IFD_SUCCESS)
 	{
 		Log3(PCSC_LOG_CRITICAL, "Open Port %X Failed (%s)",
-			rContext->dwPort, rContext->lpcDevice);
+			rContext->port, rContext->lpcDevice);
 		(void)RFUnBindFunctions(rContext);
 		(void)RFUnloadReader(rContext);
 		if (IFD_NO_SUCH_DEVICE == rv)
@@ -1285,7 +1285,7 @@
 			/* strip the 6 last char ' 00 00' */
 			lpcStripReader[strlen(lpcStripReader) - 6] = '\0';
 
-			rv = RFRemoveReader(lpcStripReader, sReadersContexts[i]->dwPort);
+			rv = RFRemoveReader(lpcStripReader, sReadersContexts[i]->port);
 
 			if (rv != SCARD_S_SUCCESS)
 				Log2(PCSC_LOG_ERROR, "RFRemoveReader error: 0x%08X", rv);
@@ -1390,7 +1390,7 @@
 				lpcStripReader[tmplen - 6] = 0;
 
 				if ((strcmp(reader_list[i].pcFriendlyname, lpcStripReader) == 0)
-					&& (reader_list[r].channelId == sReadersContexts[i]->dwPort))
+					&& (reader_list[r].channelId == sReadersContexts[i]->port))
 				{
 					DWORD dwStatus = 0, dwAtrLen = 0;
 					UCHAR ucAtr[MAX_ATR_SIZE];
@@ -1460,7 +1460,7 @@
 			for (j=0; j < i; j++)
 			{
 				if (((sReadersContexts[j])->vHandle == (sReadersContexts[i])->vHandle)&&
-					((sReadersContexts[j])->dwPort == (sReadersContexts[i])->dwPort))
+					((sReadersContexts[j])->port == (sReadersContexts[i])->port))
 				{
 					initFlag = 1;
 				}
@@ -1474,7 +1474,7 @@
 			if (rv != IFD_SUCCESS)
 			{
 				Log3(PCSC_LOG_ERROR, "Open Port %X Failed (%s)",
-					(sReadersContexts[i])->dwPort, (sReadersContexts[i])->lpcDevice);
+					(sReadersContexts[i])->port, (sReadersContexts[i])->lpcDevice);
 			}
 
 			(void)EHSpawnEventHandler(sReadersContexts[i], NULL);

Modified: trunk/PCSC/src/readerfactory.h
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/readerfactory.h?rev=4737&op=diff
==============================================================================
--- trunk/PCSC/src/readerfactory.h (original)
+++ trunk/PCSC/src/readerfactory.h Tue Feb  9 14:37:48 2010
@@ -122,7 +122,7 @@
 
 		LPVOID vHandle;			/**< Dlopen handle */
 		DWORD dwVersion;		/**< IFD Handler version number */
-		DWORD dwPort;			/**< Port ID */
+		int port;				/**< Port ID */
 		DWORD dwSlot;			/**< Current Reader Slot */
 		DWORD dwBlockStatus;	/**< Current blocking status */
 		SCARDHANDLE hLockId;	/**< Lock Id */
@@ -140,11 +140,11 @@
 	typedef struct ReaderContext READER_CONTEXT;
 
 	LONG RFAllocateReaderSpace(unsigned int);
-	LONG RFAddReader(LPSTR, DWORD, LPSTR, LPSTR);
-	LONG RFRemoveReader(LPSTR, DWORD);
-	LONG RFSetReaderName(READER_CONTEXT *, LPSTR, LPSTR, DWORD, DWORD);
+	LONG RFAddReader(LPSTR, int, LPSTR, LPSTR);
+	LONG RFRemoveReader(LPSTR, int);
+	LONG RFSetReaderName(READER_CONTEXT *, LPSTR, LPSTR, int, DWORD);
 	LONG RFReaderInfo(LPSTR, /*@out@*/ struct ReaderContext **);
-	LONG RFReaderInfoNamePort(DWORD, LPSTR, /*@out@*/ struct ReaderContext **);
+	LONG RFReaderInfoNamePort(int, LPSTR, /*@out@*/ struct ReaderContext **);
 	LONG RFReaderInfoById(DWORD, /*@out@*/ struct ReaderContext **);
 	LONG RFCheckSharing(SCARDHANDLE);
 	LONG RFLockSharing(SCARDHANDLE);




More information about the Pcsclite-cvs-commit mailing list