Hello Corinna, yeah, windowsx.h header is always a fun ...
2012/7/24 Corinna Vinschen <[email protected]>: > Hi, > > in preparation of the upcoming __MSABI_LONG patch, I'm spending some > time trying to avoid the macro where it's not necessary. For instance, > constants which have a cast anyway don't have to use the 'L' modifier. > Part of it is also to unify casting constant parameters, typically 0 or > 0L, in macros calling SendMessage (aka SNDMSG, MCIWndSM, AVICapSM) and > its ilk ICSendMessage. > > The below patch is probably just a start. Please review especially > vfw.h and windowsx.h, since their macros can be very confusing. > > > Thanks, > Corinna > > > * wmiatlprov.h (CInstanceProviderHelper::CheckInstancePath): > Cast first parameter in call to GetInfo to ULONG. > * winioctl.h (IsDsmActionNonDestructive): Replace test for == 0L > with logical negation operator. > * wininet.h (INTERNET_INVALID_STATUS_CALLBACK): Drop 'L' modifier. > * lmaccess.h (DEF_MIN_PWAGE): Ditto. > * mmsystem.h (MEVT_EVENTPARM): Ditto. > * svrapi.h (FRK_INIT): Ditto. > * vfw.h: Throughout, cast all constants in calls to SendMessage and > ICSendMessage to the expected type. > * prsht.h: Ditto, in calls to SendMessage and PostMessage. > * winuser.h: Ditto, in calls to CreateWindowEx, CreateDialogParam, > CreateDialogIndirectParam, DialogBoxParam, and DialogBoxIndirectParam. > * commctrl.h: Ditto, in calls to SendMessage. > (LPSTR_TEXTCALLBACKA): Drop 'L' modifier. > (LPSTR_TEXTCALLBACKW): Ditto. > * windowsx.h: Throughout, cast all constants in calls to SendMessage > and as return value from HANDLE_xxx macro. > (IsRestored): Replace test for == 0L with logical negation operator. > > > Index: svrapi.h > =================================================================== Changes in svrapi.h is ok. In commctrl.h are the following nits: > @@ -2128,8 +2128,8 @@ > > #define LVITEM_V1_SIZE __MINGW_NAME_AW_EXT(LVITEM,_V1_SIZE) > > -#define LPSTR_TEXTCALLBACKW ((LPWSTR)-1L) > -#define LPSTR_TEXTCALLBACKA ((LPSTR)-1L) > +#define LPSTR_TEXTCALLBACKW ((LPWSTR)-1) > +#define LPSTR_TEXTCALLBACKA ((LPSTR)-1) Hmm, as we have here pointer-casts, I would suggest to use here instead a cast via INT_PTR type. There was already an issue before, and this fixes warnings about pointer-size and avoids wrong code. Changes in winioctl.h have the following nit: > -#define IsDsmActionNonDestructive(x) ((BOOLEAN)(((x) & > DeviceDsmActionFlag_NonDestructive) != 0L)) > +#define IsDsmActionNonDestructive(x) ((BOOLEAN)(!((x) & > DeviceDsmActionFlag_NonDestructive))) This is a != 0, therefore it has to be !! and not just a single not. Changes in wmiatlprov.h, vfw.h, windowsx.h, and winuser.h are ok. Changes in dxtmpl.h header have the following nit. > @@ -20,7 +20,7 @@ > typedef void *DXLISTPOS; > typedef DWORD DXLISTHANDLE; > > -#define DX_BEFORE_START_POSITION ((void*)-1L) > +#define DX_BEFORE_START_POSITION ((void*)-1) we should use here explicit cast to INT_PTR before casting to void. (same as above). The changes in lmaccess.h are ok, but this is a candidate for the __LONG32 changes. In wininet.h we have the same issue about casting to a pointer. We should go via cast to INT_PTR to it. > WINBOOL fAllowSession; > } CookieDecision; > > -#define INTERNET_INVALID_STATUS_CALLBACK ((INTERNET_STATUS_CALLBACK)(-1L)) > +#define INTERNET_INVALID_STATUS_CALLBACK ((INTERNET_STATUS_CALLBACK)-1) > > #define FTP_TRANSFER_TYPE_UNKNOWN 0x00000000 > #define FTP_TRANSFER_TYPE_ASCII 0x00000001 Changes in mmsystem.h, and prsht.h are ok. Regards, Kai ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
