[Pcsclite-cvs-commit] r3170 - /trunk/Drivers/ccid/src/towitoko/atr.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Oct 14 13:49:11 UTC 2008


Author: rousseau
Date: Tue Oct 14 13:49:11 2008
New Revision: 3170

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=3170
Log:
ATR_InitFromArray(): use atr_buffer[] directly (no need to copy it)

Modified:
    trunk/Drivers/ccid/src/towitoko/atr.c

Modified: trunk/Drivers/ccid/src/towitoko/atr.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/towitoko/atr.c?rev=3170&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/towitoko/atr.c (original)
+++ trunk/Drivers/ccid/src/towitoko/atr.c Tue Oct 14 13:49:11 2008
@@ -65,19 +65,16 @@
 ATR_InitFromArray (ATR_t * atr, const BYTE atr_buffer[ATR_MAX_SIZE], unsigned length)
 {
   BYTE TDi;
-  BYTE buffer[ATR_MAX_SIZE];
   unsigned pointer = 0, pn = 0;
 
   /* Check size of buffer */
   if (length < 2)
     return (ATR_MALFORMED);
 
-    memcpy (buffer, atr_buffer, length);
-
   /* Store T0 and TS */
-  atr->TS = buffer[0];
-
-  atr->T0 = TDi = buffer[1];
+  atr->TS = atr_buffer[0];
+
+  atr->T0 = TDi = atr_buffer[1];
   pointer = 1;
 
   /* Store number of historical bytes */
@@ -98,7 +95,7 @@
       if ((TDi | 0xEF) == 0xFF)
 	{
 	  pointer++;
-	  atr->ib[pn][ATR_INTERFACE_BYTE_TA].value = buffer[pointer];
+	  atr->ib[pn][ATR_INTERFACE_BYTE_TA].value = atr_buffer[pointer];
 	  atr->ib[pn][ATR_INTERFACE_BYTE_TA].present = TRUE;
 	}
       else
@@ -107,7 +104,7 @@
       if ((TDi | 0xDF) == 0xFF)
 	{
 	  pointer++;
-	  atr->ib[pn][ATR_INTERFACE_BYTE_TB].value = buffer[pointer];
+	  atr->ib[pn][ATR_INTERFACE_BYTE_TB].value = atr_buffer[pointer];
 	  atr->ib[pn][ATR_INTERFACE_BYTE_TB].present = TRUE;
 	}
       else
@@ -117,7 +114,7 @@
       if ((TDi | 0xBF) == 0xFF)
 	{
 	  pointer++;
-	  atr->ib[pn][ATR_INTERFACE_BYTE_TC].value = buffer[pointer];
+	  atr->ib[pn][ATR_INTERFACE_BYTE_TC].value = atr_buffer[pointer];
 	  atr->ib[pn][ATR_INTERFACE_BYTE_TC].present = TRUE;
 	}
       else
@@ -127,7 +124,7 @@
       if ((TDi | 0x7F) == 0xFF)
 	{
 	  pointer++;
-	  TDi = atr->ib[pn][ATR_INTERFACE_BYTE_TD].value = buffer[pointer];
+	  TDi = atr->ib[pn][ATR_INTERFACE_BYTE_TD].value = atr_buffer[pointer];
 	  atr->ib[pn][ATR_INTERFACE_BYTE_TD].present = TRUE;
 	  (atr->TCK).present = ((TDi & 0x0F) != ATR_PROTOCOL_TYPE_T0);
 	  if (pn >= ATR_MAX_PROTOCOLS)
@@ -148,7 +145,7 @@
   if (pointer + atr->hbn >= length)
     return (ATR_MALFORMED);
 
-  memcpy (atr->hb, buffer + pointer + 1, atr->hbn);
+  memcpy (atr->hb, atr_buffer + pointer + 1, atr->hbn);
   pointer += (atr->hbn);
 
   /* Store TCK  */
@@ -160,7 +157,7 @@
 
       pointer++;
 
-      (atr->TCK).value = buffer[pointer];
+      (atr->TCK).value = atr_buffer[pointer];
     }
 
   atr->length = pointer + 1;




More information about the Pcsclite-cvs-commit mailing list