From a08b523fc1f2413abfa8486ed42edbf4c14b8291 Mon Sep 17 00:00:00 2001 From: "bryner%brianryner.com" Date: Tue, 7 Oct 2003 20:43:34 +0000 Subject: [PATCH] Make nsCOMPtr operator== work correctly with multiple inheritance (bug 221316). r=dbaron, sr=darin. --- xpcom/glue/nsCOMPtr.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/xpcom/glue/nsCOMPtr.h b/xpcom/glue/nsCOMPtr.h index d5a5ee45b606..3faee3d86e6f 100644 --- a/xpcom/glue/nsCOMPtr.h +++ b/xpcom/glue/nsCOMPtr.h @@ -1141,7 +1141,7 @@ inline NSCAP_BOOL operator==( const nsCOMPtr& lhs, const nsCOMPtr& rhs ) { - return NS_STATIC_CAST(const void*, lhs.get()) == NS_STATIC_CAST(const void*, rhs.get()); + return NS_STATIC_CAST(const T*, lhs.get()) == NS_STATIC_CAST(const U*, rhs.get()); } @@ -1150,7 +1150,7 @@ inline NSCAP_BOOL operator!=( const nsCOMPtr& lhs, const nsCOMPtr& rhs ) { - return NS_STATIC_CAST(const void*, lhs.get()) != NS_STATIC_CAST(const void*, rhs.get()); + return NS_STATIC_CAST(const T*, lhs.get()) != NS_STATIC_CAST(const U*, rhs.get()); } @@ -1161,7 +1161,7 @@ inline NSCAP_BOOL operator==( const nsCOMPtr& lhs, const U* rhs ) { - return NS_STATIC_CAST(const void*, lhs.get()) == NS_STATIC_CAST(const void*, rhs); + return NS_STATIC_CAST(const T*, lhs.get()) == rhs; } template @@ -1169,7 +1169,7 @@ inline NSCAP_BOOL operator==( const U* lhs, const nsCOMPtr& rhs ) { - return NS_STATIC_CAST(const void*, lhs) == NS_STATIC_CAST(const void*, rhs.get()); + return lhs == NS_STATIC_CAST(const T*, rhs.get()); } template @@ -1177,7 +1177,7 @@ inline NSCAP_BOOL operator!=( const nsCOMPtr& lhs, const U* rhs ) { - return NS_STATIC_CAST(const void*, lhs.get()) != NS_STATIC_CAST(const void*, rhs); + return NS_STATIC_CAST(const T*, lhs.get()) != rhs; } template @@ -1185,7 +1185,7 @@ inline NSCAP_BOOL operator!=( const U* lhs, const nsCOMPtr& rhs ) { - return NS_STATIC_CAST(const void*, lhs) != NS_STATIC_CAST(const void*, rhs.get()); + return lhs != NS_STATIC_CAST(const T*, rhs.get()); } // To avoid ambiguities caused by the presence of builtin |operator==|s @@ -1208,7 +1208,7 @@ inline NSCAP_BOOL operator==( const nsCOMPtr& lhs, U* rhs ) { - return NS_STATIC_CAST(const void*, lhs.get()) == NS_STATIC_CAST(void*, rhs); + return NS_STATIC_CAST(const T*, lhs.get()) == NS_CONST_CAST(const U*, rhs); } template @@ -1216,7 +1216,7 @@ inline NSCAP_BOOL operator==( U* lhs, const nsCOMPtr& rhs ) { - return NS_STATIC_CAST(void*, lhs) == NS_STATIC_CAST(const void*, rhs.get()); + return NS_CONST_CAST(const U*, lhs) == NS_STATIC_CAST(const T*, rhs.get()); } template @@ -1224,7 +1224,7 @@ inline NSCAP_BOOL operator!=( const nsCOMPtr& lhs, U* rhs ) { - return NS_STATIC_CAST(const void*, lhs.get()) != NS_STATIC_CAST(void*, rhs); + return NS_STATIC_CAST(const T*, lhs.get()) != NS_CONST_CAST(const U*, rhs); } template @@ -1232,7 +1232,7 @@ inline NSCAP_BOOL operator!=( U* lhs, const nsCOMPtr& rhs ) { - return NS_STATIC_CAST(void*, lhs) != NS_STATIC_CAST(const void*, rhs.get()); + return NS_CONST_CAST(const U*, lhs) != NS_STATIC_CAST(const T*, rhs.get()); } #endif