[Pcsclite-cvs-commit] r3014 - /trunk/PCSC/src/testpcsc.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Thu Jun 19 14:57:35 UTC 2008


Author: rousseau
Date: Thu Jun 19 14:57:35 2008
New Revision: 3014

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=3014
Log:
test SCardListReaders(.. SCARD_AUTOALLOCATE ..)

Modified:
    trunk/PCSC/src/testpcsc.c

Modified: trunk/PCSC/src/testpcsc.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/testpcsc.c?rev=3014&op=diff
==============================================================================
--- trunk/PCSC/src/testpcsc.c (original)
+++ trunk/PCSC/src/testpcsc.c Thu Jun 19 14:57:35 2008
@@ -25,6 +25,8 @@
 
 #define PANIC 0
 #define DONT_PANIC 1
+
+#define USE_AUTOALLOCATE
 
 #define BLUE "\33[34m"
 #define RED "\33[31m"
@@ -116,10 +118,17 @@
 		while (mszGroups[++i] != 0) ;
 	}
 
+	free(mszGroups);
+
 wait_for_card_again:
 	printf("Testing SCardListReaders\t: ");
 
 	mszGroups = NULL;
+#ifdef USE_AUTOALLOCATE
+	dwReaders = SCARD_AUTOALLOCATE;
+	rv = SCardListReaders(hContext, mszGroups, (LPSTR)&mszReaders, &dwReaders);
+	test_rv(rv, hContext, PANIC);
+#else
 	rv = SCardListReaders(hContext, mszGroups, NULL, &dwReaders);
 	test_rv(rv, hContext, PANIC);
 
@@ -127,6 +136,7 @@
 	mszReaders = calloc(dwReaders, sizeof(char));
 	rv = SCardListReaders(hContext, mszGroups, mszReaders, &dwReaders);
 	test_rv(rv, hContext, PANIC);
+#endif
 
 	/*
 	 * Have to understand the multi-string here
@@ -321,6 +331,14 @@
 	rv = SCardDisconnect(hCard, SCARD_UNPOWER_CARD);
 	test_rv(rv, hContext, PANIC);
 
+#ifdef USE_AUTOALLOCATE
+	printf("Testing SCardFreeMemory\t\t: ");
+	rv = SCardFreeMemory(hContext, mszReaders);
+	test_rv(rv, hContext, PANIC);
+#else
+	free(mszReaders);
+#endif
+
 	printf("Testing SCardReleaseContext\t: ");
 	rv = SCardReleaseContext(hContext);
 	test_rv(rv, hContext, PANIC);




More information about the Pcsclite-cvs-commit mailing list