/[pcsclite]/trunk/Drivers/ccid/src/utils.c
ViewVC logotype

Contents of /trunk/Drivers/ccid/src/utils.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2121 - (hide annotations) (download)
Thu Aug 3 13:12:20 2006 UTC (6 years, 9 months ago) by rousseau
File MIME type: text/plain
File size: 1685 byte(s)
change the prototype of ReleaseReaderIndex() to return void since he
function always returned 0 and the returned value was never checked
1 rousseau 269 /*
2     utils.c:
3 rousseau 1143 Copyright (C) 2003-2004 Ludovic Rousseau
4 rousseau 269
5 rousseau 1399 This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Lesser General Public
7     License as published by the Free Software Foundation; either
8     version 2.1 of the License, or (at your option) any later version.
9 rousseau 269
10 rousseau 1399 This library is distributed in the hope that it will be useful,
11 rousseau 269 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 rousseau 1399 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13     Lesser General Public License for more details.
14 rousseau 269
15 rousseau 1399 You should have received a copy of the GNU Lesser General Public
16     License along with this library; if not, write to the Free Software
17     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 rousseau 269 */
19    
20     /*
21     * $Id$
22     */
23    
24 rousseau 1771 #include <pcsclite.h>
25 rousseau 877
26     #include "ccid.h"
27     #include "defs.h"
28     #include "ccid_ifdhandler.h"
29 rousseau 269 #include "utils.h"
30 rousseau 1141 #include "debug.h"
31 rousseau 269
32 rousseau 1105 int ReaderIndex[CCID_DRIVER_MAX_READERS];
33    
34     void InitReaderIndex(void)
35 rousseau 269 {
36 rousseau 1105 int i;
37 rousseau 269
38 rousseau 1105 for (i=0; i<CCID_DRIVER_MAX_READERS; i++)
39     ReaderIndex[i] = -1;
40     } /* InitReaderIndex */
41 rousseau 269
42 rousseau 1105 int GetNewReaderIndex(const DWORD Lun)
43     {
44     int i;
45    
46     for (i=0; i<CCID_DRIVER_MAX_READERS; i++)
47     if (-1 == ReaderIndex[i])
48 rousseau 1140 {
49     ReaderIndex[i] = Lun;
50 rousseau 1105 return i;
51 rousseau 1140 }
52 rousseau 1105
53 rousseau 1141 DEBUG_CRITICAL("ReaderIndex[] is full");
54 rousseau 1105 return -1;
55     } /* GetReaderIndex */
56    
57     int LunToReaderIndex(const DWORD Lun)
58     {
59     int i;
60    
61     for (i=0; i<CCID_DRIVER_MAX_READERS; i++)
62     if (Lun == ReaderIndex[i])
63     return i;
64    
65 rousseau 1142 DEBUG_CRITICAL2("Lun: %X not found", Lun);
66 rousseau 1105 return -1;
67     } /* LunToReaderIndex */
68    
69 rousseau 2121 void ReleaseReaderIndex(const int index)
70 rousseau 1105 {
71     ReaderIndex[index] = -1;
72     } /* ReleaseReaderIndex */
73    

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.5