Michael Stefaniuc : urlmon: Don' t use DEFINE_THIS2 for the Protocol vtbl functions.
Module: wine Branch: master Commit: 5db4caee8ea79d0817e44cded0928d64f768535b URL: http://source.winehq.org/git/wine.git/?a=commit;h=5db4caee8ea79d0817e44cded0... Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Tue Jan 4 10:59:54 2011 +0100 urlmon: Don't use DEFINE_THIS2 for the Protocol vtbl functions. --- dlls/urlmon/ftp.c | 11 ++++++----- dlls/urlmon/gopher.c | 9 +++++---- dlls/urlmon/http.c | 13 +++++++------ dlls/urlmon/urlmon_main.h | 3 +-- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/dlls/urlmon/ftp.c b/dlls/urlmon/ftp.c index 854f169..c9d43b8 100644 --- a/dlls/urlmon/ftp.c +++ b/dlls/urlmon/ftp.c @@ -50,12 +50,15 @@ static inline FtpProtocol *impl_from_IWinInetHttpInfo(IWinInetHttpInfo *iface) return CONTAINING_RECORD(iface, FtpProtocol, IWinInetHttpInfo_iface); } -#define ASYNCPROTOCOL_THIS(iface) DEFINE_THIS2(FtpProtocol, base, iface) +static inline FtpProtocol *impl_from_Protocol(Protocol *prot) +{ + return CONTAINING_RECORD(prot, FtpProtocol, base); +} static HRESULT FtpProtocol_open_request(Protocol *prot, IUri *uri, DWORD request_flags, HINTERNET internet_session, IInternetBindInfo *bind_info) { - FtpProtocol *This = ASYNCPROTOCOL_THIS(prot); + FtpProtocol *This = impl_from_Protocol(prot); BSTR url; HRESULT hres; @@ -82,7 +85,7 @@ static HRESULT FtpProtocol_end_request(Protocol *prot) static HRESULT FtpProtocol_start_downloading(Protocol *prot) { - FtpProtocol *This = ASYNCPROTOCOL_THIS(prot); + FtpProtocol *This = impl_from_Protocol(prot); DWORD size; BOOL res; @@ -104,8 +107,6 @@ static void FtpProtocol_on_error(Protocol *prot, DWORD error) FIXME("(%p) %d - stub\n", prot, error); } -#undef ASYNCPROTOCOL_THIS - static const ProtocolVtbl AsyncProtocolVtbl = { FtpProtocol_open_request, FtpProtocol_end_request, diff --git a/dlls/urlmon/gopher.c b/dlls/urlmon/gopher.c index 5964882..0058836 100644 --- a/dlls/urlmon/gopher.c +++ b/dlls/urlmon/gopher.c @@ -32,12 +32,15 @@ typedef struct { #define PRIORITY(x) ((IInternetPriority*) &(x)->lpInternetPriorityVtbl) -#define ASYNCPROTOCOL_THIS(iface) DEFINE_THIS2(GopherProtocol, base, iface) +static inline GopherProtocol *impl_from_Protocol(Protocol *prot) +{ + return CONTAINING_RECORD(prot, GopherProtocol, base); +} static HRESULT GopherProtocol_open_request(Protocol *prot, IUri *uri, DWORD request_flags, HINTERNET internet_session, IInternetBindInfo *bind_info) { - GopherProtocol *This = ASYNCPROTOCOL_THIS(prot); + GopherProtocol *This = impl_from_Protocol(prot); BSTR url; HRESULT hres; @@ -75,8 +78,6 @@ static void GopherProtocol_on_error(Protocol *prot, DWORD error) FIXME("(%p) %d - stub\n", prot, error); } -#undef ASYNCPROTOCOL_THIS - static const ProtocolVtbl AsyncProtocolVtbl = { GopherProtocol_open_request, GopherProtocol_end_request, diff --git a/dlls/urlmon/http.c b/dlls/urlmon/http.c index a62323b..7904229 100644 --- a/dlls/urlmon/http.c +++ b/dlls/urlmon/http.c @@ -122,12 +122,15 @@ static ULONG send_http_request(HttpProtocol *This) return res ? 0 : GetLastError(); } -#define ASYNCPROTOCOL_THIS(iface) DEFINE_THIS2(HttpProtocol, base, iface) +static inline HttpProtocol *impl_from_Protocol(Protocol *prot) +{ + return CONTAINING_RECORD(prot, HttpProtocol, base); +} static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD request_flags, HINTERNET internet_session, IInternetBindInfo *bind_info) { - HttpProtocol *This = ASYNCPROTOCOL_THIS(prot); + HttpProtocol *This = impl_from_Protocol(prot); LPWSTR addl_header = NULL, post_cookie = NULL; IServiceProvider *service_provider = NULL; IHttpNegotiate2 *http_negotiate2 = NULL; @@ -306,7 +309,7 @@ static HRESULT HttpProtocol_end_request(Protocol *protocol) static HRESULT HttpProtocol_start_downloading(Protocol *prot) { - HttpProtocol *This = ASYNCPROTOCOL_THIS(prot); + HttpProtocol *This = impl_from_Protocol(prot); LPWSTR content_type, content_length, ranges; DWORD len = sizeof(DWORD); DWORD status_code; @@ -374,7 +377,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot) static void HttpProtocol_close_connection(Protocol *prot) { - HttpProtocol *This = ASYNCPROTOCOL_THIS(prot); + HttpProtocol *This = impl_from_Protocol(prot); if(This->http_negotiate) { IHttpNegotiate_Release(This->http_negotiate); @@ -393,8 +396,6 @@ static void HttpProtocol_on_error(Protocol *prot, DWORD error) FIXME("(%p) %d - stub\n", prot, error); } -#undef ASYNCPROTOCOL_THIS - static const ProtocolVtbl AsyncProtocolVtbl = { HttpProtocol_open_request, HttpProtocol_end_request, diff --git a/dlls/urlmon/urlmon_main.h b/dlls/urlmon/urlmon_main.h index 719c2eb..e47faf5 100644 --- a/dlls/urlmon/urlmon_main.h +++ b/dlls/urlmon/urlmon_main.h @@ -62,8 +62,7 @@ extern LONG URLMON_refCount; static inline void URLMON_LockModule(void) { InterlockedIncrement( &URLMON_refCount ); } static inline void URLMON_UnlockModule(void) { InterlockedDecrement( &URLMON_refCount ); } -#define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc))) -#define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface) +#define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl))) IInternetProtocolInfo *get_protocol_info(LPCWSTR); HRESULT get_protocol_handler(IUri*,CLSID*,BOOL*,IClassFactory**);
participants (1)
-
Alexandre Julliard