Re: quartz: update ICOM_THIS_MULTI to follow the new COM standard

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: quartz: update ICOM_THIS_MULTI to follow the new COM standard

Jacek Caban-3
On 03/30/12 17:55, Aric Stewart wrote:

> diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h
> index 35cd52b..d2f680c 100644
> --- a/dlls/quartz/quartz_private.h
> +++ b/dlls/quartz/quartz_private.h
> @@ -38,7 +38,7 @@
>  #define BYTES_FROM_MEDIATIME(time) SEC_FROM_MEDIATIME(time)
>  #define MSEC_FROM_MEDIATIME(time) ((time) / 10000)
>  
> -#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
> +#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=CONTAINING_RECORD(iface, impl, field)

These should disappear once the clean up of affected code is done.

Cheers,
Jacek


Reply | Threaded
Open this post in threaded view
|

Re: quartz: update ICOM_THIS_MULTI to follow the new COM standard

Aric Stewart
Meaning that I should not shift TO using that macro instead shift AWAY
from using it?

I have been doing some cleanup and been shifting to using it more.

-aric

On 3/30/12 11:08 AM, Jacek Caban wrote:

> On 03/30/12 17:55, Aric Stewart wrote:
>> diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h
>> index 35cd52b..d2f680c 100644
>> --- a/dlls/quartz/quartz_private.h
>> +++ b/dlls/quartz/quartz_private.h
>> @@ -38,7 +38,7 @@
>>   #define BYTES_FROM_MEDIATIME(time) SEC_FROM_MEDIATIME(time)
>>   #define MSEC_FROM_MEDIATIME(time) ((time) / 10000)
>>
>> -#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
>> +#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=CONTAINING_RECORD(iface, impl, field)
>
> These should disappear once the clean up of affected code is done.
>
> Cheers,
> Jacek


Reply | Threaded
Open this post in threaded view
|

Re: quartz: update ICOM_THIS_MULTI to follow the new COM standard

Jacek Caban-3
On 03/30/12 18:09, Aric Stewart wrote:
> Meaning that I should not shift TO using that macro instead shift AWAY
> from using it?
>
> I have been doing some cleanup and been shifting to using it more.

ICOM_THIS_MULTI macro should go away. Your patch made ICOM_THIS_MULTI
look a bit better by using CONTAINING_RECORD, but there is not much
point in doing it, since ICOM_THIS_MULTI should be completely removed.


Cheers,
Jacek


Reply | Threaded
Open this post in threaded view
|

Re: quartz: update ICOM_THIS_MULTI to follow the new COM standard

Aric Stewart
ok thanks,

Glad I got this feedback before I started submitting my com cleanup
patches that used it.

-aric

On 3/30/12 11:26 AM, Jacek Caban wrote:

> On 03/30/12 18:09, Aric Stewart wrote:
>> Meaning that I should not shift TO using that macro instead shift AWAY
>> from using it?
>>
>> I have been doing some cleanup and been shifting to using it more.
>
> ICOM_THIS_MULTI macro should go away. Your patch made ICOM_THIS_MULTI
> look a bit better by using CONTAINING_RECORD, but there is not much
> point in doing it, since ICOM_THIS_MULTI should be completely removed.
>
>
> Cheers,
> Jacek


Reply | Threaded
Open this post in threaded view
|

Re: quartz: update ICOM_THIS_MULTI to follow the new COM standard

John Klehm
In reply to this post by Jacek Caban-3
On Fri, Mar 30, 2012 at 11:08 AM, Jacek Caban <[hidden email]> wrote:

> On 03/30/12 17:55, Aric Stewart wrote:
>> diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h
>> index 35cd52b..d2f680c 100644
>> --- a/dlls/quartz/quartz_private.h
>> +++ b/dlls/quartz/quartz_private.h
>> @@ -38,7 +38,7 @@
>>  #define BYTES_FROM_MEDIATIME(time) SEC_FROM_MEDIATIME(time)
>>  #define MSEC_FROM_MEDIATIME(time) ((time) / 10000)
>>
>> -#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
>> +#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=CONTAINING_RECORD(iface, impl, field)
>
> These should disappear once the clean up of affected code is done.
>


Just for my own curiosity, I assume these pages are the preferred way?

http://wiki.winehq.org/COMGuideline
http://wiki.winehq.org/ComCleanup


Reply | Threaded
Open this post in threaded view
|

Re: quartz: update ICOM_THIS_MULTI to follow the new COM standard

Jacek Caban-3
On 3/31/12 3:36 PM, John Klehm wrote:

> On Fri, Mar 30, 2012 at 11:08 AM, Jacek Caban<[hidden email]>  wrote:
>> On 03/30/12 17:55, Aric Stewart wrote:
>>> diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h
>>> index 35cd52b..d2f680c 100644
>>> --- a/dlls/quartz/quartz_private.h
>>> +++ b/dlls/quartz/quartz_private.h
>>> @@ -38,7 +38,7 @@
>>>   #define BYTES_FROM_MEDIATIME(time) SEC_FROM_MEDIATIME(time)
>>>   #define MSEC_FROM_MEDIATIME(time) ((time) / 10000)
>>>
>>> -#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
>>> +#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=CONTAINING_RECORD(iface, impl, field)
>> These should disappear once the clean up of affected code is done.
>>
>
> Just for my own curiosity, I assume these pages are the preferred way?
>
> http://wiki.winehq.org/COMGuideline
> http://wiki.winehq.org/ComCleanup

Yes, that's the preferred way.

Jacek