From cef66896ec09f8533046d2e09b2e84fcfeb10781 Mon Sep 17 00:00:00 2001 From: Eric Jiang Date: Sun, 14 Oct 2012 00:21:52 -0700 Subject: [PATCH] Made the number of valid scales a defined constant --- scales.h | 6 +++--- usbscale.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scales.h b/scales.h index 60a00ff..ac7c811 100644 --- a/scales.h +++ b/scales.h @@ -10,15 +10,15 @@ #include // -// **scalesc** should be kept updated with the length of the list. +// **NSCALES** should be kept updated with the length of the list. // -int scalesc = 3; +#define NSCALES 3 // // Scales // ------ // -uint16_t scales[3][2] = {\ +uint16_t scales[NSCALES][2] = {\ // Stamps.com Model 510 5LB Scale {0x1446, 0x6a73}, // USPS (Elane) PS311 "XM Elane Elane UParcel 30lb" diff --git a/usbscale.c b/usbscale.c index 001ea64..90bf46a 100644 --- a/usbscale.c +++ b/usbscale.c @@ -364,7 +364,7 @@ static libusb_device* find_scale(libusb_device **devs) return NULL; } int i; - for (i = 0; i < scalesc; i++) { + for (i = 0; i < NSCALES; i++) { if(desc.idVendor == scales[i][0] && desc.idProduct == scales[i][1]) { /*