Commit 5db4caee authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

urlmon: Don't use DEFINE_THIS2 for the Protocol vtbl functions.

parent 51d05e24
...@@ -50,12 +50,15 @@ static inline FtpProtocol *impl_from_IWinInetHttpInfo(IWinInetHttpInfo *iface) ...@@ -50,12 +50,15 @@ static inline FtpProtocol *impl_from_IWinInetHttpInfo(IWinInetHttpInfo *iface)
return CONTAINING_RECORD(iface, FtpProtocol, 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, static HRESULT FtpProtocol_open_request(Protocol *prot, IUri *uri, DWORD request_flags,
HINTERNET internet_session, IInternetBindInfo *bind_info) HINTERNET internet_session, IInternetBindInfo *bind_info)
{ {
FtpProtocol *This = ASYNCPROTOCOL_THIS(prot); FtpProtocol *This = impl_from_Protocol(prot);
BSTR url; BSTR url;
HRESULT hres; HRESULT hres;
...@@ -82,7 +85,7 @@ static HRESULT FtpProtocol_end_request(Protocol *prot) ...@@ -82,7 +85,7 @@ static HRESULT FtpProtocol_end_request(Protocol *prot)
static HRESULT FtpProtocol_start_downloading(Protocol *prot) static HRESULT FtpProtocol_start_downloading(Protocol *prot)
{ {
FtpProtocol *This = ASYNCPROTOCOL_THIS(prot); FtpProtocol *This = impl_from_Protocol(prot);
DWORD size; DWORD size;
BOOL res; BOOL res;
...@@ -104,8 +107,6 @@ static void FtpProtocol_on_error(Protocol *prot, DWORD error) ...@@ -104,8 +107,6 @@ static void FtpProtocol_on_error(Protocol *prot, DWORD error)
FIXME("(%p) %d - stub\n", prot, error); FIXME("(%p) %d - stub\n", prot, error);
} }
#undef ASYNCPROTOCOL_THIS
static const ProtocolVtbl AsyncProtocolVtbl = { static const ProtocolVtbl AsyncProtocolVtbl = {
FtpProtocol_open_request, FtpProtocol_open_request,
FtpProtocol_end_request, FtpProtocol_end_request,
......
...@@ -32,12 +32,15 @@ typedef struct { ...@@ -32,12 +32,15 @@ typedef struct {
#define PRIORITY(x) ((IInternetPriority*) &(x)->lpInternetPriorityVtbl) #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, static HRESULT GopherProtocol_open_request(Protocol *prot, IUri *uri, DWORD request_flags,
HINTERNET internet_session, IInternetBindInfo *bind_info) HINTERNET internet_session, IInternetBindInfo *bind_info)
{ {
GopherProtocol *This = ASYNCPROTOCOL_THIS(prot); GopherProtocol *This = impl_from_Protocol(prot);
BSTR url; BSTR url;
HRESULT hres; HRESULT hres;
...@@ -75,8 +78,6 @@ static void GopherProtocol_on_error(Protocol *prot, DWORD error) ...@@ -75,8 +78,6 @@ static void GopherProtocol_on_error(Protocol *prot, DWORD error)
FIXME("(%p) %d - stub\n", prot, error); FIXME("(%p) %d - stub\n", prot, error);
} }
#undef ASYNCPROTOCOL_THIS
static const ProtocolVtbl AsyncProtocolVtbl = { static const ProtocolVtbl AsyncProtocolVtbl = {
GopherProtocol_open_request, GopherProtocol_open_request,
GopherProtocol_end_request, GopherProtocol_end_request,
......
...@@ -122,12 +122,15 @@ static ULONG send_http_request(HttpProtocol *This) ...@@ -122,12 +122,15 @@ static ULONG send_http_request(HttpProtocol *This)
return res ? 0 : GetLastError(); 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, static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD request_flags,
HINTERNET internet_session, IInternetBindInfo *bind_info) HINTERNET internet_session, IInternetBindInfo *bind_info)
{ {
HttpProtocol *This = ASYNCPROTOCOL_THIS(prot); HttpProtocol *This = impl_from_Protocol(prot);
LPWSTR addl_header = NULL, post_cookie = NULL; LPWSTR addl_header = NULL, post_cookie = NULL;
IServiceProvider *service_provider = NULL; IServiceProvider *service_provider = NULL;
IHttpNegotiate2 *http_negotiate2 = NULL; IHttpNegotiate2 *http_negotiate2 = NULL;
...@@ -306,7 +309,7 @@ static HRESULT HttpProtocol_end_request(Protocol *protocol) ...@@ -306,7 +309,7 @@ static HRESULT HttpProtocol_end_request(Protocol *protocol)
static HRESULT HttpProtocol_start_downloading(Protocol *prot) static HRESULT HttpProtocol_start_downloading(Protocol *prot)
{ {
HttpProtocol *This = ASYNCPROTOCOL_THIS(prot); HttpProtocol *This = impl_from_Protocol(prot);
LPWSTR content_type, content_length, ranges; LPWSTR content_type, content_length, ranges;
DWORD len = sizeof(DWORD); DWORD len = sizeof(DWORD);
DWORD status_code; DWORD status_code;
...@@ -374,7 +377,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot) ...@@ -374,7 +377,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot)
static void HttpProtocol_close_connection(Protocol *prot) static void HttpProtocol_close_connection(Protocol *prot)
{ {
HttpProtocol *This = ASYNCPROTOCOL_THIS(prot); HttpProtocol *This = impl_from_Protocol(prot);
if(This->http_negotiate) { if(This->http_negotiate) {
IHttpNegotiate_Release(This->http_negotiate); IHttpNegotiate_Release(This->http_negotiate);
...@@ -393,8 +396,6 @@ static void HttpProtocol_on_error(Protocol *prot, DWORD error) ...@@ -393,8 +396,6 @@ static void HttpProtocol_on_error(Protocol *prot, DWORD error)
FIXME("(%p) %d - stub\n", prot, error); FIXME("(%p) %d - stub\n", prot, error);
} }
#undef ASYNCPROTOCOL_THIS
static const ProtocolVtbl AsyncProtocolVtbl = { static const ProtocolVtbl AsyncProtocolVtbl = {
HttpProtocol_open_request, HttpProtocol_open_request,
HttpProtocol_end_request, HttpProtocol_end_request,
......
...@@ -62,8 +62,7 @@ extern LONG URLMON_refCount; ...@@ -62,8 +62,7 @@ extern LONG URLMON_refCount;
static inline void URLMON_LockModule(void) { InterlockedIncrement( &URLMON_refCount ); } static inline void URLMON_LockModule(void) { InterlockedIncrement( &URLMON_refCount ); }
static inline void URLMON_UnlockModule(void) { InterlockedDecrement( &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) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
#define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
IInternetProtocolInfo *get_protocol_info(LPCWSTR); IInternetProtocolInfo *get_protocol_info(LPCWSTR);
HRESULT get_protocol_handler(IUri*,CLSID*,BOOL*,IClassFactory**); HRESULT get_protocol_handler(IUri*,CLSID*,BOOL*,IClassFactory**);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment