Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libusbhid Fix a size calculation bug.



details:   https://anonhg.NetBSD.org/src/rev/9279fdf5b1c0
branches:  trunk
changeset: 519887:9279fdf5b1c0
user:      augustss <augustss%NetBSD.org@localhost>
date:      Sat Dec 29 20:44:22 2001 +0000

description:
Fix a size calculation bug.

diffstat:

 lib/libusbhid/parse.c |  18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

diffs (61 lines):

diff -r 06cabb2af8b2 -r 9279fdf5b1c0 lib/libusbhid/parse.c
--- a/lib/libusbhid/parse.c     Sat Dec 29 20:24:37 2001 +0000
+++ b/lib/libusbhid/parse.c     Sat Dec 29 20:44:22 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.1 2001/12/28 17:45:27 augustss Exp $       */
+/*     $NetBSD: parse.c,v 1.2 2001/12/29 20:44:22 augustss Exp $       */
 
 /*
  * Copyright (c) 1999, 2001 Lennart Augustsson <augustss%netbsd.org@localhost>
@@ -51,7 +51,6 @@
        int multimax;
        int kindset;
        int reportid;
-       int lastreportid;
 
        /*
         * The start of collection item has no report ID set, so save
@@ -64,7 +63,7 @@
         *  Assumes that hid_input, hid_output and hid_feature have
         *  values 0, 1 and 2.
         */
-        unsigned int kindpos[3];
+       unsigned int kindpos[3];
 };
 
 static int min(int x, int y) { return x < y ? x : y; }
@@ -103,7 +102,6 @@
        s->end = d->data + d->size;
        s->kindset = kindset;
        s->reportid = id;
-       s->lastreportid = -1;
        s->hassavedcoll = 0;
        return (s);
 }
@@ -131,15 +129,8 @@
                r = hid_get_item_raw(s, h);
                if (r <= 0)
                        break;
-               if (h->report_ID == s->reportid || s->reportid == -1) {
-                       if (s->lastreportid != s->reportid) {
-                               s->lastreportid = s->reportid;
-                               s->kindpos[hid_input] =
-                                    s->kindpos[hid_output] =
-                                    s->kindpos[hid_feature] = 0;
-                       }
+               if (h->report_ID == s->reportid || s->reportid == -1)
                        break;
-               }
        }
        return (r);
 }
@@ -356,6 +347,9 @@
                                break;
                        case 8:
                                c->report_ID = dval;
+                               s->kindpos[hid_input] =
+                                   s->kindpos[hid_output] =
+                                   s->kindpos[hid_feature] = 0;
                                break;
                        case 9:
                                c->report_count = dval;



Home | Main Index | Thread Index | Old Index