[Pcsclite-git-commit] [PCSC] 03/11: Doxygen: SCardStatus() reader name arg is a C-string
Ludovic Rousseau
rousseau at moszumanska.debian.org
Fri Mar 11 17:54:48 UTC 2016
This is an automated email from the git hooks/post-receive script.
rousseau pushed a commit to branch master
in repository PCSC.
commit 2a80f615fc5084838a9c299609fa468772fae71b
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date: Fri Mar 11 09:54:12 2016 +0100
Doxygen: SCardStatus() reader name arg is a C-string
The szReaderName argument of the SCardStatus() function is a
NUL-terminated C-string, not a multi string as documented.
Thanks to Maksim Ivanov for the bug report
http://lists.alioth.debian.org/pipermail/pcsclite-muscle/Week-of-Mon-20160307/000536.html
---
src/testpcsc.c | 16 ++++++++--------
src/winscard.c | 4 ++--
src/winscard_clnt.c | 14 +++++++-------
3 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/src/testpcsc.c b/src/testpcsc.c
index 560fd94..7fb177b 100644
--- a/src/testpcsc.c
+++ b/src/testpcsc.c
@@ -80,7 +80,7 @@ int main(/*@unused@*/ int argc, /*@unused@*/ char **argv)
SCARD_READERSTATE rgReaderStates[1];
DWORD dwReaderLen, dwState, dwProt, dwAtrLen;
DWORD dwPref, dwReaders = 0;
- char *pcReaders = NULL, *mszReaders;
+ char *pcReader = NULL, *mszReaders;
#ifdef USE_AUTOALLOCATE
unsigned char *pbAtr = NULL;
#else
@@ -426,19 +426,19 @@ wait_for_card_again:
#ifdef USE_AUTOALLOCATE
dwReaderLen = SCARD_AUTOALLOCATE;
dwAtrLen = SCARD_AUTOALLOCATE;
- rv = SCardStatus(hCard, (LPSTR)&pcReaders, &dwReaderLen, &dwState, &dwProt,
+ rv = SCardStatus(hCard, (LPSTR)&pcReader, &dwReaderLen, &dwState, &dwProt,
(LPBYTE)&pbAtr, &dwAtrLen);
#else
dwReaderLen = 100;
- pcReaders = malloc(sizeof(char) * 100);
+ pcReader = malloc(sizeof(char) * 100);
dwAtrLen = MAX_ATR_SIZE;
- rv = SCardStatus(hCard, pcReaders, &dwReaderLen, &dwState, &dwProt,
+ rv = SCardStatus(hCard, pcReader, &dwReaderLen, &dwState, &dwProt,
pbAtr, &dwAtrLen);
#endif
test_rv(rv, hContext, PANIC);
- printf("Current Reader Name\t\t: " GREEN "%s\n" NORMAL, pcReaders);
+ printf("Current Reader Name\t\t: " GREEN "%s\n" NORMAL, pcReader);
printf("Current Reader State\t\t: " GREEN "0x%.4lx\n" NORMAL, dwState);
printf("Current Reader Protocol\t\t: T=" GREEN "%ld\n" NORMAL, dwProt - 1);
printf("Current Reader ATR Size\t\t: " GREEN "%ld" NORMAL " bytes\n",
@@ -453,14 +453,14 @@ wait_for_card_again:
#ifdef USE_AUTOALLOCATE
printf("Testing SCardFreeMemory\t\t: ");
- rv = SCardFreeMemory(hContext, pcReaders);
+ rv = SCardFreeMemory(hContext, pcReader);
test_rv(rv, hContext, PANIC);
printf("Testing SCardFreeMemory\t\t: ");
rv = SCardFreeMemory(hContext, pbAtr);
test_rv(rv, hContext, PANIC);
#else
- if (pcReaders)
- free(pcReaders);
+ if (pcReader)
+ free(pcReader);
#endif
if (rv != SCARD_S_SUCCESS)
diff --git a/src/winscard.c b/src/winscard.c
index 67eb9b0..07514b3 100644
--- a/src/winscard.c
+++ b/src/winscard.c
@@ -1250,7 +1250,7 @@ exit:
return rv;
}
-LONG SCardStatus(SCARDHANDLE hCard, LPSTR mszReaderNames,
+LONG SCardStatus(SCARDHANDLE hCard, LPSTR szReaderNames,
LPDWORD pcchReaderLen, LPDWORD pdwState,
LPDWORD pdwProtocol, LPBYTE pbAtr, LPDWORD pcbAtrLen)
{
@@ -1259,7 +1259,7 @@ LONG SCardStatus(SCARDHANDLE hCard, LPSTR mszReaderNames,
/* These parameters are not used by the client
* Client side code uses readerStates[] instead */
- (void)mszReaderNames;
+ (void)szReaderNames;
(void)pcchReaderLen;
(void)pdwState;
(void)pdwProtocol;
diff --git a/src/winscard_clnt.c b/src/winscard_clnt.c
index 80319db..3a15a58 100644
--- a/src/winscard_clnt.c
+++ b/src/winscard_clnt.c
@@ -1277,7 +1277,7 @@ end:
* SCardStatus().
*
* If \c *pcchReaderLen is equal to \ref SCARD_AUTOALLOCATE then the function
- * will allocate itself the needed memory for mszReaderName. Use
+ * will allocate itself the needed memory for szReaderName. Use
* SCardFreeMemory() to release it.
*
* If \c *pcbAtrLen is equal to \ref SCARD_AUTOALLOCATE then the function will
@@ -1286,8 +1286,8 @@ end:
*
* @ingroup API
* @param[in] hCard Connection made from SCardConnect().
- * @param[in,out] mszReaderName Friendly name of this reader.
- * @param[in,out] pcchReaderLen Size of the \p szReaderName multistring.
+ * @param[in,out] szReaderName Friendly name of this reader.
+ * @param[in,out] pcchReaderLen Size of the \p szReaderName.
* @param[out] pdwState Current state of this reader. \p pdwState
* is a DWORD possibly OR'd with the following values:
* - \ref SCARD_ABSENT - There is no card in the reader.
@@ -1353,7 +1353,7 @@ end:
* &dwProtocol, (LPBYTE)&pbAtr, &dwAtrLen);
* @endcode
*/
-LONG SCardStatus(SCARDHANDLE hCard, LPSTR mszReaderName,
+LONG SCardStatus(SCARDHANDLE hCard, LPSTR szReaderName,
LPDWORD pcchReaderLen, LPDWORD pdwState,
LPDWORD pdwProtocol, LPBYTE pbAtr, LPDWORD pcbAtrLen)
{
@@ -1473,7 +1473,7 @@ retry:
if (SCARD_AUTOALLOCATE == dwReaderLen)
{
dwReaderLen = *pcchReaderLen;
- if (NULL == mszReaderName)
+ if (NULL == szReaderName)
{
rv = SCARD_E_INVALID_PARAMETER;
goto end;
@@ -1484,10 +1484,10 @@ retry:
rv = SCARD_E_NO_MEMORY;
goto end;
}
- *(char **)mszReaderName = bufReader;
+ *(char **)szReaderName = bufReader;
}
else
- bufReader = mszReaderName;
+ bufReader = szReaderName;
/* return SCARD_E_INSUFFICIENT_BUFFER only if buffer pointer is non NULL */
if (bufReader)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/PCSC.git
More information about the Pcsclite-cvs-commit
mailing list