Made the number of valid scales a defined constant

pull/3/head
Eric Jiang 12 years ago
parent 5acc91ec4f
commit cef66896ec

@ -10,15 +10,15 @@
#include <stdint.h> #include <stdint.h>
// //
// **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 // Scales
// ------ // ------
// //
uint16_t scales[3][2] = {\ uint16_t scales[NSCALES][2] = {\
// Stamps.com Model 510 5LB Scale // Stamps.com Model 510 5LB Scale
{0x1446, 0x6a73}, {0x1446, 0x6a73},
// USPS (Elane) PS311 "XM Elane Elane UParcel 30lb" // USPS (Elane) PS311 "XM Elane Elane UParcel 30lb"

@ -364,7 +364,7 @@ static libusb_device* find_scale(libusb_device **devs)
return NULL; return NULL;
} }
int i; int i;
for (i = 0; i < scalesc; i++) { for (i = 0; i < NSCALES; i++) {
if(desc.idVendor == scales[i][0] && if(desc.idVendor == scales[i][0] &&
desc.idProduct == scales[i][1]) { desc.idProduct == scales[i][1]) {
/* /*

Loading…
Cancel
Save