[Pcsclite-cvs-commit] PCSC/src winscard_clnt.c,1.42,1.43

rousseau@haydn.debian.org rousseau@haydn.debian.org


Update of /cvsroot/pcsclite/PCSC/src
In directory haydn:/tmp/cvs-serv16012/src

Modified Files:
	winscard_clnt.c 
Log Message:
SCardStatus(): pdwState and pdwProtocol parameters may be NULL (mimic Windows)


Index: winscard_clnt.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/winscard_clnt.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- winscard_clnt.c	18 Aug 2004 22:13:50 -0000	1.42
+++ winscard_clnt.c	24 Aug 2004 14:02:36 -0000	1.43
@@ -886,8 +886,7 @@
 	 * Check for NULL parameters
 	 */
 
-	if (pcchReaderLen == NULL || pdwState == NULL || pdwProtocol == NULL
-		|| pcbAtrLen == NULL)
+	if (pcchReaderLen == NULL || pcbAtrLen == NULL)
 		return SCARD_E_INVALID_PARAMETER;
 
 	/* length passed from caller */
@@ -895,8 +894,12 @@
 	dwAtrLen = *pcbAtrLen;
 
 	/* default output values */
-	*pdwState = 0;
-	*pdwProtocol = 0;
+	if (pdwState)
+		*pdwState = 0;
+
+	if (pdwProtocol)
+		*pdwProtocol = 0;
+
 	*pcchReaderLen = 0;
 	*pcbAtrLen = 0;
 
@@ -976,8 +979,11 @@
 	*pcchReaderLen = strlen(psContextMap[dwContextIndex].psChannelMap[dwChannelIndex].readerName) + 1;
 	*pcbAtrLen = (readerStates[i])->cardAtrLength;
 
-	*pdwState = (readerStates[i])->readerState;
-	*pdwProtocol = (readerStates[i])->cardProtocol;
+	if (pdwState)
+		*pdwState = (readerStates[i])->readerState;
+
+	if (pdwProtocol)
+		*pdwProtocol = (readerStates[i])->cardProtocol;
 
 	/* return SCARD_E_INSUFFICIENT_BUFFER only if buffer pointer is non NULL */
 	if (mszReaderNames)