Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

handling event.longValue in HID queue callback



In the docs, the following code is shown inside an IOHIDCallbackFunction:

// Only intersted in 32 values right now
if ((event.longValueSize != 0) && (event.longValue != NULL))
{
    free(event.longValue);
    continue;
}

What if longValueSize != 0, but longValue == NULL?

Is it appropriate to assume that if event.longValueSize is non-zero,
event.value can be disregarded?

If so, wouldn't it make more sense for the code to be written as follows?

if (event.longValueSize != 0) {
    if (event.longValue != NULL) {
        free(event.longValue);
    }
    break;
}


Thanks,

Andrew
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.