Re: ole32: Remove casts

2007-02-08 Thread Mike McCormack


Robert Shearman wrote:

Ref counts can be assumed to be between 0 and MAXLONG, so the fact 
that LONG is signed isn't important.


NO. The DCOM spec says that STDOBJREF::cPublicRefs is unsigned, 
therefore the ref counts can be assumed to be up to MAXULONG. Therefore, 
this change is incorrect and it would lead to subtle signedness errors.


Do you have a specific example of these errors?

The only operations that are done (and should be done) on ref counts are 
initialization, InterlockedIncrement and InterlockedDecrement.  asm 
generated will be exactly the same.


In the highly unlikely case that the refcount passes MAXLONG, the 
behaviour will still be correct, but if refcounts are getting up that 
high, then you need to start worrying about them wrapping around to zero 
anyway.


Casts are more problematic than the problems that you're imagining.

Mike




Re: ole32: Remove casts

2007-02-07 Thread Robert Shearman

Mike McCormack wrote:

---
This is the way ref counting is done everywhere else in Wine.

Ref counts can be assumed to be between 0 and MAXLONG, so the fact 
that LONG is signed isn't important.


NO. The DCOM spec says that STDOBJREF::cPublicRefs is unsigned, 
therefore the ref counts can be assumed to be up to MAXULONG. Therefore, 
this change is incorrect and it would lead to subtle signedness errors.




Casting ULONG* to LONG* to solve the above problem is unnecessary.




--
Rob Shearman