Removing (HANDLE)NULL casts

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

 



Now that we compile Wine in STRICT mode we no longer need casts like
(HRGN)NULL or (HWND)0 (not that we ever really needed the latter).

So I propose to apply the following script which removes all these
unnecessary casts. I can also send the patch but with the script it's
quite unnecessary. Let me know if I should send it anyway (it's a mere
2200 lines).


#!/bin/sh

handles="HACCEL|HACMDRIVER|HACMDRIVERID|HACMOBJ|HACMSTREAM|HBITMAP|HBRUSH|HCOLORSPACE|HCONV|HCONVLIST|HDC|HDDEDATA|HDESK|HDROP|HDRVR|HENHMETAFILE|HFONT|HHOOK|HIC|HICON|HINSTANCE|HKEY|HKL|HMENU|HMETAFILE|HMIDI|HMIDIIN|HMIDIOUT|HMIDISTRM|HMIXER|HMIXEROBJ|HMMIO|HMONITOR|HPALETTE|HPEN|HRASCONN|HRGN|HRSRC|HSZ|HTASK|HWAVE|HWAVEIN|HWAVEOUT|HWINEVENTHOOK|HWINSTA|HWND|HOMDULE|HGDIOBJ|HGLOBAL|HLOCAL|GLOBALHANDLE|LOCALHANDLE|HCURSOR|HIMC|HIMCC|HUSKEY|HDRAWDIB|HDWP"

for file in `find . -name "*.c"`
do
    if egrep -q "\( *($handles) *\) *(NULL|0)" "$file"
    then
        echo "$file"
        perl -p -i.orig -e 's/\( *('$handles') *\) *(NULL|0(?!\w))/NULL/g' "$file"
    fi
done



-- 
Francois Gouget         fgouget@free.fr        http://fgouget.free.fr/
      Any sufficiently advanced bug is indistinguishable from a feature.
                            -- from some indian guy



[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux