[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: [v2 1/3] dinput: Print location ID in debugstr_device on the Mac
From:       DavidL <david.dljunk () gmail ! com>
Date:       2016-06-30 9:23:58
Message-ID: CAD6OkWkVXa56N70obfj1QiqomLsW4cYLKWYt4nqM4fMSRAT5xw () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Ah, okay ... I have a couple of other new helper functions, I should
probably make sure they are static as well. Thanks!

On Thursday, June 30, 2016, Dmitry Timoshkov <dmitry@baikal.ru> wrote:

> David Lawrie <david.dljunk@gmail.com <javascript:;>> wrote:
>
> > +static Boolean get_device_property_long(IOHIDDeviceRef in_device,
> CFStringRef in_key, long * out_value)
> > +{
> > +    Boolean result = FALSE;
> > +    CFTypeRef type;
> > +
> > +    if (in_device)
> > +    {
> > +        assert(IOHIDDeviceGetTypeID() == CFGetTypeID(in_device));
> > +
> > +        type = IOHIDDeviceGetProperty(in_device, in_key);
> > +
> > +        if (type)
> > +        {
> > +            if (CFNumberGetTypeID() == CFGetTypeID(type))
> > +                result = CFNumberGetValue((CFNumberRef)type,
> kCFNumberLongType, out_value);
> > +        }
> > +    }
> > +    return result;
> > +}
> > +
> > +long get_device_location_ID(IOHIDDeviceRef device)
> > +{
> > +    long result = 0;
> > +    get_device_property_long(device, CFSTR(kIOHIDLocationIDKey),
> &result);
> > +    return result;
> > +}
>
> The helper should be 'static'. Also, probably you should return value from
> the helper directly since you don't check for the boolean result anyway.
>
> Same comment applies for a similar winejoystick.drv patch.
>
> --
> Dmitry.
>

[Attachment #5 (text/html)]

Ah, okay ... I have a couple of  other new  helper functions, I should probably make \
sure they are static as well. Thanks!<br><br>On Thursday, June 30, 2016, Dmitry \
Timoshkov &lt;<a href="mailto:dmitry@baikal.ru">dmitry@baikal.ru</a>&gt; \
wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex">David Lawrie &lt;<a href="javascript:;" \
onclick="_e(event, &#39;cvml&#39;, \
&#39;david.dljunk@gmail.com&#39;)">david.dljunk@gmail.com</a>&gt; wrote:<br> <br>
&gt; +static Boolean get_device_property_long(IOHIDDeviceRef in_device, CFStringRef \
in_key, long * out_value)<br> &gt; +{<br>
&gt; +      Boolean result = FALSE;<br>
&gt; +      CFTypeRef type;<br>
&gt; +<br>
&gt; +      if (in_device)<br>
&gt; +      {<br>
&gt; +            assert(IOHIDDeviceGetTypeID() == CFGetTypeID(in_device));<br>
&gt; +<br>
&gt; +            type = IOHIDDeviceGetProperty(in_device, in_key);<br>
&gt; +<br>
&gt; +            if (type)<br>
&gt; +            {<br>
&gt; +                  if (CFNumberGetTypeID() == CFGetTypeID(type))<br>
&gt; +                        result = CFNumberGetValue((CFNumberRef)type, \
kCFNumberLongType, out_value);<br> &gt; +            }<br>
&gt; +      }<br>
&gt; +      return result;<br>
&gt; +}<br>
&gt; +<br>
&gt; +long get_device_location_ID(IOHIDDeviceRef device)<br>
&gt; +{<br>
&gt; +      long result = 0;<br>
&gt; +      get_device_property_long(device, CFSTR(kIOHIDLocationIDKey), \
&amp;result);<br> &gt; +      return result;<br>
&gt; +}<br>
<br>
The helper should be &#39;static&#39;. Also, probably you should return value \
from<br> the helper directly since you don&#39;t check for the boolean result \
anyway.<br> <br>
Same comment applies for a similar winejoystick.drv patch.<br>
<br>
--<br>
Dmitry.<br>
</blockquote>


[Attachment #6 (text/plain)]




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic