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

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


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

Modified Files:
	winscard_clnt.c winscard.c 
Log Message:
define and use an internal SCARD_PROTOCOL_ANY_OLD for backward
compatibility for applications compiled with the old SCARD_PROTOCOL_ANY
definition.


Index: winscard_clnt.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/winscard_clnt.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- winscard_clnt.c	6 Aug 2004 12:12:19 -0000	1.41
+++ winscard_clnt.c	18 Aug 2004 22:13:50 -0000	1.42
@@ -32,6 +32,8 @@
 
 #include "winscard_msg.h"
 
+#define SCARD_PROTOCOL_ANY_OLD	0x1000  /* used for backward compatibility */
+
 #ifndef min
 #define min(a,b) (((a) < (b)) ? (a) : (b))
 #endif
@@ -393,7 +395,7 @@
 	if (!(dwPreferredProtocols & SCARD_PROTOCOL_T0) &&
 		!(dwPreferredProtocols & SCARD_PROTOCOL_T1) &&
 		!(dwPreferredProtocols & SCARD_PROTOCOL_RAW) &&
-		!(dwPreferredProtocols & SCARD_PROTOCOL_ANY))
+		!(dwPreferredProtocols & SCARD_PROTOCOL_ANY_OLD))
 	{
 		return SCARD_E_INVALID_VALUE;
 	}
@@ -479,7 +481,7 @@
 	if (!(dwPreferredProtocols & SCARD_PROTOCOL_T0) &&
 		!(dwPreferredProtocols & SCARD_PROTOCOL_T1) &&
 		!(dwPreferredProtocols & SCARD_PROTOCOL_RAW) &&
-		!(dwPreferredProtocols & SCARD_PROTOCOL_ANY))
+		!(dwPreferredProtocols & SCARD_PROTOCOL_ANY_OLD))
 	{
 		return SCARD_E_INVALID_VALUE;
 	}

Index: winscard.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/winscard.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- winscard.c	6 Aug 2004 12:12:19 -0000	1.43
+++ winscard.c	18 Aug 2004 22:13:50 -0000	1.44
@@ -28,6 +28,8 @@
 #include "sys_generic.h"
 #include "eventhandler.h"
 
+#define SCARD_PROTOCOL_ANY_OLD	0x1000  /* used for backward compatibility */
+
 /*
  * Some defines for context stack
  */
@@ -110,7 +112,7 @@
 	if (!(dwPreferredProtocols & SCARD_PROTOCOL_T0) &&
 			!(dwPreferredProtocols & SCARD_PROTOCOL_T1) &&
 			!(dwPreferredProtocols & SCARD_PROTOCOL_RAW) &&
-			!(dwPreferredProtocols & SCARD_PROTOCOL_ANY))
+			!(dwPreferredProtocols & SCARD_PROTOCOL_ANY_OLD))
 		return SCARD_E_PROTO_MISMATCH;
 
 	if (dwShareMode != SCARD_SHARE_EXCLUSIVE &&
@@ -118,7 +120,7 @@
 			dwShareMode != SCARD_SHARE_DIRECT)
 		return SCARD_E_INVALID_VALUE;
 
-	DebugLogB("Attempting Connect to %s", szReader);
+	DebugLogC("Attempting Connect to %s %d", szReader, dwPreferredProtocols);
 
 	rv = RFReaderInfo((LPTSTR) szReader, &rContext);
 
@@ -193,7 +195,7 @@
 				/*
 				 * If it is set to ANY let it do any of the protocols
 				 */
-				if (dwPreferredProtocols & SCARD_PROTOCOL_ANY)
+				if (dwPreferredProtocols & SCARD_PROTOCOL_ANY_OLD)
 					dwPreferredProtocols = SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1;
 
 				rContext->readerState->cardProtocol =
@@ -313,7 +315,7 @@
 	if (!(dwPreferredProtocols & SCARD_PROTOCOL_T0) &&
 			!(dwPreferredProtocols & SCARD_PROTOCOL_T1) &&
 			!(dwPreferredProtocols & SCARD_PROTOCOL_RAW) &&
-			!(dwPreferredProtocols & SCARD_PROTOCOL_ANY))
+			!(dwPreferredProtocols & SCARD_PROTOCOL_ANY_OLD))
 		return SCARD_E_PROTO_MISMATCH;
 
 	if (pdwActiveProtocol == 0)
@@ -490,7 +492,7 @@
 							rContext->readerState->cardAtrLength);
 
 				/* If it is set to ANY let it do any of the protocols */
-				if (dwPreferredProtocols & SCARD_PROTOCOL_ANY)
+				if (dwPreferredProtocols & SCARD_PROTOCOL_ANY_OLD)
 					dwPreferredProtocols = SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1;
 
 				rContext->readerState->cardProtocol =
@@ -1307,7 +1309,7 @@
 
 	if (pioSendPci->dwProtocol != SCARD_PROTOCOL_RAW)
 	{
-		if (pioSendPci->dwProtocol != SCARD_PROTOCOL_ANY)
+		if (pioSendPci->dwProtocol != SCARD_PROTOCOL_ANY_OLD)
 		{
 			if (pioSendPci->dwProtocol != rContext->readerState->cardProtocol)
 			{
@@ -1343,7 +1345,7 @@
 		 * This is temporary ......
 		 */
 		sSendPci.Protocol = SCARD_PROTOCOL_RAW;
-	} else if (pioSendPci->dwProtocol == SCARD_PROTOCOL_ANY)
+	} else if (pioSendPci->dwProtocol == SCARD_PROTOCOL_ANY_OLD)
 	{
 	  /* Fix by Amira (Athena) */
 		unsigned long i;