Use fixed width integer types for parsing the binary hid data.

PR:		usb/146367
Submitted by:	Hans Petter Selasky
This commit is contained in:
Andrew Thompson 2010-05-13 02:03:00 +00:00
parent be73c87b5c
commit ff7ad950be
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=208023
2 changed files with 9 additions and 6 deletions

View file

@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include "usbhid.h"
int
int32_t
hid_get_data(const void *p, const hid_item_t *h)
{
const uint8_t *buf;
@ -78,12 +78,15 @@ hid_get_data(const void *p, const hid_item_t *h)
}
void
hid_set_data(void *p, const hid_item_t *h, int data)
hid_set_data(void *p, const hid_item_t *h, int32_t data)
{
uint8_t *buf;
uint32_t hpos;
uint32_t hsize;
int i, end, offs, mask;
uint32_t mask;
int i;
int end;
int offs;
buf = p;

View file

@ -29,7 +29,7 @@
*
*/
#include <sys/types.h>
#include <stdint.h>
typedef struct report_desc *report_desc_t;
@ -102,7 +102,7 @@ int hid_parse_usage_in_page(const char *name);
int hid_parse_usage_page(const char *name);
/* Extracting/insertion of data, data.c: */
int hid_get_data(const void *p, const hid_item_t *h);
void hid_set_data(void *p, const hid_item_t *h, int data);
int32_t hid_get_data(const void *p, const hid_item_t *h);
void hid_set_data(void *p, const hid_item_t *h, int32_t data);
__END_DECLS