whitspace cleanups.

This commit is contained in:
Solomon Peachy 2016-01-24 16:59:56 -05:00
parent 8e35e5608b
commit 52e4b827cd
2 changed files with 18 additions and 19 deletions

View File

@ -74,7 +74,7 @@ static char *get_device_id(struct libusb_device_handle *dev)
ERROR("Memory allocation failure (%d bytes)\n", ID_BUF_SIZE+1); ERROR("Memory allocation failure (%d bytes)\n", ID_BUF_SIZE+1);
return NULL; return NULL;
} }
if (libusb_kernel_driver_active(dev, iface)) if (libusb_kernel_driver_active(dev, iface))
libusb_detach_kernel_driver(dev, iface); libusb_detach_kernel_driver(dev, iface);
@ -100,10 +100,10 @@ static char *get_device_id(struct libusb_device_handle *dev)
if (length > ID_BUF_SIZE || length < 14) if (length > ID_BUF_SIZE || length < 14)
length = (((unsigned)buf[1] & 255) << 8) | length = (((unsigned)buf[1] & 255) << 8) |
((unsigned)buf[0] & 255); ((unsigned)buf[0] & 255);
if (length > ID_BUF_SIZE) if (length > ID_BUF_SIZE)
length = ID_BUF_SIZE; length = ID_BUF_SIZE;
if (length < 14) { if (length < 14) {
*buf = '\0'; *buf = '\0';
goto done; goto done;
@ -212,7 +212,7 @@ int read_data(struct libusb_device_handle *dev, uint8_t endp,
if (dyesub_debug) { if (dyesub_debug) {
DEBUG("Received %d bytes from printer\n", *readlen); DEBUG("Received %d bytes from printer\n", *readlen);
} }
if ((dyesub_debug > 1 && buflen < 4096) || if ((dyesub_debug > 1 && buflen < 4096) ||
dyesub_debug > 2) { dyesub_debug > 2) {
int i = *readlen; int i = *readlen;
@ -295,7 +295,7 @@ static char *sanitize_string(char *str) {
return str; return str;
} }
/* /*
These functions are Public Domain code obtained from: These functions are Public Domain code obtained from:
@ -318,13 +318,13 @@ static char *url_encode(char *str) {
ERROR("Memory allocation failure (%d bytes)\n", (int) strlen(str)*3 + 1); ERROR("Memory allocation failure (%d bytes)\n", (int) strlen(str)*3 + 1);
return NULL; return NULL;
} }
while (*pstr) { while (*pstr) {
if (isalnum(*pstr) || *pstr == '-' || *pstr == '_' || *pstr == '.' || *pstr == '~') if (isalnum(*pstr) || *pstr == '-' || *pstr == '_' || *pstr == '.' || *pstr == '~')
*pbuf++ = *pstr; *pbuf++ = *pstr;
else if (*pstr == ' ') else if (*pstr == ' ')
*pbuf++ = '+'; *pbuf++ = '+';
else else
*pbuf++ = '%', *pbuf++ = to_hex(*pstr >> 4), *pbuf++ = to_hex(*pstr & 15); *pbuf++ = '%', *pbuf++ = to_hex(*pstr >> 4), *pbuf++ = to_hex(*pstr & 15);
pstr++; pstr++;
} }
@ -345,7 +345,7 @@ static char *url_decode(char *str) {
*pbuf++ = from_hex(pstr[1]) << 4 | from_hex(pstr[2]); *pbuf++ = from_hex(pstr[1]) << 4 | from_hex(pstr[2]);
pstr += 2; pstr += 2;
} }
} else if (*pstr == '+') { } else if (*pstr == '+') {
*pbuf++ = ' '; *pbuf++ = ' ';
} else { } else {
*pbuf++ = *pstr; *pbuf++ = *pstr;
@ -439,7 +439,7 @@ static int print_scan_output(struct libusb_device *device,
free(product2); free(product2);
return -1; return -1;
} }
sprintf(descr, "%s %s", manuf3, product2); sprintf(descr, "%s %s", manuf3, product2);
free(product2); free(product2);
free(manuf3); free(manuf3);
@ -499,7 +499,7 @@ static int print_scan_output(struct libusb_device *device,
if (dyesub_debug) if (dyesub_debug)
DEBUG("VID: %04X PID: %04X Manuf: '%s' Product: '%s' Serial: '%s'\n", DEBUG("VID: %04X PID: %04X Manuf: '%s' Product: '%s' Serial: '%s'\n",
desc->idVendor, desc->idProduct, manuf, product, serial); desc->idVendor, desc->idProduct, manuf, product, serial);
if (scan_only) { if (scan_only) {
int k = 0; int k = 0;
@ -516,7 +516,7 @@ static int print_scan_output(struct libusb_device *device,
descr, descr, descr, descr,
ieee_id? ieee_id : ""); ieee_id? ieee_id : "");
} }
/* If a serial number was passed down, use it. */ /* If a serial number was passed down, use it. */
if (match_serno && strcmp(match_serno, (char*)serial)) { if (match_serno && strcmp(match_serno, (char*)serial)) {
found = -1; found = -1;
@ -630,7 +630,6 @@ static int find_and_enumerate(struct libusb_context *ctx,
static struct dyesub_backend *find_backend(char *uri_prefix) static struct dyesub_backend *find_backend(char *uri_prefix)
{ {
int i; int i;
if (!uri_prefix) if (!uri_prefix)
return NULL; return NULL;
@ -682,7 +681,7 @@ void print_help(char *argv0, struct dyesub_backend *backend)
if (!backend) if (!backend)
backend = find_backend(ptr); backend = find_backend(ptr);
if (!backend) { if (!backend) {
int i; int i;
DEBUG("Environment variables:\n"); DEBUG("Environment variables:\n");
@ -729,7 +728,7 @@ void print_help(char *argv0, struct dyesub_backend *backend)
libusb_exit(ctx); libusb_exit(ctx);
} }
int main (int argc, char **argv) int main (int argc, char **argv)
{ {
struct libusb_context *ctx = NULL; struct libusb_context *ctx = NULL;
struct libusb_device **list = NULL; struct libusb_device **list = NULL;
@ -830,7 +829,7 @@ int main (int argc, char **argv)
/* Always enable fast return in CUPS mode */ /* Always enable fast return in CUPS mode */
fast_return++; fast_return++;
} else { } else {
/* Standalone mode */ /* Standalone mode */
/* Try to guess backend from executable name */ /* Try to guess backend from executable name */
if (!backend) { if (!backend) {
@ -841,7 +840,7 @@ int main (int argc, char **argv)
ptr = argv[0]; ptr = argv[0];
backend = find_backend(ptr); backend = find_backend(ptr);
} }
srand(getpid()); srand(getpid());
jobid = rand(); jobid = rand();
} }

View File

@ -109,9 +109,9 @@ enum {
P_SONY_UPCR10, P_SONY_UPCR10,
P_MITSU_D70X, P_MITSU_D70X,
P_MITSU_D80, P_MITSU_D80,
P_MITSU_K60, P_MITSU_K60,
P_MITSU_9550, P_MITSU_9550,
P_MITSU_9550S, P_MITSU_9550S,
P_DNP_DS40, P_DNP_DS40,
P_DNP_DS80, P_DNP_DS80,
P_DNP_DS80D, P_DNP_DS80D,