Removing (HANDLE)NULL casts (2)

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

 



On Thu, 28 Nov 2002, Francois Gouget wrote:

>
> 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).

A few handle types escaped the script the first time around. So here is
an updated version that will catch them. The updated version will also
catch casts of NULL to LP{C,W,wC}STR and LPVOID.
Actually this looks like it could be a job for winapi_check...

So Alexandre, just run the script when you feel like it. It should
result in a 700-800 line diff. Alternately, let me know if you prefer
that I send a patch.

Changelog:

 * misc files

   Remove (POINTER)NULL casts


#!/bin/sh

#egrep "\(( *HANDLE|HWND|HFONT|HICON|H) *\) *(NULL|0)" `find . -name "*.c"` | more

pointers="GLOBALHANDLE|HACCEL|HACMDRIVER|HACMDRIVERID|HACMOBJ|HACMSTREAM|HANDLE|HBITMAP|HBRUSH|HCALL|HCOLORSPACE|HCONV|HCONVLIST|HCURSOR|HDC|HDDEDATA|HDESK|HDRAWDIB|HDROP|HDRVR|HDWP|HENHMETAFILE|HGDIOBJ|HGLOBAL|HFONT|HHOOK|HIC|HICON|HINSTANCE|HKEY|HKL|HLINE|HLINEAPP|HLOCAL|HMENU|HMETAFILE|HMIDI|HMIDIIN|HMIDIOUT|HMIDISTRM|HMIXER|HMIXEROBJ|HMMIO|HMODULE|HMONITOR|HPALETTE|HPEN|HPHONE|HPHONEAPP|HRASCONN|HRGN|HRSRC|HSZ|HTASK|HUSKEY|HWAVE|HWAVEIN|HWAVEOUT|HWINEVENTHOOK|HWINSTA|HWND|LOCALHANDLE|LPCSTR|LPCWSTR|LPSTR|LPVOID|LPWSTR|SC_HANDLE"

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



-- 
Francois Gouget         fgouget@free.fr        http://fgouget.free.fr/
                            $live{free} || die "";



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

  Powered by Linux