[Pcsclite-cvs-commit] CVS PCSC/src
CVS User rousseau
ludovic.rousseau@free.fr
Tue, 11 Jan 2005 13:45:46 -0700
Update of /cvsroot/pcsclite/PCSC/src
In directory haydn:/tmp/cvs-serv16380
Modified Files:
readerfactory.c winscard.c winscard_clnt.c winscard_scf.c
Log Message:
use SYS_RandomInt() instead of SYS_Random() to improve performances.
Thanks to Philipp Marek for the patch
--- /cvsroot/pcsclite/PCSC/src/readerfactory.c 2004/09/14 07:10:51 1.66
+++ /cvsroot/pcsclite/PCSC/src/readerfactory.c 2005/01/11 20:45:45 1.67
@@ -8,7 +8,7 @@
* Damien Sauveron <damien.sauveron@labri.fr>
* Ludovic Rousseau <ludovic.rousseau@free.fr>
*
- * $Id: readerfactory.c,v 1.66 2004/09/14 07:10:51 rousseau Exp $
+ * $Id: readerfactory.c,v 1.67 2005/01/11 20:45:45 rousseau Exp $
*/
#include "config.h"
@@ -1136,7 +1136,7 @@
* Create a random handle with 16 bits check to see if it already is
* used.
*/
- randHandle = SYS_Random(SYS_GetSeed(), 10, 65000);
+ randHandle = SYS_RandomInt(10, 65000);
while (1)
{
@@ -1156,7 +1156,7 @@
/*
* Get a new handle and loop again
*/
- randHandle = SYS_Random(randHandle, 10, 65000);
+ randHandle = SYS_RandomInt(10, 65000);
continue;
}
}
--- /cvsroot/pcsclite/PCSC/src/winscard.c 2004/09/14 22:51:17 1.46
+++ /cvsroot/pcsclite/PCSC/src/winscard.c 2005/01/11 20:45:45 1.47
@@ -8,7 +8,7 @@
* David Corcoran <corcoran@linuxnet.com>
* Ludovic Rousseau <ludovic.rousseau@free.fr>
*
- * $Id: winscard.c,v 1.46 2004/09/14 22:51:17 rousseau Exp $
+ * $Id: winscard.c,v 1.47 2005/01/11 20:45:45 rousseau Exp $
*/
#include "config.h"
@@ -64,8 +64,7 @@
* identified by clients and distinguished from others
*/
- *phContext = (PCSCLITE_SVC_IDENTITY + SYS_Random(SYS_GetSeed(),
- 1.0, 65535.0));
+ *phContext = (PCSCLITE_SVC_IDENTITY + SYS_RandomInt(1, 65535));
DebugLogB("Establishing Context: %d", *phContext);
--- /cvsroot/pcsclite/PCSC/src/winscard_clnt.c 2005/01/11 20:27:54 1.50
+++ /cvsroot/pcsclite/PCSC/src/winscard_clnt.c 2005/01/11 20:45:45 1.51
@@ -9,7 +9,7 @@
* Damien Sauveron <damien.sauveron@labri.fr>
* Ludovic Rousseau <ludovic.rousseau@free.fr>
*
- * $Id: winscard_clnt.c,v 1.50 2005/01/11 20:27:54 rousseau Exp $
+ * $Id: winscard_clnt.c,v 1.51 2005/01/11 20:45:45 rousseau Exp $
*/
#include "config.h"
@@ -677,7 +677,7 @@
/*
* This helps prevent starvation
*/
- randnum = SYS_Random(randnum, 1000.0, 10000.0);
+ randnum = SYS_RandomInt(1000, 10000);
SYS_USleep(randnum);
if ((readerStates[i])->lockState == 0)
@@ -798,7 +798,7 @@
/*
* This helps prevent starvation
*/
- randnum = SYS_Random(randnum, 1000.0, 10000.0);
+ randnum = SYS_RandomInt(1000, 10000);
SYS_USleep(randnum);
SYS_MutexUnLock(psContextMap[dwContextIndex].mMutex);
--- /cvsroot/pcsclite/PCSC/src/winscard_scf.c 2004/08/06 12:12:19 1.15
+++ /cvsroot/pcsclite/PCSC/src/winscard_scf.c 2005/01/11 20:45:46 1.16
@@ -7,7 +7,7 @@
* David Corcoran <corcoran@linuxnet.com>
* Najam Siddiqui
*
- * $Id: winscard_scf.c,v 1.15 2004/08/06 12:12:19 rousseau Exp $
+ * $Id: winscard_scf.c,v 1.16 2005/01/11 20:45:46 rousseau Exp $
*/
#include "config.h"
@@ -1315,8 +1315,7 @@
}
while(1) {
- *phCard = (PCSCLITE_SVC_IDENTITY + SYS_Random(SYS_GetSeed(),
- 1.0, 65535.0));
+ *phCard = (PCSCLITE_SVC_IDENTITY + SYS_RandomInt(1, 65535));
if(SCardGetHandleIndice(*phCard) == -1)
break;
}
@@ -1355,8 +1354,7 @@
if (status != SCF_STATUS_SUCCESS) return SCARD_E_NO_SERVICE;
while(1) {
- *phContext = (PCSCLITE_SVC_IDENTITY + SYS_Random(SYS_GetSeed(),
- 1.0, 65535.0));
+ *phContext = (PCSCLITE_SVC_IDENTITY + SYS_RandomInt(1, 65535));
if(-1 == SCardGetContextIndice(*phContext))
break;
}