From owner-p4-projects@FreeBSD.ORG Mon Jun 5 12:33:31 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id AA6D116AAE5; Mon, 5 Jun 2006 12:33:30 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6AEE216AAD6 for ; Mon, 5 Jun 2006 12:33:29 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2F83243D45 for ; Mon, 5 Jun 2006 12:33:29 +0000 (GMT) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k55CVjma072529 for ; Mon, 5 Jun 2006 12:31:45 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k55CVjKr072526 for perforce@freebsd.org; Mon, 5 Jun 2006 12:31:45 GMT (envelope-from hselasky@FreeBSD.org) Date: Mon, 5 Jun 2006 12:31:45 GMT Message-Id: <200606051231.k55CVjKr072526@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 98541 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jun 2006 12:33:33 -0000 http://perforce.freebsd.org/chv.cgi?CH=98541 Change 98541 by hselasky@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