[Pcsclite-cvs-commit] r6375 - /trunk/PCSC/src/winscard.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Fri Jun 29 09:53:25 UTC 2012


Author: rousseau
Date: Fri Jun 29 09:53:24 2012
New Revision: 6375

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=6375
Log:
SCardControl(): use an exit block

goto exit; instead of a direct return.

This will allow to factorize exit code.

Modified:
    trunk/PCSC/src/winscard.c

Modified: trunk/PCSC/src/winscard.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard.c?rev=6375&op=diff
==============================================================================
--- trunk/PCSC/src/winscard.c (original)
+++ trunk/PCSC/src/winscard.c Fri Jun 29 09:53:24 2012
@@ -1298,32 +1298,38 @@
 	 */
 	rv = RFCheckSharing(hCard, rContext);
 	if (rv != SCARD_S_SUCCESS)
-		return rv;
+		goto exit;
 
 	if (IFD_HVERSION_2_0 == rContext->version)
 		if (NULL == pbSendBuffer || 0 == cbSendLength)
-			return SCARD_E_INVALID_PARAMETER;
+		{
+			rv = SCARD_E_INVALID_PARAMETER;
+			goto exit;
+		}
 
 	/*
 	 * Make sure the reader is working properly
 	 */
 	rv = RFCheckReaderStatus(rContext);
 	if (rv != SCARD_S_SUCCESS)
-		return rv;
+		goto exit;
 
 	if (IFD_HVERSION_2_0 == rContext->version)
 	{
 		/* we must wrap a API 3.0 client in an API 2.0 driver */
 		*lpBytesReturned = cbRecvLength;
-		return IFDControl_v2(rContext, (PUCHAR)pbSendBuffer,
+		rv = IFDControl_v2(rContext, (PUCHAR)pbSendBuffer,
 			cbSendLength, pbRecvBuffer, lpBytesReturned);
 	}
 	else
 		if (IFD_HVERSION_3_0 == rContext->version)
-			return IFDControl(rContext, dwControlCode, pbSendBuffer,
+			rv = IFDControl(rContext, dwControlCode, pbSendBuffer,
 				cbSendLength, pbRecvBuffer, cbRecvLength, lpBytesReturned);
 		else
-			return SCARD_E_UNSUPPORTED_FEATURE;
+			rv = SCARD_E_UNSUPPORTED_FEATURE;
+
+exit:
+	return rv;
 }
 
 LONG SCardGetAttrib(SCARDHANDLE hCard, DWORD dwAttrId,




More information about the Pcsclite-cvs-commit mailing list