[Pcsclite-cvs-commit] r3268 - in /trunk/Drivers/ccid/src: ccid.c ccid_serial.c ccid_usb.c commands.c debug.c ifdhandler.c parse.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Mon Jan 5 14:28:26 UTC 2009


Author: rousseau
Date: Mon Jan  5 14:28:26 2009
New Revision: 3268

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=3268
Log:
explicitly cast result in void when not used (reported by the splint tool)

Modified:
    trunk/Drivers/ccid/src/ccid.c
    trunk/Drivers/ccid/src/ccid_serial.c
    trunk/Drivers/ccid/src/ccid_usb.c
    trunk/Drivers/ccid/src/commands.c
    trunk/Drivers/ccid/src/debug.c
    trunk/Drivers/ccid/src/ifdhandler.c
    trunk/Drivers/ccid/src/parse.c

Modified: trunk/Drivers/ccid/src/ccid.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ccid.c?rev=3268&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ccid.c (original)
+++ trunk/Drivers/ccid/src/ccid.c Mon Jan  5 14:28:26 2009
@@ -222,7 +222,7 @@
 						cmd[offset++] = ' ';
 				}
 
-				sleep(1);
+				(void)sleep(1);
 				if (IFD_SUCCESS == CmdEscape(reader_index, cmd, sizeof(cmd), res, &length_res))
 				{
 					DEBUG_COMM("l10n string loaded successfully");
@@ -277,13 +277,13 @@
 
 		case CL1356D:
 			/* the firmware needs some time to initialize */
-			sleep(1);
+			(void)sleep(1);
 			ccid_descriptor->readTimeout = 60; /* 60 seconds */
 			break;
 
 		case SEG:
 #ifndef TWIN_SERIAL
-			InterruptRead(reader_index);
+			(void)InterruptRead(reader_index);
 #endif
 			break;
 	}
@@ -295,9 +295,9 @@
 		unsigned int n = sizeof(tmp);
 
 		DEBUG_COMM("ICCD type A");
-		CmdPowerOff(reader_index);
-		CmdPowerOn(reader_index, &n, tmp, CCID_CLASS_AUTO_VOLTAGE);
-		CmdPowerOff(reader_index);
+		(void)CmdPowerOff(reader_index);
+		(void)CmdPowerOn(reader_index, &n, tmp, CCID_CLASS_AUTO_VOLTAGE);
+		(void)CmdPowerOff(reader_index);
 	}
 
 	/* ICCD type B */
@@ -315,9 +315,9 @@
 			ccid_descriptor->dwFeatures |= CCID_CLASS_EXTENDED_APDU;
 		}
 
-		CmdPowerOff(reader_index);
-		CmdPowerOn(reader_index, &n, tmp, CCID_CLASS_AUTO_VOLTAGE);
-		CmdPowerOff(reader_index);
+		(void)CmdPowerOff(reader_index);
+		(void)CmdPowerOn(reader_index, &n, tmp, CCID_CLASS_AUTO_VOLTAGE);
+		(void)CmdPowerOff(reader_index);
 	}
 
 	return 0;
@@ -438,11 +438,11 @@
 		default:
 			if ((error >= 1) && (error <= 127))
 			{
-				sprintf(var_text, "error on byte %d", error);
+				(void)sprintf(var_text, "error on byte %d", error);
 				text = var_text;
 			}
 			else
-				sprintf(var_text, "Unknown CCID error: 0x%02X", error);
+				(void)sprintf(var_text, "Unknown CCID error: 0x%02X", error);
 				text = var_text;
 			break;
 	}

Modified: trunk/Drivers/ccid/src/ccid_serial.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ccid_serial.c?rev=3268&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ccid_serial.c (original)
+++ trunk/Drivers/ccid/src/ccid_serial.c Mon Jan  5 14:28:26 2009
@@ -178,7 +178,7 @@
 
 	char debug_header[] = "-> 123456 ";
 
-	sprintf(debug_header, "-> %06X ", reader_index);
+	(void)sprintf(debug_header, "-> %06X ", reader_index);
 
 	if (length > GEMPCTWIN_MAXBUF-3)
 	{
@@ -411,7 +411,7 @@
 	int already_read;
 	char debug_header[] = "<- 123456 ";
 
-	sprintf(debug_header, "<- %06X ", reader_index);
+	(void)sprintf(debug_header, "<- %06X ", reader_index);
 
 	already_read = 0;
 	while (already_read < min_length)
@@ -485,7 +485,7 @@
 		return STATUS_UNSUCCESSFUL;
 	}
 
-	sprintf(dev_name, "/dev/pcsc/%d", (int) channel);
+	(void)sprintf(dev_name, "/dev/pcsc/%d", (int) channel);
 
 	return OpenSerialByName(reader_index, dev_name);
 } /* OpenSerial */
@@ -705,7 +705,7 @@
 	if (tcgetattr(serialDevice[reader].fd, &current_termios) == -1)
 	{
 		DEBUG_INFO2("tcgetattr() function error: %s", strerror(errno));
-		close(serialDevice[reader].fd);
+		(void)close(serialDevice[reader].fd);
 		serialDevice[reader].fd = -1;
 
 		return STATUS_UNSUCCESSFUL;
@@ -726,12 +726,12 @@
 	current_termios.c_lflag = 0;
 
 	/* set serial port speed to 115200 bauds */
-	cfsetspeed(&current_termios, B115200);
+	(void)cfsetspeed(&current_termios, B115200);
 
 	DEBUG_INFO("Set serial port baudrate to 115200 and correct configuration");
 	if (tcsetattr(serialDevice[reader].fd, TCSANOW, &current_termios) == -1)
 	{
-		close(serialDevice[reader].fd);
+		(void)close(serialDevice[reader].fd);
 		serialDevice[reader].fd = -1;
 		DEBUG_INFO2("tcsetattr error: %s", strerror(errno));
 
@@ -752,7 +752,7 @@
 			rx_buffer, &rx_length))
 		{
 			DEBUG_CRITICAL("Get firmware failed. Maybe the reader is not connected");
-			CloseSerial(reader_index);
+			(void)CloseSerial(reader_index);
 			return STATUS_UNSUCCESSFUL;
 		}
 
