aboutsummaryrefslogtreecommitdiff
path: root/hw/usb/ccid-card-passthru.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2018-06-25 09:42:27 -0300
committerPaolo Bonzini <pbonzini@redhat.com>2018-07-02 15:41:16 +0200
commit246e195b521b02860914754fd39f7809f96be67f (patch)
tree5d0dd75278d9f6316fd09bda81d9b1af600de593 /hw/usb/ccid-card-passthru.c
parent872a2b7c4dcad2d4fa2bd34747c37a28a76cec2b (diff)
downloadqemu-246e195b521b02860914754fd39f7809f96be67f.zip
qemu-246e195b521b02860914754fd39f7809f96be67f.tar.gz
qemu-246e195b521b02860914754fd39f7809f96be67f.tar.bz2
hw/usb: Use the IEC binary prefix definitions
It eases code review, unit is explicit. Patch generated using: $ git grep -E '(1024|2048|4096|8192|(<<|>>).?(10|20|30))' hw/ include/hw/ and modified manually. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20180625124238.25339-36-f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/usb/ccid-card-passthru.c')
-rw-r--r--hw/usb/ccid-card-passthru.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c
index 25fb19b..0a6c657 100644
--- a/hw/usb/ccid-card-passthru.c
+++ b/hw/usb/ccid-card-passthru.c
@@ -9,6 +9,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/units.h"
#include <libcacard.h>
#include "chardev/char-fe.h"
#include "qemu/error-report.h"
@@ -40,7 +41,7 @@ static const uint8_t DEFAULT_ATR[] = {
0x13, 0x08
};
-#define VSCARD_IN_SIZE 65536
+#define VSCARD_IN_SIZE (64 * KiB)
/* maximum size of ATR - from 7816-3 */
#define MAX_ATR_SIZE 40
@@ -275,9 +276,9 @@ static void ccid_card_vscard_read(void *opaque, const uint8_t *buf, int size)
VSCMsgHeader *hdr;
if (card->vscard_in_pos + size > VSCARD_IN_SIZE) {
- error_report(
- "no room for data: pos %d + size %d > %d. dropping connection.",
- card->vscard_in_pos, size, VSCARD_IN_SIZE);
+ error_report("no room for data: pos %u + size %d > %" PRId64 "."
+ " dropping connection.",
+ card->vscard_in_pos, size, VSCARD_IN_SIZE);
ccid_card_vscard_drop_connection(card);
return;
}