PERFORCE change 98541 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Mon Jun 5 12:33:33 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=98541
Change 98541 by hselasky at hselasky_mini_itx on 2006/06/05 12:31:10
Allow HID to parse "const" data.
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb/usb_hid.c#2 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_hid.h#3 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb/usb_hid.c#2 (text+ko) ====
@@ -64,9 +64,9 @@
#define MAXUSAGE 100
struct hid_data {
- u_char *start;
- u_char *end;
- u_char *p;
+ const u_char *start;
+ const u_char *end;
+ const u_char *p;
struct hid_item cur;
int32_t usages[MAXUSAGE];
int nu;
@@ -93,13 +93,13 @@
}
struct hid_data *
-hid_start_parse(void *d, int len, int kindset)
+hid_start_parse(const void *d, int len, int kindset)
{
struct hid_data *s;
s = malloc(sizeof *s, M_TEMP, M_WAITOK|M_ZERO);
s->start = s->p = d;
- s->end = (char *)d + len;
+ s->end = ((const char *)d) + len;
s->kindset = kindset;
return (s);
}
@@ -122,9 +122,9 @@
struct hid_item *c = &s->cur;
unsigned int bTag, bType, bSize;
u_int32_t oldpos;
- u_char *data;
+ const u_char *data;
int32_t dval;
- u_char *p;
+ const u_char *p;
struct hid_item *hi;
int i;
@@ -366,7 +366,7 @@
}
int
-hid_report_size(void *buf, int len, enum hid_kind k, u_int8_t *idp)
+hid_report_size(const void *buf, int len, enum hid_kind k, u_int8_t *idp)
{
struct hid_data *d;
struct hid_item h;
@@ -395,7 +395,7 @@
}
int
-hid_locate(void *desc, int size, u_int32_t u, enum hid_kind k,
+hid_locate(const void *desc, int size, u_int32_t u, enum hid_kind k,
struct hid_location *loc, u_int32_t *flags)
{
struct hid_data *d;
@@ -417,7 +417,7 @@
}
u_long
-hid_get_data(u_char *buf, u_int32_t len, struct hid_location *loc)
+hid_get_data(const u_char *buf, u_int32_t len, struct hid_location *loc)
{
u_int hpos = loc->pos;
u_int hsize = loc->size;
@@ -448,7 +448,7 @@
}
int
-hid_is_collection(void *desc, int size, u_int32_t usage)
+hid_is_collection(const void *desc, int size, u_int32_t usage)
{
struct hid_data *hd;
struct hid_item hi;
==== //depot/projects/usb/src/sys/dev/usb/usb_hid.h#3 (text+ko) ====
@@ -226,7 +226,7 @@
};
extern struct hid_data *
-hid_start_parse(void *d, int len, int kindset);
+hid_start_parse(const void *d, int len, int kindset);
extern void
hid_end_parse(struct hid_data *s);
@@ -235,18 +235,18 @@
hid_get_item(struct hid_data *s, struct hid_item *h);
extern int
-hid_report_size(void *buf, int len, enum hid_kind k, u_int8_t *id);
+hid_report_size(const void *buf, int len, enum hid_kind k, u_int8_t *id);
extern int
-hid_locate(void *desc, int size, u_int32_t usage,
+hid_locate(const void *desc, int size, u_int32_t usage,
enum hid_kind kind, struct hid_location *loc,
u_int32_t *flags);
extern u_long
-hid_get_data(u_char *buf, u_int32_t len, struct hid_location *loc);
+hid_get_data(const u_char *buf, u_int32_t len, struct hid_location *loc);
extern int
-hid_is_collection(void *desc, int size, u_int32_t usage);
+hid_is_collection(const void *desc, int size, u_int32_t usage);
#endif
More information about the p4-projects
mailing list