[Pcsclite-cvs-commit] r5216 - in /trunk/PCSC/src: eventhandler.c readerfactory.c readerfactory.h winscard_clnt.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Thu Sep 2 09:53:47 UTC 2010


Author: rousseau
Date: Thu Sep  2 09:53:40 2010
New Revision: 5216

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5216
Log:
Rename lpcReaderName in readerName and use (char *) instead of LPSTR

Modified:
    trunk/PCSC/src/eventhandler.c
    trunk/PCSC/src/readerfactory.c
    trunk/PCSC/src/readerfactory.h
    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=5216&op=diff
==============================================================================
--- trunk/PCSC/src/eventhandler.c (original)
+++ trunk/PCSC/src/eventhandler.c Thu Sep  2 09:53:40 2010
@@ -245,7 +245,7 @@
 static void EHStatusHandlerThread(READER_CONTEXT * rContext)
 {
 	LONG rv;
-	LPCSTR lpcReader;
+	const char *readerName;
 	DWORD dwStatus;
 	int32_t readerSharing;
 	DWORD dwCurrentState;
@@ -258,7 +258,7 @@
 	readerSharing = 0;
 	dwCurrentState = 0;
 
-	lpcReader = rContext->readerState->readerName;
+	readerName = rContext->readerState->readerName;
 
 	dwAtrLen = rContext->readerState->cardAtrLength;
 	rv = IFDStatusICC(rContext, &dwStatus, rContext->readerState->cardAtr,
@@ -342,7 +342,7 @@
 
 		if (rv != SCARD_S_SUCCESS)
 		{
-			Log2(PCSC_LOG_ERROR, "Error communicating to: %s", lpcReader);
+			Log2(PCSC_LOG_ERROR, "Error communicating to: %s", readerName);
 
 			/*
 			 * Set error status on this reader while errors occur
@@ -370,7 +370,7 @@
 				/*
 				 * Change the status structure
 				 */
-				Log2(PCSC_LOG_INFO, "Card Removed From %s", lpcReader);
+				Log2(PCSC_LOG_INFO, "Card Removed From %s", readerName);
 				/*
 				 * Notify the card has been removed
 				 */
@@ -435,7 +435,7 @@
 
 				incrementEventCounter(rContext->readerState);
 
-				Log2(PCSC_LOG_INFO, "Card inserted into %s", lpcReader);
+				Log2(PCSC_LOG_INFO, "Card inserted into %s", readerName);
 
 				(void)EHSignalEventToClients();
 

Modified: trunk/PCSC/src/readerfactory.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/readerfactory.c?rev=5216&op=diff
==============================================================================
--- trunk/PCSC/src/readerfactory.c (original)
+++ trunk/PCSC/src/readerfactory.c Thu Sep  2 09:53:40 2010
@@ -104,7 +104,7 @@
 	return EHInitializeEventStructures();
 }
 
-LONG RFAddReader(LPSTR lpcReader, int port, LPSTR lpcLibrary, LPSTR lpcDevice)
+LONG RFAddReader(const char *readerName, int port, LPSTR lpcLibrary, LPSTR lpcDevice)
 {
 	DWORD dwContext = 0, dwGetSize;
 	UCHAR ucGetData[1], ucThread[1];
@@ -112,14 +112,14 @@
 	int i, j;
 	int lrv = 0;
 
-	if ((lpcReader == NULL) || (lpcLibrary == NULL) || (lpcDevice == NULL))
+	if ((readerName == NULL) || (lpcLibrary == NULL) || (lpcDevice == NULL))
 		return SCARD_E_INVALID_VALUE;
 
 	/* Reader name too long? also count " 00 00"*/
-	if (strlen(lpcReader) > MAX_READERNAME - sizeof(" 00 00"))
+	if (strlen(readerName) > MAX_READERNAME - sizeof(" 00 00"))
 	{
 		Log3(PCSC_LOG_ERROR, "Reader name too long: %d chars instead of max %d",
-			strlen(lpcReader), MAX_READERNAME - sizeof(" 00 00"));
+			strlen(readerName), MAX_READERNAME - sizeof(" 00 00"));
 		return SCARD_E_INVALID_VALUE;
 	}
 
@@ -140,7 +140,7 @@
 				tmplen = strlen(lpcStripReader);
 				lpcStripReader[tmplen - 6] = 0;
 
-				if ((strcmp(lpcReader, lpcStripReader) == 0) &&
+				if ((strcmp(readerName, lpcStripReader) == 0) &&
 					(port == (sReadersContexts[i])->port))
 				{
 					Log1(PCSC_LOG_ERROR, "Duplicate reader found.");
@@ -167,7 +167,7 @@
 	}
 
 	/* Check and set the readername to see if it must be enumerated */
-	parentNode = RFSetReaderName(sReadersContexts[dwContext], lpcReader,
+	parentNode = RFSetReaderName(sReadersContexts[dwContext], readerName,
 		lpcLibrary, port, 0);
 	if (parentNode < -1)
 		return SCARD_E_NO_MEMORY;
@@ -264,8 +264,8 @@
 	if (rv != SCARD_S_SUCCESS)
 	{
 		/* Cannot connect to reader. Exit gracefully */
-		Log2(PCSC_LOG_ERROR, "%s init failed.", lpcReader);
-		(void)RFRemoveReader(lpcReader, port);
+		Log2(PCSC_LOG_ERROR, "%s init failed.", readerName);
+		(void)RFRemoveReader(readerName, port);
 		return rv;
 	}
 
@@ -288,8 +288,8 @@
 		rv = EHSpawnEventHandler(sReadersContexts[dwContext], fct);
 		if (rv != SCARD_S_SUCCESS)
 		{
-			Log2(PCSC_LOG_ERROR, "%s init failed.", lpcReader);
-			(void)RFRemoveReader(lpcReader, port);
+			Log2(PCSC_LOG_ERROR, "%s init failed.", readerName);
+			(void)RFRemoveReader(readerName, port);
 			return rv;
 		}
 	}
@@ -333,7 +333,7 @@
 		if (i == PCSCLITE_MAX_READERS_CONTEXTS)
 		{
 			/* No more slot left return */
-			rv = RFRemoveReader(lpcReader, port);
+			rv = RFRemoveReader(readerName, port);
 			return SCARD_E_NO_MEMORY;
 		}
 
@@ -419,7 +419,7 @@
 		if (rv != SCARD_S_SUCCESS)
 		{
 			/* Cannot connect to slot. Exit gracefully */
-			(void)RFRemoveReader(lpcReader, port);
+			(void)RFRemoveReader(readerName, port);
 			return rv;
 		}
 
@@ -439,8 +439,8 @@
 		rv = EHSpawnEventHandler(sReadersContexts[dwContextB], fct);
 		if (rv != SCARD_S_SUCCESS)
 		{
-			Log2(PCSC_LOG_ERROR, "%s init failed.", lpcReader);
-			(void)RFRemoveReader(lpcReader, port);
+			Log2(PCSC_LOG_ERROR, "%s init failed.", readerName);
+			(void)RFRemoveReader(readerName, port);
 			return rv;
 		}
 	}
@@ -448,16 +448,16 @@
 	return SCARD_S_SUCCESS;
 }
 
-LONG RFRemoveReader(LPSTR lpcReader, int port)
+LONG RFRemoveReader(const char *readerName, int port)
 {
 	LONG rv;
 	READER_CONTEXT * sContext;
 
-	if (lpcReader == 0)
+	if (readerName == NULL)
 		return SCARD_E_INVALID_VALUE;
 
 	while (SCARD_S_SUCCESS ==
-		RFReaderInfoNamePort(port, lpcReader, &sContext))
+		RFReaderInfoNamePort(port, readerName, &sContext))
 	{
 
 		/* Try to destroy the thread */
@@ -532,7 +532,7 @@
 	return SCARD_S_SUCCESS;
 }
 
-LONG RFSetReaderName(READER_CONTEXT * rContext, LPSTR readerName,
+LONG RFSetReaderName(READER_CONTEXT * rContext, const char *readerName,
 	LPSTR libraryName, int port, DWORD slot)
 {
 	LONG parent = -1;	/* reader number of the parent of the clone */
@@ -579,7 +579,7 @@
 						&& ((sReadersContexts[i])->port != port))
 						|| (supportedChannels > 1))
 					{
-						char *lpcReader = sReadersContexts[i]->readerState->readerName;
+						const char *reader = sReadersContexts[i]->readerState->readerName;
 
 						/*
 						 * tells the caller who the parent of this
@@ -593,7 +593,7 @@
 						 * hotplug then we must look for others and
 						 * enumerate the readername
 						 */
-						currentDigit = strtol(lpcReader + strlen(lpcReader) - 5, NULL, 16);
+						currentDigit = strtol(reader + strlen(reader) - 5, NULL, 16);
 
 						/* This spot is taken */
 						usedDigits[currentDigit] = TRUE;
@@ -641,18 +641,18 @@
 	return parent;
 }
 
-LONG RFReaderInfo(LPSTR lpcReader, READER_CONTEXT ** sReader)
+LONG RFReaderInfo(const char *readerName, READER_CONTEXT ** sReader)
 {
 	int i;
 
-	if (lpcReader == 0)
+	if (readerName == NULL)
 		return SCARD_E_UNKNOWN_READER;
 
 	for (i = 0; i < PCSCLITE_MAX_READERS_CONTEXTS; i++)
 	{
 		if ((sReadersContexts[i])->vHandle != 0)
 		{
-			if (strcmp(lpcReader,
+			if (strcmp(readerName,
 				sReadersContexts[i]->readerState->readerName) == 0)
 			{
 				*sReader = sReadersContexts[i];
@@ -664,7 +664,7 @@
 	return SCARD_E_UNKNOWN_READER;
 }
 
-LONG RFReaderInfoNamePort(int port, LPSTR lpcReader,
+LONG RFReaderInfoNamePort(int port, const char *readerName,
 	READER_CONTEXT * * sReader)
 {
 	char lpcStripReader[MAX_READERNAME];
@@ -682,7 +682,7 @@
 			tmplen = strlen(lpcStripReader);
 			lpcStripReader[tmplen - 6] = 0;
 
-			if ((strcmp(lpcReader, lpcStripReader) == 0) &&
+			if ((strcmp(readerName, lpcStripReader) == 0) &&
 				(port == (sReadersContexts[i])->port))
 			{
 				*sReader = sReadersContexts[i];

Modified: trunk/PCSC/src/readerfactory.h
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/readerfactory.h?rev=5216&op=diff
==============================================================================
--- trunk/PCSC/src/readerfactory.h (original)
+++ trunk/PCSC/src/readerfactory.h Thu Sep  2 09:53:40 2010
@@ -139,11 +139,11 @@
 	typedef struct ReaderContext READER_CONTEXT;
 
 	LONG RFAllocateReaderSpace(unsigned int);
-	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(int, LPSTR, /*@out@*/ struct ReaderContext **);
+	LONG RFAddReader(const char *, int, LPSTR, LPSTR);
+	LONG RFRemoveReader(const char *, int);
+	LONG RFSetReaderName(READER_CONTEXT *, const char *, LPSTR, int, DWORD);
+	LONG RFReaderInfo(const char *, /*@out@*/ struct ReaderContext **);
+	LONG RFReaderInfoNamePort(int, const char *, /*@out@*/ struct ReaderContext **);
 	LONG RFReaderInfoById(DWORD, /*@out@*/ struct ReaderContext **);
 	LONG RFCheckSharing(SCARDHANDLE, READER_CONTEXT *);
 	LONG RFLockSharing(SCARDHANDLE, READER_CONTEXT *);

Modified: trunk/PCSC/src/winscard_clnt.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_clnt.c?rev=5216&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_clnt.c (original)
+++ trunk/PCSC/src/winscard_clnt.c Thu Sep  2 09:53:40 2010
@@ -1947,16 +1947,16 @@
 		/* Ignore for IGNORED readers */
 		if (!(currReader->dwCurrentState & SCARD_STATE_IGNORE))
 		{
-			LPSTR lpcReaderName;
+			const char *readerName;
 			int i;
 
 	  /************ Looks for correct readernames *********************/
 
-			lpcReaderName = (char *) currReader->szReader;
+			readerName = currReader->szReader;
 
 			for (i = 0; i < PCSCLITE_MAX_READERS_CONTEXTS; i++)
 			{
-				if (strcmp(lpcReaderName, readerStates[i].readerName) == 0)
+				if (strcmp(readerName, readerStates[i].readerName) == 0)
 					break;
 			}
 
@@ -1964,7 +1964,7 @@
 			if (i == PCSCLITE_MAX_READERS_CONTEXTS)
 			{
 				/* PnP special reader? */
-				if (strcasecmp(lpcReaderName, "\\\\?PnP?\\Notification") == 0)
+				if (strcasecmp(readerName, "\\\\?PnP?\\Notification") == 0)
 				{
 					int k, newReaderCount = 0;
 




More information about the Pcsclite-cvs-commit mailing list