aboutsummaryrefslogtreecommitdiff
path: root/lib/libusb/libusb20_desc.c
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2012-04-20 14:29:45 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2012-04-20 14:29:45 +0000
commitd81535d1f9a824d38814cef6af3aa0267741a99f (patch)
tree7bba82ab4db6a05960a26e4d19378f7bd40ea21c /lib/libusb/libusb20_desc.c
parentdd952f80bc74a4803ce96737608cdcde379c2186 (diff)
downloadsrc-d81535d1f9a824d38814cef6af3aa0267741a99f.tar.gz
src-d81535d1f9a824d38814cef6af3aa0267741a99f.zip
Fix some compile warnings.
MFC after: 1 week
Notes
Notes: svn path=/head/; revision=234491
Diffstat (limited to 'lib/libusb/libusb20_desc.c')
-rw-r--r--lib/libusb/libusb20_desc.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libusb/libusb20_desc.c b/lib/libusb/libusb20_desc.c
index 0781067be78b..e2fa5b55c95b 100644
--- a/lib/libusb/libusb20_desc.c
+++ b/lib/libusb/libusb20_desc.c
@@ -69,7 +69,7 @@ libusb20_parse_config_desc(const void *config_desc)
uint16_t niface_no_alt;
uint16_t niface;
uint16_t nendpoint;
- uint8_t iface_no;
+ uint16_t iface_no;
ptr = config_desc;
if (ptr[1] != LIBUSB20_DT_CONFIG) {
@@ -82,7 +82,7 @@ libusb20_parse_config_desc(const void *config_desc)
niface_no_alt = 0;
nendpoint = 0;
niface = 0;
- iface_no = 0 - 1;
+ iface_no = 0xFFFF;
ptr = NULL;
/* get "wTotalLength" and setup "pcdesc" */
@@ -155,7 +155,7 @@ libusb20_parse_config_desc(const void *config_desc)
/* reset states */
niface = 0;
- iface_no = 0 - 1;
+ iface_no = 0xFFFF;
ptr = NULL;
lub_interface--;
lub_endpoint--;
@@ -450,7 +450,7 @@ libusb20_me_encode(void *ptr, uint16_t len, const void *pd)
* and should be
* correct:
*/
- ps->len = 0 - 1;
+ ps->len = 0xFFFF;
}
src_len = libusb20_me_get_1(pd, 0);
src_ptr = LIBUSB20_ADD_BYTES(ps->ptr, 1);
@@ -465,7 +465,7 @@ libusb20_me_encode(void *ptr, uint16_t len, const void *pd)
case LIBUSB20_ME_IS_DECODED:
/* reserve 3 length bytes */
src_len = libusb20_me_encode(NULL,
- 0 - 1 - 3, ps->ptr);
+ 0xFFFF - 3, ps->ptr);
src_ptr = NULL;
break;
@@ -476,7 +476,7 @@ libusb20_me_encode(void *ptr, uint16_t len, const void *pd)
}
if (src_len > 0xFE) {
- if (src_len > (uint16_t)(0 - 1 - 3))
+ if (src_len > (0xFFFF - 3))
/* overflow */
goto done;
@@ -516,7 +516,7 @@ libusb20_me_encode(void *ptr, uint16_t len, const void *pd)
uint16_t dummy;
dummy = libusb20_me_encode(buf,
- 0 - 1 - 3, ps->ptr);
+ 0xFFFF - 3, ps->ptr);
} else {
bcopy(src_ptr, buf, src_len);
}