@@ -775,7 +775,7 @@
 			rx_buffer, &rx_length))
 		{
 			DEBUG_CRITICAL("Change card movement notification failed.");
-			CloseSerial(reader_index);
+			(void)CloseSerial(reader_index);
 			return STATUS_UNSUCCESSFUL;
 		}
 	}
@@ -807,7 +807,7 @@
 	{
 		DEBUG_COMM("Last slot closed. Release resources");
 
-		close(serialDevice[reader].fd);
+		(void)close(serialDevice[reader].fd);
 		serialDevice[reader].fd = -1;
 
 		free(serialDevice[reader].device);

Modified: trunk/Drivers/ccid/src/ccid_usb.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ccid_usb.c?rev=3268&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ccid_usb.c (original)
+++ trunk/Drivers/ccid/src/ccid_usb.c Mon Jan  5 14:28:26 2009
@@ -207,8 +207,8 @@
 	if (busses == NULL)
 		usb_init();
 
-	usb_find_busses();
-	usb_find_devices();
+	(void)usb_find_busses();
+	(void)usb_find_devices();
 
 	busses = usb_get_busses();
 
@@ -227,7 +227,7 @@
 	}
 
 	/* Info.plist full patch filename */
-	snprintf(infofile, sizeof(infofile), "%s/%s/Contents/Info.plist",
+	(void)snprintf(infofile, sizeof(infofile), "%s/%s/Contents/Info.plist",
 		PCSCLITE_HP_DROPDIR, BUNDLE);
 
 	/* general driver info */
@@ -372,7 +372,7 @@
 					/* now we found a free reader and we try to use it */
 					if (dev->config == NULL)
 					{
-						usb_close(dev_handle);
+						(void)usb_close(dev_handle);
 						DEBUG_CRITICAL3("No dev->config found for %s/%s",
 							 bus->dirname, dev->filename);
 						return STATUS_UNSUCCESSFUL;
@@ -381,7 +381,7 @@
 					usb_interface = get_ccid_usb_interface(dev);
 					if (usb_interface == NULL)
 					{
-						usb_close(dev_handle);
+						(void)usb_close(dev_handle);
 						DEBUG_CRITICAL3("Can't find a CCID interface on %s/%s",
 							bus->dirname, dev->filename);
 						return STATUS_UNSUCCESSFUL;
@@ -389,7 +389,7 @@
 
 					if (usb_interface->altsetting->extralen != 54)
 					{
-						usb_close(dev_handle);
+						(void)usb_close(dev_handle);
 						DEBUG_CRITICAL4("Extra field for %s/%s has a wrong length: %d", bus->dirname, dev->filename, usb_interface->altsetting->extralen);
 						return STATUS_UNSUCCESSFUL;
 					}
@@ -397,7 +397,7 @@
 					interface = usb_interface->altsetting->bInterfaceNumber;
 					if (usb_claim_interface(dev_handle, interface) < 0)
 					{
-						usb_close(dev_handle);
+						(void)usb_close(dev_handle);
 						DEBUG_CRITICAL4("Can't claim interface %s/%s: %s",
 							bus->dirname, dev->filename, strerror(errno));
 						return STATUS_UNSUCCESSFUL;
@@ -412,12 +412,12 @@
 					/* check for firmware bugs */
 					if (ccid_check_firmware(dev))
 					{
-						usb_close(dev_handle);
+						(void)usb_close(dev_handle);
 						return STATUS_UNSUCCESSFUL;
 					}
 
 					/* Get Endpoints values*/
-					get_end_points(dev, &usbDevice[reader_index]);
+					(void)get_end_points(dev, &usbDevice[reader_index]);
 
 					/* store device information */
 					usbDevice[reader_index].handle = dev_handle;
@@ -474,7 +474,7 @@
 	int rv;
 	char debug_header[] = "-> 121234 ";
 
-	sprintf(debug_header, "-> %06X ", (int)reader_index);
+	(void)sprintf(debug_header, "-> %06X ", (int)reader_index);
 
 	DEBUG_XXD(debug_header, buffer, length);
 
@@ -512,7 +512,7 @@
 	int duplicate_frame = 0;
 
 read_again:
-	sprintf(debug_header, "<- %06X ", (int)reader_index);
+	(void)sprintf(debug_header, "<- %06X ", (int)reader_index);
 
 	rv = usb_bulk_read(usbDevice[reader_index].handle,
 		usbDevice[reader_index].bulk_in, (char *)buffer, *length,
@@ -585,11 +585,11 @@
 
 		/* reset so that bSeq starts at 0 again */
 		if (DriverOptions & DRIVER_OPTION_RESET_ON_CLOSE)
-			usb_reset(usbDevice[reader_index].handle);
-
-		usb_release_interface(usbDevice[reader_index].handle,
+			(void)usb_reset(usbDevice[reader_index].handle);
+
+		(void)usb_release_interface(usbDevice[reader_index].handle,
 			usbDevice[reader_index].interface);
-		usb_close(usbDevice[reader_index].handle);
+		(void)usb_close(usbDevice[reader_index].handle);
 
 		free(usbDevice[reader_index].dirname);
 		free(usbDevice[reader_index].filename);

Modified: trunk/Drivers/ccid/src/commands.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/commands.c?rev=3268&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/commands.c (original)
+++ trunk/Drivers/ccid/src/commands.c Mon Jan  5 14:28:26 2009
@@ -860,7 +860,7 @@
 		if (status[0] & 0x40)
 		{
 			DEBUG_INFO2("Busy: 0x%02X", status[0]);
-			usleep(1000 * 10);
+			(void)usleep(1000 * 10);
 			goto again_status;
 		}
 
@@ -1194,7 +1194,7 @@
 				if (0 == delay)
 					/* host select the delay */
 					delay = 1;
-				usleep(delay * 1000 * 10);
+				(void)usleep(delay * 1000 * 10);
 				goto time_request_ICCD_B;
 			}
 

Modified: trunk/Drivers/ccid/src/debug.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/debug.c?rev=3268&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/debug.c (original)
+++ trunk/Drivers/ccid/src/debug.c Mon Jan  5 14:28:26 2009
@@ -40,11 +40,11 @@
 	va_list argptr;
 
 	va_start(argptr, fmt);
-	vsnprintf(DebugBuffer, DEBUG_BUF_SIZE, fmt, argptr);
+	(void)vsnprintf(DebugBuffer, DEBUG_BUF_SIZE, fmt, argptr);
 	va_end(argptr);
 
 #ifdef LOG_TO_STDERR
-	fprintf(stderr, "%s\n", DebugBuffer);
+	(void)fprintf(stderr, "%s\n", DebugBuffer);
 #endif
 } /* log_msg */
 
@@ -61,15 +61,15 @@
 
 	for (i = 0; (i < len) && (c < debug_buf_end); ++i)
 	{
-		sprintf(c, "%02X ", (unsigned char)buffer[i]);
+		(void)sprintf(c, "%02X ", (unsigned char)buffer[i]);
 		c += strlen(c);
 	}
 
 #ifdef LOG_TO_STDERR
 	if (c >= debug_buf_end)
-		fprintf(stderr, "Debug buffer too short\n");
+		(void)fprintf(stderr, "Debug buffer too short\n");
 
-	fprintf(stderr, "%s\n", DebugBuffer);
+	(void)fprintf(stderr, "%s\n", DebugBuffer);
 #endif
 } /* log_xxd */
 

Modified: trunk/Drivers/ccid/src/ifdhandler.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ifdhandler.c?rev=3268&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ifdhandler.c (original)
+++ trunk/Drivers/ccid/src/ifdhandler.c Mon Jan  5 14:28:26 2009
@@ -94,7 +94,7 @@
 	CcidSlots[reader_index].readerName = strdup(lpcDevice);
 
 #ifdef HAVE_PTHREAD
-	pthread_mutex_lock(&ifdh_context_mutex);
+	(void)pthread_mutex_lock(&ifdh_context_mutex);
 #endif
 
 	if (OpenPortByName(reader_index, lpcDevice) != STATUS_SUCCESS)
@@ -108,7 +108,7 @@
 	else
 	{
 		/* Maybe we have a special treatment for this reader */
-		ccid_open_hack(reader_index);
+		(void)ccid_open_hack(reader_index);
 
 		/* Try to access the reader */
 		/* This "warm up" sequence is sometimes needed when pcscd is
@@ -129,7 +129,7 @@
 	}
 
 #ifdef HAVE_PTHREAD
-	pthread_mutex_unlock(&ifdh_context_mutex);
+	(void)pthread_mutex_unlock(&ifdh_context_mutex);
 #endif
 
 	return return_value;
@@ -193,7 +193,7 @@
 	CcidSlots[reader_index].readerName = strdup("no name");
 
 #ifdef HAVE_PTHREAD
-	pthread_mutex_lock(&ifdh_context_mutex);
+	(void)pthread_mutex_lock(&ifdh_context_mutex);
 #endif
 
 	if (OpenPort(reader_index, Channel) != STATUS_SUCCESS)
@@ -206,10 +206,10 @@
 	}
 	else
 		/* Maybe we have a special treatment for this reader */
-		ccid_open_hack(reader_index);
+		(void)ccid_open_hack(reader_index);
 
 #ifdef HAVE_PTHREAD
-	pthread_mutex_unlock(&ifdh_context_mutex);
+	(void)pthread_mutex_unlock(&ifdh_context_mutex);
 #endif
 
 	return return_value;
@@ -243,7 +243,7 @@
 	/* No reader status check, if it failed, what can you do ? :) */
 
 #ifdef HAVE_PTHREAD
-	pthread_mutex_lock(&ifdh_context_mutex);
+	(void)pthread_mutex_lock(&ifdh_context_mutex);
 #endif
 
 	(void)ClosePort(reader_index);
@@ -253,7 +253,7 @@
 	memset(&CcidSlots[reader_index], 0, sizeof(CcidSlots[reader_index]));
 
 #ifdef HAVE_PTHREAD
-	pthread_mutex_unlock(&ifdh_context_mutex);
+	(void)pthread_mutex_unlock(&ifdh_context_mutex);
 #endif
 
 	return IFD_SUCCESS;
@@ -299,7 +299,7 @@
 	 * TAG_IFD_POLLING_THREAD_KILLABLE then we could use a much longer delay
 	 * and be killed before pcscd exits
 	 */
-	sleep(5);	/* 5 seconds */
+	(void)sleep(5);	/* 5 seconds */
 	return IFD_SUCCESS;
 }
 #endif
@@ -535,7 +535,8 @@
 		goto end;
 
 	/* Get ATR of the card */
-	ATR_InitFromArray(&atr, ccid_slot->pcATRBuffer, ccid_slot->nATRLength);
+	(void)ATR_InitFromArray(&atr, ccid_slot->pcATRBuffer,
+		ccid_slot->nATRLength);
 
 	/* Apply Extra EGT patch for bogus cards */
 	extra_egt(&atr, ccid_desc, Protocol);
@@ -574,13 +575,13 @@
 				if (0 == atr.ib[i][ATR_INTERFACE_BYTE_TC].value)
 				{
 					DEBUG_COMM("Use LRC");
-					t1_set_param(t1, IFD_PROTOCOL_T1_CHECKSUM_LRC, 0);
+					(void)t1_set_param(t1, IFD_PROTOCOL_T1_CHECKSUM_LRC, 0);
 				}
 				else
 					if (1 == atr.ib[i][ATR_INTERFACE_BYTE_TC].value)
 					{
 						DEBUG_COMM("Use CRC");
-						t1_set_param(t1, IFD_PROTOCOL_T1_CHECKSUM_CRC, 0);
+						(void)t1_set_param(t1, IFD_PROTOCOL_T1_CHECKSUM_CRC, 0);
 					}
 					else
 						DEBUG_COMM2("Wrong value for TCi: %d",
@@ -607,8 +608,8 @@
 			unsigned int default_baudrate;
 			double f, d;
 
-			ATR_GetParameter(&atr, ATR_PARAMETER_D, &d);
-			ATR_GetParameter(&atr, ATR_PARAMETER_F, &f);
+			(void)ATR_GetParameter(&atr, ATR_PARAMETER_D, &d);
+			(void)ATR_GetParameter(&atr, ATR_PARAMETER_F, &f);
 
 			/* may happen with non ISO cards */
 			if ((0 == f) || (0 == d))
@@ -670,8 +671,8 @@
 						/* use a lower TA1 */
 						atr.ib[0][ATR_INTERFACE_BYTE_TA].value--;
 
-						ATR_GetParameter(&atr, ATR_PARAMETER_D, &d);
-						ATR_GetParameter(&atr, ATR_PARAMETER_F, &f);
+						(void)ATR_GetParameter(&atr, ATR_PARAMETER_D, &d);
+						(void)ATR_GetParameter(&atr, ATR_PARAMETER_F, &f);
 
 						/* Baudrate = f x D/F */
 						card_baudrate = (unsigned int) (1000 *
@@ -750,7 +751,7 @@
 	}
 
 	/* Now we must set the reader parameters */
-	ATR_GetConvention(&atr, &convention);
+	(void)ATR_GetConvention(&atr, &convention);
 
 	/* specific mode and implicit parameters? (b5 of TA2) */
 	if (atr.ib[1][ATR_INTERFACE_BYTE_TA].present
@@ -803,8 +804,8 @@
 			}
 
 		/* compute communication timeout */
-		ATR_GetParameter(&atr, ATR_PARAMETER_F, &f);
-		ATR_GetParameter(&atr, ATR_PARAMETER_D, &d);
+		(void)ATR_GetParameter(&atr, ATR_PARAMETER_F, &f);
+		(void)ATR_GetParameter(&atr, ATR_PARAMETER_D, &d);
 		ccid_desc->readTimeout = T1_card_timeout(f, d, param[2],
 			(param[3] & 0xF0) >> 4 /* BWI */, param[3] & 0x0F /* CWI */,
 			ccid_desc->dwDefaultClock);
@@ -856,8 +857,8 @@
 			param[3] = atr.ib[1][ATR_INTERFACE_BYTE_TC].value;
 
 		/* compute communication timeout */
-		ATR_GetParameter(&atr, ATR_PARAMETER_F, &f);
-		ATR_GetParameter(&atr, ATR_PARAMETER_D, &d);
+		(void)ATR_GetParameter(&atr, ATR_PARAMETER_F, &f);
+		(void)ATR_GetParameter(&atr, ATR_PARAMETER_D, &d);
 
 		ccid_desc->readTimeout = T0_card_timeout(f, d, param[2] /* TC1 */,
 			param[3] /* TC2 */, ccid_desc->dwDefaultClock);
@@ -882,7 +883,7 @@
 			{
 				DEBUG_COMM3("IFSC (TA%d) present: %d", i+1,
 					atr.ib[i][ATR_INTERFACE_BYTE_TA].value);
-				t1_set_param(t1, IFD_PROTOCOL_T1_IFSC,
+				(void)t1_set_param(t1, IFD_PROTOCOL_T1_IFSC,
 					atr.ib[i][ATR_INTERFACE_BYTE_TA].value);
 
 				/* only the first TAi (i>2) must be used */
@@ -896,7 +897,7 @@
 			if (t1_negociate_ifsd(t1, 0, ccid_desc -> dwMaxIFSD) < 0)
 				return IFD_COMMUNICATION_ERROR;
 		}
-		t1_set_param(t1, IFD_PROTOCOL_T1_IFSD, ccid_desc -> dwMaxIFSD);
+		(void)t1_set_param(t1, IFD_PROTOCOL_T1_IFSD, ccid_desc -> dwMaxIFSD);
 
 		DEBUG_COMM3("T=1: IFSC=%d, IFSD=%d", t1->ifsc, t1->ifsd);
 	}
@@ -1032,7 +1033,7 @@
 			memcpy(CcidSlots[reader_index].pcATRBuffer, pcbuffer, *AtrLength);
 
 			/* initialise T=1 context */
-			t1_init(&(get_ccid_slot(reader_index) -> t1), reader_index);
+			(void)t1_init(&(get_ccid_slot(reader_index) -> t1), reader_index);
 			break;
 
 		default:
@@ -1379,7 +1380,7 @@
 	DEBUG_INFO("Driver version: " VERSION);
 
 	/* Info.plist full patch filename */
-	snprintf(infofile, sizeof(infofile), "%s/%s/Contents/Info.plist",
+	(void)snprintf(infofile, sizeof(infofile), "%s/%s/Contents/Info.plist",
 		PCSCLITE_HP_DROPDIR, BUNDLE);
 
 	/* Log level */
@@ -1462,8 +1463,8 @@
 	if (! atr->ib[0][ATR_INTERFACE_BYTE_TA].present)
 		return;
 
-	ATR_GetParameter(atr, ATR_PARAMETER_D, &d);
-	ATR_GetParameter(atr, ATR_PARAMETER_F, &f);
+	(void)ATR_GetParameter(atr, ATR_PARAMETER_D, &d);
+	(void)ATR_GetParameter(atr, ATR_PARAMETER_F, &f);
 
 	/* may happen with non ISO cards */
 	if ((0 == f) || (0 == d))

Modified: trunk/Drivers/ccid/src/parse.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/parse.c?rev=3268&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/parse.c (original)
+++ trunk/Drivers/ccid/src/parse.c Mon Jan  5 14:28:26 2009
@@ -66,13 +66,13 @@
 		class_ff = TRUE;
 
 	usb_init();
-	usb_find_busses();
-	usb_find_devices();
+	(void)usb_find_busses();
+	(void)usb_find_devices();
 
 	busses = usb_get_busses();
 	if (busses == NULL)
 	{
-		printf("No USB buses found\n");
+		(void)printf("No USB buses found\n");
 		return -1;
 	}
 
@@ -90,60 +90,60 @@
 			dev_handle = usb_open(dev);
 			if (NULL == dev_handle)
 			{
-				fprintf(stderr, "Can't usb_open(%s/%s): %s\n",
+				(void)fprintf(stderr, "Can't usb_open(%s/%s): %s\n",
 					bus->dirname, dev->filename, strerror(errno));
 				if (getuid())
 				{
-					fprintf(stderr, BRIGHT_RED "Please, restart the command as root\n" NORMAL);
+					(void)fprintf(stderr, BRIGHT_RED "Please, restart the command as root\n" NORMAL);
 					return 1;
 				}
 				continue;
 			}
 
-			fprintf(stderr, "Parsing USB bus/device: %s/%s\n",
+			(void)fprintf(stderr, "Parsing USB bus/device: %s/%s\n",
 				bus->dirname, dev->filename);
 
-			fprintf(stderr, " idVendor:  0x%04X", dev->descriptor.idVendor);
+			(void)fprintf(stderr, " idVendor:  0x%04X", dev->descriptor.idVendor);
 			if (usb_get_string_simple(dev_handle, dev->descriptor.iManufacturer,
 				buffer, sizeof(buffer)) < 0)
 			{
-				fprintf(stderr, "  Can't get iManufacturer string\n");
+				(void)fprintf(stderr, "  Can't get iManufacturer string\n");
 				if (getuid())
 				{
-					fprintf(stderr, BRIGHT_RED "Please, restart the command as root\n" NORMAL);
+					(void)fprintf(stderr, BRIGHT_RED "Please, restart the command as root\n" NORMAL);
 					return 1;
 				}
 			}
 			else
-				fprintf(stderr, "  iManufacturer: " BLUE "%s\n" NORMAL, buffer);
-
-			fprintf(stderr, " idProduct: 0x%04X", dev->descriptor.idProduct);
+				(void)fprintf(stderr, "  iManufacturer: " BLUE "%s\n" NORMAL, buffer);
+
+			(void)fprintf(stderr, " idProduct: 0x%04X", dev->descriptor.idProduct);
 			if (usb_get_string_simple(dev_handle, dev->descriptor.iProduct,
 				buffer, sizeof(buffer)) < 0)
-				fprintf(stderr, "  Can't get iProduct string\n");
+				(void)fprintf(stderr, "  Can't get iProduct string\n");
 			else
-				fprintf(stderr, "  iProduct: " BLUE "%s\n" NORMAL, buffer);
+				(void)fprintf(stderr, "  iProduct: " BLUE "%s\n" NORMAL, buffer);
 
 			/* check if the device has bInterfaceClass == 11 */
 			usb_interface = get_ccid_usb_interface(dev);
 			if (NULL == usb_interface)
 			{
-				usb_close(dev_handle);
-				fprintf(stderr, RED "  NOT a CCID/ICCD device\n" NORMAL);
+				(void)usb_close(dev_handle);
+				(void)fprintf(stderr, RED "  NOT a CCID/ICCD device\n" NORMAL);
 				continue;
 			}
 			if (!class_ff && (0xFF == usb_interface->altsetting->bInterfaceClass))
 			{
-				fprintf(stderr, MAGENTA "  Found a possibly CCID/ICCD device (bInterfaceClass = 0xFF). Use -p\n" NORMAL);
+				(void)fprintf(stderr, MAGENTA "  Found a possibly CCID/ICCD device (bInterfaceClass = 0xFF). Use -p\n" NORMAL);
 				continue;
 			}
-			fprintf(stderr, GREEN "  Found a CCID/ICCD device\n" NORMAL);
+			(void)fprintf(stderr, GREEN "  Found a CCID/ICCD device\n" NORMAL);
 
 			/* now we found a free reader and we try to use it */
 			if (NULL == dev->config)
 			{
-				usb_close(dev_handle);
-				fprintf(stderr, "No dev->config found for %s/%s\n",
+				(void)usb_close(dev_handle);
+				(void)fprintf(stderr, "No dev->config found for %s/%s\n",
 					 bus->dirname, dev->filename);
 				continue;
 			}
@@ -152,12 +152,12 @@
 #ifndef __APPLE__
 			if (usb_claim_interface(dev_handle, interface) < 0)
 			{
-				usb_close(dev_handle);
-				fprintf(stderr, "Can't claim interface %s/%s: %s\n",
+				(void)usb_close(dev_handle);
+				(void)fprintf(stderr, "Can't claim interface %s/%s: %s\n",
 						bus->dirname, dev->filename, strerror(errno));
 				if (EBUSY == errno)
 				{
-					fprintf(stderr,
+					(void)fprintf(stderr,
 						BRIGHT_RED " Please, stop pcscd and retry\n\n" NORMAL);
 					return TRUE;
 				}
@@ -165,18 +165,18 @@
 			}
 #endif
 
-			ccid_parse_interface_descriptor(dev_handle, dev);
+			(void)ccid_parse_interface_descriptor(dev_handle, dev);
 
 #ifndef __APPLE__
-			usb_release_interface(dev_handle, interface);
+			(void)usb_release_interface(dev_handle, interface);
 #endif
-			usb_close(dev_handle);
+			(void)usb_close(dev_handle);
 			nb++;
 		}
 	}
 
 	if ((0 == nb) && (0 != geteuid()))
-		fprintf(stderr, "Can't find any CCID device.\nMaybe you must run parse as root?\n");
+		(void)fprintf(stderr, "Can't find any CCID device.\nMaybe you must run parse as root?\n");
 	return 0;
 } /* main */
 
@@ -198,146 +198,146 @@
 	/*
 	 * Vendor/model name
 	 */
-	printf(" idVendor: 0x%04X\n", dev->descriptor.idVendor);
+	(void)printf(" idVendor: 0x%04X\n", dev->descriptor.idVendor);
 	if (usb_get_string_simple(handle, dev->descriptor.iManufacturer,
 		buffer, sizeof(buffer)) < 0)
 	{
-		printf("  Can't get iManufacturer string\n");
+		(void)printf("  Can't get iManufacturer string\n");
 		if (getuid())
 		{
-			fprintf(stderr,
+			(void)fprintf(stderr,
 				BRIGHT_RED "Please, restart the command as root\n\n" NORMAL);
 			return TRUE;
 		}
 	}
 	else
-		printf("  iManufacturer: %s\n", buffer);
-
-	printf(" idProduct: 0x%04X\n", dev->descriptor.idProduct);
+		(void)printf("  iManufacturer: %s\n", buffer);
+
+	(void)printf(" idProduct: 0x%04X\n", dev->descriptor.idProduct);
 	if (usb_get_string_simple(handle, dev->descriptor.iProduct,
 		buffer, sizeof(buffer)) < 0)
-		printf("  Can't get iProduct string\n");
+		(void)printf("  Can't get iProduct string\n");
 	else
-		printf("  iProduct: %s\n", buffer);
-
-	printf(" bcdDevice: %X.%02X (firmware release?)\n",
+		(void)printf("  iProduct: %s\n", buffer);
+
+	(void)printf(" bcdDevice: %X.%02X (firmware release?)\n",
 		dev->descriptor.bcdDevice >> 8, dev->descriptor.bcdDevice & 0xFF);
 
 	usb_interface = get_ccid_usb_interface(dev)->altsetting;
 
-	printf(" bLength: %d\n", usb_interface->bLength);
-
-	printf(" bDescriptorType: %d\n", usb_interface->bDescriptorType);
-
-	printf(" bInterfaceNumber: %d\n", usb_interface->bInterfaceNumber);
-
-	printf(" bAlternateSetting: %d\n", usb_interface->bAlternateSetting);
-
-	printf(" bNumEndpoints: %d\n", usb_interface->bNumEndpoints);
+	(void)printf(" bLength: %d\n", usb_interface->bLength);
+
+	(void)printf(" bDescriptorType: %d\n", usb_interface->bDescriptorType);
+
+	(void)printf(" bInterfaceNumber: %d\n", usb_interface->bInterfaceNumber);
+
+	(void)printf(" bAlternateSetting: %d\n", usb_interface->bAlternateSetting);
+
+	(void)printf(" bNumEndpoints: %d\n", usb_interface->bNumEndpoints);
 	switch (usb_interface->bNumEndpoints)
 	{
 		case 0:
-			printf("  Control only\n");
+			(void)printf("  Control only\n");
 			break;
 		case 1:
-			printf("  Interrupt-IN\n");
+			(void)printf("  Interrupt-IN\n");
 			break;
 		case 2:
-			printf("  bulk-IN and bulk-OUT\n");
+			(void)printf("  bulk-IN and bulk-OUT\n");
 			break;
 		case 3:
-			printf("  bulk-IN, bulk-OUT and Interrupt-IN\n");
+			(void)printf("  bulk-IN, bulk-OUT and Interrupt-IN\n");
 			break;
 		default:
-			printf("  UNKNOWN value\n");
-	}
-
-	printf(" bInterfaceClass: 0x%02X", usb_interface->bInterfaceClass);
+			(void)printf("  UNKNOWN value\n");
+	}
+
+	(void)printf(" bInterfaceClass: 0x%02X", usb_interface->bInterfaceClass);
 	if (usb_interface->bInterfaceClass == 0x0b)
-		printf(" [Chip Card Interface Device Class (CCID)]\n");
+		(void)printf(" [Chip Card Interface Device Class (CCID)]\n");
 	else
 	{
-		printf("\n  NOT A CCID DEVICE\n");
+		(void)printf("\n  NOT A CCID DEVICE\n");
 		if (usb_interface->bInterfaceClass != 0xFF)
 			return TRUE;
 		else
-			printf("  Class is 0xFF (proprietary)\n");
-	}
-
-	printf(" bInterfaceSubClass: %d\n", usb_interface->bInterfaceSubClass);
+			(void)printf("  Class is 0xFF (proprietary)\n");
+	}
+
+	(void)printf(" bInterfaceSubClass: %d\n", usb_interface->bInterfaceSubClass);
 	if (usb_interface->bInterfaceSubClass)
-		printf("  UNSUPPORTED SubClass\n");
-
-	printf(" bInterfaceProtocol: %d\n", usb_interface->bInterfaceProtocol);
+		(void)printf("  UNSUPPORTED SubClass\n");
+
+	(void)printf(" bInterfaceProtocol: %d\n", usb_interface->bInterfaceProtocol);
 	switch (usb_interface->bInterfaceProtocol)
 	{
 		case 0:
-			printf("  bulk transfer, optional interrupt-IN (CCID)\n");
+			(void)printf("  bulk transfer, optional interrupt-IN (CCID)\n");
 			break;
 		case 1:
-			printf("  ICCD Version A, Control transfers, (no interrupt-IN)\n");
+			(void)printf("  ICCD Version A, Control transfers, (no interrupt-IN)\n");
 			break;
 		case 2:
-			printf("  ICCD Version B, Control transfers, (optional interrupt-IN)\n");
+			(void)printf("  ICCD Version B, Control transfers, (optional interrupt-IN)\n");
 			break;
 		default:
-			printf("  UNSUPPORTED InterfaceProtocol\n");
-	}
-
-	printf(" iInterface: %d\n", usb_interface->iInterface);
+			(void)printf("  UNSUPPORTED InterfaceProtocol\n");
+	}
+
+	(void)printf(" iInterface: %d\n", usb_interface->iInterface);
 
 	if (usb_interface->extralen < 54)
 	{
-		printf("USB extra length is too short: %d\n", usb_interface->extralen);
-		printf("\n  NOT A CCID DEVICE\n");
+		(void)printf("USB extra length is too short: %d\n", usb_interface->extralen);
+		(void)printf("\n  NOT A CCID DEVICE\n");
 		return TRUE;
 	}
 
 	/*
 	 * CCID Class Descriptor
 	 */
-	printf(" CCID Class Descriptor\n");
+	(void)printf(" CCID Class Descriptor\n");
 	extra = usb_interface->extra;
 
-	printf("  bLength: 0x%02X\n", extra[0]);
+	(void)printf("  bLength: 0x%02X\n", extra[0]);
 	if (extra[0] != 0x36)
 	{
-		printf("   UNSUPPORTED bLength\n");
+		(void)printf("   UNSUPPORTED bLength\n");
 		return TRUE;
 	}
 
-	printf("  bDescriptorType: 0x%02X\n", extra[1]);
+	(void)printf("  bDescriptorType: 0x%02X\n", extra[1]);
 	if (extra[1] != 0x21)
 	{
 		if (0xFF == extra[1])
-			printf("   PROPRIETARY bDescriptorType\n");
+			(void)printf("   PROPRIETARY bDescriptorType\n");
 		else
 		{
-			printf("   UNSUPPORTED bDescriptorType\n");
+			(void)printf("   UNSUPPORTED bDescriptorType\n");
 			return TRUE;
 		}
 	}
 
-	printf("  bcdCCID: %X.%02X\n", extra[3], extra[2]);
-	printf("  bMaxSlotIndex: 0x%02X\n", extra[4]);
-	printf("  bVoltageSupport: 0x%02X\n", extra[5]);
+	(void)printf("  bcdCCID: %X.%02X\n", extra[3], extra[2]);
+	(void)printf("  bMaxSlotIndex: 0x%02X\n", extra[4]);
+	(void)printf("  bVoltageSupport: 0x%02X\n", extra[5]);
 	if (extra[5] & 0x01)
-		printf("   5.0V\n");
+		(void)printf("   5.0V\n");
 	if (extra[5] & 0x02)
-		printf("   3.0V\n");
+		(void)printf("   3.0V\n");
 	if (extra[5] & 0x04)
-		printf("   1.8V\n");
-
-	printf("  dwProtocols: 0x%02X%02X 0x%02X%02X\n", extra[9], extra[8],
+		(void)printf("   1.8V\n");
+
+	(void)printf("  dwProtocols: 0x%02X%02X 0x%02X%02X\n", extra[9], extra[8],
 		extra[7], extra[6]);
 	if (extra[6] & 0x01)
-		printf("   T=0\n");
+		(void)printf("   T=0\n");
 	if (extra[6] & 0x02)
-		printf("   T=1\n");
-
-	printf("  dwDefaultClock: %.3f MHz\n", dw2i(extra, 10)/1000.0);
-	printf("  dwMaximumClock: %.3f MHz\n", dw2i(extra, 14)/1000.0);
-	printf("  bNumClockSupported: %d %s\n", extra[18],
+		(void)printf("   T=1\n");
+
+	(void)printf("  dwDefaultClock: %.3f MHz\n", dw2i(extra, 10)/1000.0);
+	(void)printf("  dwMaximumClock: %.3f MHz\n", dw2i(extra, 14)/1000.0);
+	(void)printf("  bNumClockSupported: %d %s\n", extra[18],
 		extra[18] ? "" : "(will use whatever is returned)");
 	{
 		int n;
@@ -355,17 +355,17 @@
 		/* we got an error? */
 		if (n <= 0)
 		{
-			printf("   IFD does not support GET CLOCK FREQUENCIES request: %s\n", strerror(errno));
+			(void)(void)printf("   IFD does not support GET CLOCK FREQUENCIES request: %s\n", strerror(errno));
 			if (EBUSY == errno)
 			{
-				fprintf(stderr,
+				(void)fprintf(stderr,
 					BRIGHT_RED "   Please, stop pcscd and retry\n\n" NORMAL);
 				return TRUE;
 			}
 		}
 		else
 			if (n % 4) 	/* not a multiple of 4 */
-				printf("   wrong size for GET CLOCK FREQUENCIES: %d\n", n);
+				(void)printf("   wrong size for GET CLOCK FREQUENCIES: %d\n", n);
 			else
 			{
 				int i;
@@ -373,7 +373,7 @@
 				/* we do not get the expected number of data rates */
 				if ((n != extra[18]*4) && extra[18])
 				{
-					printf("   Got %d clock frequencies but was expecting %d\n",
+					(void)printf("   Got %d clock frequencies but was expecting %d\n",
 						n/4, extra[18]);
 
 					/* we got more data than expected */
@@ -382,12 +382,12 @@
 				}
 
 				for (i=0; i<n; i+=4)
-					printf("   Support %d kHz\n", dw2i(ubuffer, i));
-			}
-	}
-	printf("  dwDataRate: %d bps\n", dw2i(extra, 19));
-	printf("  dwMaxDataRate: %d bps\n", dw2i(extra, 23));
-	printf("  bNumDataRatesSupported: %d %s\n", extra[27],
+					(void)printf("   Support %d kHz\n", dw2i(ubuffer, i));
+			}
+	}
+	(void)printf("  dwDataRate: %d bps\n", dw2i(extra, 19));
+	(void)printf("  dwMaxDataRate: %d bps\n", dw2i(extra, 23));
+	(void)printf("  bNumDataRatesSupported: %d %s\n", extra[27],
 		extra[27] ? "" : "(will use whatever is returned)");
 	{
 		int n;
@@ -404,11 +404,11 @@
 
 		/* we got an error? */
 		if (n <= 0)
-			printf("   IFD does not support GET_DATA_RATES request: %s\n",
+			(void)printf("   IFD does not support GET_DATA_RATES request: %s\n",
 				strerror(errno));
 		else
 			if (n % 4) 	/* not a multiple of 4 */
-				printf("   wrong size for GET_DATA_RATES: %d\n", n);
+				(void)printf("   wrong size for GET_DATA_RATES: %d\n", n);
 			else
 			{
 				int i;
@@ -416,7 +416,7 @@
 				/* we do not get the expected number of data rates */
 				if ((n != extra[27]*4) && extra[27])
 				{
-					printf("   Got %d data rates but was expecting %d\n", n/4,
+					(void)printf("   Got %d data rates but was expecting %d\n", n/4,
 						extra[27]);
 
 					/* we got more data than expected */
@@ -425,92 +425,92 @@
 				}
 
 				for (i=0; i<n; i+=4)
-					printf("   Support %d bps\n", dw2i(ubuffer, i));
-			}
-	}
-	printf("  dwMaxIFSD: %d\n", dw2i(extra, 28));
-	printf("  dwSynchProtocols: 0x%08X\n", dw2i(extra, 32));
+					(void)printf("   Support %d bps\n", dw2i(ubuffer, i));
+			}
+	}
+	(void)printf("  dwMaxIFSD: %d\n", dw2i(extra, 28));
+	(void)printf("  dwSynchProtocols: 0x%08X\n", dw2i(extra, 32));
 	if (extra[32] & 0x01)
-			printf("   2-wire protocol\n");
+			(void)printf("   2-wire protocol\n");
 	if (extra[32] & 0x02)
-			printf("   3-wire protocol\n");
+			(void)printf("   3-wire protocol\n");
 	if (extra[32] & 0x04)
-			printf("   I2C protocol\n");
-
-	printf("  dwMechanical: 0x%08X\n", dw2i(extra, 36));
+			(void)printf("   I2C protocol\n");
+
+	(void)printf("  dwMechanical: 0x%08X\n", dw2i(extra, 36));
 	if (extra[36] == 0)
-		printf("   No special characteristics\n");
+		(void)printf("   No special characteristics\n");
 	if (extra[36] & 0x01)
-		printf("   Card accept mechanism\n");
+		(void)printf("   Card accept mechanism\n");
 	if (extra[36] & 0x02)
-		printf("   Card ejection mechanism\n");
+		(void)printf("   Card ejection mechanism\n");
 	if (extra[36] & 0x04)
-		printf("   Card capture mechanism\n");
+		(void)printf("   Card capture mechanism\n");
 	if (extra[36] & 0x08)
-		printf("   Card lock/unlock mechanism\n");
-
-	printf("  dwFeatures: 0x%08X\n", dw2i(extra, 40));
+		(void)printf("   Card lock/unlock mechanism\n");
+
+	(void)printf("  dwFeatures: 0x%08X\n", dw2i(extra, 40));
 	if (dw2i(extra, 40) == 0)
-		printf("   No special characteristics\n");
+		(void)printf("   No special characteristics\n");
 	if (extra[40] & 0x02)
-		printf("   ....02 Automatic parameter configuration based on ATR data\n");
+		(void)printf("   ....02 Automatic parameter configuration based on ATR data\n");
 	if (extra[40] & 0x04)
-		printf("   ....04 Automatic activation of ICC on inserting\n");
+		(void)printf("   ....04 Automatic activation of ICC on inserting\n");
 	if (extra[40] & 0x08)
-		printf("   ....08 Automatic ICC voltage selection\n");
+		(void)printf("   ....08 Automatic ICC voltage selection\n");
 	if (extra[40] & 0x10)
-		printf("   ....10 Automatic ICC clock frequency change according to parameters\n");
+		(void)printf("   ....10 Automatic ICC clock frequency change according to parameters\n");
 	if (extra[40] & 0x20)
-		printf("   ....20 Automatic baud rate change according to frequency and Fi, Di params\n");
+		(void)printf("   ....20 Automatic baud rate change according to frequency and Fi, Di params\n");
 	if (extra[40] & 0x40)
-		printf("   ....40 Automatic parameters negotiation made by the CCID\n");
+		(void)printf("   ....40 Automatic parameters negotiation made by the CCID\n");
 	if (extra[40] & 0x80)
-		printf("   ....80 Automatic PPS made by the CCID\n");
+		(void)printf("   ....80 Automatic PPS made by the CCID\n");
 	if (extra[41] & 0x01)
-		printf("   ..01.. CCID can set ICC in clock stop mode\n");
+		(void)printf("   ..01.. CCID can set ICC in clock stop mode\n");
 	if (extra[41] & 0x02)
-		printf("   ..02.. NAD value other than 00 accepted (T=1)\n");
+		(void)printf("   ..02.. NAD value other than 00 accepted (T=1)\n");
 	if (extra[41] & 0x04)
-		printf("   ..04.. Automatic IFSD exchange as first exchange (T=1)\n");
+		(void)printf("   ..04.. Automatic IFSD exchange as first exchange (T=1)\n");
 	if (extra[41] & 0x08)
-		printf("   ..08.. Unknown (ICCD?)\n");
+		(void)printf("   ..08.. Unknown (ICCD?)\n");
 	switch (extra[42] & 0x07)
 	{
 		case 0x00:
-			printf("   00.... Character level exchange\n");
+			(void)printf("   00.... Character level exchange\n");
 			break;
 
 		case 0x01:
-			printf("   01.... TPDU level exchange\n");
+			(void)printf("   01.... TPDU level exchange\n");
 			break;
 
 		case 0x02:
-			printf("   02.... Short APDU level exchange\n");
+			(void)printf("   02.... Short APDU level exchange\n");
 			break;
 
 		case 0x04:
-			printf("   04.... Short and Extended APDU level exchange\n");
-			break;
-	}
-
-	printf("  dwMaxCCIDMessageLength: %d bytes\n", dw2i(extra, 44));
-	printf("  bClassGetResponse: 0x%02X\n", extra[48]);
+			(void)printf("   04.... Short and Extended APDU level exchange\n");
+			break;
+	}
+
+	(void)printf("  dwMaxCCIDMessageLength: %d bytes\n", dw2i(extra, 44));
+	(void)printf("  bClassGetResponse: 0x%02X\n", extra[48]);
 	if (0xFF == extra[48])
-		printf("   echoes the APDU class\n");
-	printf("  bClassEnveloppe: 0x%02X\n", extra[49]);
+		(void)printf("   echoes the APDU class\n");
+	(void)printf("  bClassEnveloppe: 0x%02X\n", extra[49]);
 	if (0xFF == extra[49])
-		printf("   echoes the APDU class\n");
-	printf("  wLcdLayout: 0x%04X\n", (extra[51] << 8)+extra[50]);
+		(void)printf("   echoes the APDU class\n");
+	(void)printf("  wLcdLayout: 0x%04X\n", (extra[51] << 8)+extra[50]);
 	if (extra[50])
-		printf("   %d lines\n", extra[50]);
+		(void)printf("   %d lines\n", extra[50]);
 	if (extra[51])
-		printf("   %d characters per line\n", extra[51]);
-	printf("  bPINSupport: 0x%02X\n", extra[52]);
+		(void)printf("   %d characters per line\n", extra[51]);
+	(void)printf("  bPINSupport: 0x%02X\n", extra[52]);
 	if (extra[52] & 0x01)
-		printf("   PIN Verification supported\n");
+		(void)printf("   PIN Verification supported\n");
 	if (extra[52] & 0x02)
-		printf("   PIN Modification supported\n");
-	printf("  bMaxCCIDBusySlots: %d\n", extra[53]);
+		(void)printf("   PIN Modification supported\n");
+	(void)printf("  bMaxCCIDBusySlots: %d\n", extra[53]);
 
 	return FALSE;
 } /* ccid_parse_interface_descriptor */




More information about the Pcsclite-cvs-commit mailing list