channels/smartcard: minor fixes

This commit is contained in:
Marc-André Moreau 2014-04-10 17:36:42 -04:00
parent ccea0b1e62
commit 2b52c294a2
3 changed files with 17 additions and 17 deletions

View File

@ -258,12 +258,12 @@ static UINT32 smartcard_ListReadersA(SMARTCARD_DEVICE* smartcard, IRP* irp)
status = ret.ReturnCode = SCardListReadersA(hContext, (LPCSTR) call.mszGroups, (LPSTR) &mszReaders, &cchReaders);
if (status)
return status;
ret.msz = (BYTE*) mszReaders;
ret.cBytes = cchReaders;
if (status)
return status;
status = smartcard_pack_list_readers_return(smartcard, irp->output, &ret);
if (status)
@ -298,12 +298,12 @@ static UINT32 smartcard_ListReadersW(SMARTCARD_DEVICE* smartcard, IRP* irp)
status = ret.ReturnCode = SCardListReadersW(hContext, (LPCWSTR) call.mszGroups, (LPWSTR) &mszReaders, &cchReaders);
ret.msz = (BYTE*) mszReaders;
ret.cBytes = cchReaders * 2;
if (status)
return status;
ret.msz = (BYTE*) mszReaders;
ret.cBytes = cchReaders;
status = smartcard_pack_list_readers_return(smartcard, irp->output, &ret);
if (status)
@ -753,7 +753,7 @@ static DWORD smartcard_StatusA(SMARTCARD_DEVICE* smartcard, IRP* irp)
}
ret.mszReaderNames = (BYTE*) mszReaderNames;
ret.cBytes = smartcard_multi_string_length_a((char*) ret.mszReaderNames) + 2;
ret.cBytes = cchReaderLen * 2;
status = smartcard_pack_status_return(smartcard, irp->output, &ret);
@ -802,7 +802,7 @@ static DWORD smartcard_StatusW(SMARTCARD_DEVICE* smartcard, IRP* irp)
}
ret.mszReaderNames = (BYTE*) mszReaderNames;
ret.cBytes = (smartcard_multi_string_length_w((WCHAR*) ret.mszReaderNames) + 2) * 2;
ret.cBytes = cchReaderLen * 2;
status = smartcard_pack_status_return(smartcard, irp->output, &ret);
@ -937,7 +937,7 @@ static UINT32 smartcard_GetAttrib(SMARTCARD_DEVICE* smartcard, IRP* irp)
call.cbAttrLen = 0;
if (call.cbAttrLen)
ret.pbAttr = malloc(call.cbAttrLen);
ret.pbAttr = (BYTE*) malloc(call.cbAttrLen);
cbAttrLen = call.cbAttrLen;
@ -1303,7 +1303,7 @@ void smartcard_irp_device_control(SMARTCARD_DEVICE* smartcard, IRP* irp)
smartcard_get_ioctl_string(ioControlCode, TRUE), ioControlCode, result);
}
if (Stream_GetPosition(irp->input) < Stream_Length(irp->input))
if (((size_t) Stream_GetPosition(irp->input)) < Stream_Length(irp->input))
{
UINT32 difference;
@ -1317,7 +1317,7 @@ void smartcard_irp_device_control(SMARTCARD_DEVICE* smartcard, IRP* irp)
winpr_HexDump(Stream_Pointer(irp->input), difference);
}
if (Stream_GetPosition(irp->input) > Stream_Length(irp->input))
if (((size_t) Stream_GetPosition(irp->input)) > Stream_Length(irp->input))
{
UINT32 difference;

View File

@ -807,7 +807,7 @@ UINT32 smartcard_unpack_get_status_change_a_call(SMARTCARD_DEVICE* smartcard, wS
return STATUS_BUFFER_TOO_SMALL;
}
readerState->szReader = malloc(count + 1);
readerState->szReader = (unsigned char*) malloc(count + 1);
Stream_Read(s, readerState->szReader, count);
smartcard_unpack_read_size_align(smartcard, s, count, 4);
readerState->szReader[count] = '\0';
@ -913,7 +913,7 @@ UINT32 smartcard_unpack_get_status_change_w_call(SMARTCARD_DEVICE* smartcard, wS
return STATUS_BUFFER_TOO_SMALL;
}
readerState->szReader = malloc((count + 1) * 2);
readerState->szReader = (WCHAR*) malloc((count + 1) * 2);
Stream_Read(s, readerState->szReader, (count * 2));
smartcard_unpack_read_size_align(smartcard, s, (count * 2), 4);
readerState->szReader[count] = '\0';

View File

@ -453,7 +453,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardListReadersW(SCARDCONTEXT hContext,
if (status && *pMszReadersA)
{
*pcchReaders = ConvertToUnicode(CP_UTF8, 0, *pMszReadersA, *pcchReaders, (WCHAR**) mszReaders, 0) * 2;
*pcchReaders = ConvertToUnicode(CP_UTF8, 0, *pMszReadersA, *pcchReaders, (WCHAR**) mszReaders, 0);
PCSC_AddMemoryBlock(hContext, mszReaders);
}
@ -466,7 +466,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardListReadersW(SCARDCONTEXT hContext,
if (mszReadersA)
{
*pcchReaders = ConvertToUnicode(CP_UTF8, 0, mszReadersA, *pcchReaders, (WCHAR**) mszReaders, 0) * 2;
*pcchReaders = ConvertToUnicode(CP_UTF8, 0, mszReadersA, *pcchReaders, (WCHAR**) mszReaders, 0);
PCSC_AddMemoryBlock(hContext, mszReaders);
PCSC_SCardFreeMemory(hContext, mszReadersA);
@ -1120,7 +1120,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardStatusW(SCARDHANDLE hCard,
if (mszReaderNamesA)
{
*pcchReaderLen = ConvertToUnicode(CP_UTF8, 0, mszReaderNamesA, *pcchReaderLen, (WCHAR**) mszReaderNames, 0) * 2;
*pcchReaderLen = ConvertToUnicode(CP_UTF8, 0, mszReaderNamesA, *pcchReaderLen, (WCHAR**) mszReaderNames, 0);
PCSC_AddMemoryBlock(hContext, mszReaderNames);
PCSC_SCardFreeMemory(hContext, mszReaderNamesA);
@ -1295,7 +1295,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, L
int length;
WCHAR* pbAttrW = NULL;
length = ConvertToUnicode(CP_UTF8, 0, (char*) pbAttr, *pcbAttrLen, &pbAttrW, 0) * 2;
length = ConvertToUnicode(CP_UTF8, 0, (char*) pbAttr, *pcbAttrLen, &pbAttrW, 0);
PCSC_SCardFreeMemory(hContext, pbAttrA);