wrapped |nsCOMPtr| vs. raw pointer comparisons in a |#ifndef| for |NSCAP_NSCOMPTR_TO_RAW_COMPARISONS_ARE_AMBIGUOUS| which is currently not defined. When an autoconf test defines this symbol, these operators will go away, and Linux will never be bit by the |nsCOMPtr| can't compare to a raw pointer error. Currently, there is no effect. r={mjudge,rginda}

This commit is contained in:
scc%netscape.com 2000-02-12 23:30:52 +00:00
Родитель 8e94846f15
Коммит 18df765f41
2 изменённых файлов: 90 добавлений и 50 удалений

Просмотреть файл

@ -913,7 +913,8 @@ getter_AddRefs( nsCOMPtr<T>& aSmartPtr )
}
class NSCAP_Zero;
// Comparing two |nsCOMPtr|s
template <class T, class U>
inline
@ -923,6 +924,20 @@ operator==( const nsCOMPtr<T>& lhs, const nsCOMPtr<U>& rhs )
return NS_STATIC_CAST(const void*, lhs.get()) == NS_STATIC_CAST(const void*, rhs.get());
}
template <class T, class U>
inline
NSCAP_BOOL
operator!=( const nsCOMPtr<T>& lhs, const nsCOMPtr<U>& rhs )
{
return NS_STATIC_CAST(const void*, lhs.get()) != NS_STATIC_CAST(const void*, rhs.get());
}
#ifndef NSCAP_NSCOMPTR_TO_RAW_COMPARISONS_ARE_AMBIGUOUS
// Comparing an |nsCOMPtr| to a raw pointer
template <class T, class U>
inline
NSCAP_BOOL
@ -939,6 +954,29 @@ operator==( const U* lhs, const nsCOMPtr<T>& rhs )
return NS_STATIC_CAST(const void*, lhs) == NS_STATIC_CAST(const void*, rhs.get());
}
template <class T, class U>
inline
NSCAP_BOOL
operator!=( const nsCOMPtr<T>& lhs, const U* rhs )
{
return NS_STATIC_CAST(const void*, lhs.get()) != NS_STATIC_CAST(const void*, rhs);
}
template <class T, class U>
inline
NSCAP_BOOL
operator!=( const U* lhs, const nsCOMPtr<T>& rhs )
{
return NS_STATIC_CAST(const void*, lhs) != NS_STATIC_CAST(const void*, rhs.get());
}
#endif // !defined(NSCAP_NSCOMPTR_TO_RAW_COMPARISONS_ARE_AMBIGUOUS)
// Comparing an |nsCOMPtr| to |0|
class NSCAP_Zero;
template <class T>
inline
NSCAP_BOOL
@ -957,30 +995,6 @@ operator==( NSCAP_Zero* lhs, const nsCOMPtr<T>& rhs )
return NS_REINTERPRET_CAST(const void*, lhs) == NS_STATIC_CAST(const void*, rhs.get());
}
template <class T, class U>
inline
NSCAP_BOOL
operator!=( const nsCOMPtr<T>& lhs, const nsCOMPtr<U>& rhs )
{
return NS_STATIC_CAST(const void*, lhs.get()) != NS_STATIC_CAST(const void*, rhs.get());
}
template <class T, class U>
inline
NSCAP_BOOL
operator!=( const nsCOMPtr<T>& lhs, const U* rhs )
{
return NS_STATIC_CAST(const void*, lhs.get()) != NS_STATIC_CAST(const void*, rhs);
}
template <class T, class U>
inline
NSCAP_BOOL
operator!=( const U* lhs, const nsCOMPtr<T>& rhs )
{
return NS_STATIC_CAST(const void*, lhs) != NS_STATIC_CAST(const void*, rhs.get());
}
template <class T>
inline
NSCAP_BOOL
@ -999,6 +1013,10 @@ operator!=( NSCAP_Zero* lhs, const nsCOMPtr<T>& rhs )
return NS_REINTERPRET_CAST(const void*, lhs) != NS_STATIC_CAST(const void*, rhs.get());
}
// Comparing any two [XP]COM objects for identity
inline
NSCAP_BOOL
SameCOMIdentity( nsISupports* lhs, nsISupports* rhs )
@ -1006,6 +1024,8 @@ SameCOMIdentity( nsISupports* lhs, nsISupports* rhs )
return nsCOMPtr<nsISupports>( do_QueryInterface(lhs) ) == nsCOMPtr<nsISupports>( do_QueryInterface(rhs) );
}
template <class SourceType, class DestinationType>
inline
nsresult

Просмотреть файл

@ -913,7 +913,8 @@ getter_AddRefs( nsCOMPtr<T>& aSmartPtr )
}
class NSCAP_Zero;
// Comparing two |nsCOMPtr|s
template <class T, class U>
inline
@ -923,6 +924,20 @@ operator==( const nsCOMPtr<T>& lhs, const nsCOMPtr<U>& rhs )
return NS_STATIC_CAST(const void*, lhs.get()) == NS_STATIC_CAST(const void*, rhs.get());
}
template <class T, class U>
inline
NSCAP_BOOL
operator!=( const nsCOMPtr<T>& lhs, const nsCOMPtr<U>& rhs )
{
return NS_STATIC_CAST(const void*, lhs.get()) != NS_STATIC_CAST(const void*, rhs.get());
}
#ifndef NSCAP_NSCOMPTR_TO_RAW_COMPARISONS_ARE_AMBIGUOUS
// Comparing an |nsCOMPtr| to a raw pointer
template <class T, class U>
inline
NSCAP_BOOL
@ -939,6 +954,29 @@ operator==( const U* lhs, const nsCOMPtr<T>& rhs )
return NS_STATIC_CAST(const void*, lhs) == NS_STATIC_CAST(const void*, rhs.get());
}
template <class T, class U>
inline
NSCAP_BOOL
operator!=( const nsCOMPtr<T>& lhs, const U* rhs )
{
return NS_STATIC_CAST(const void*, lhs.get()) != NS_STATIC_CAST(const void*, rhs);
}
template <class T, class U>
inline
NSCAP_BOOL
operator!=( const U* lhs, const nsCOMPtr<T>& rhs )
{
return NS_STATIC_CAST(const void*, lhs) != NS_STATIC_CAST(const void*, rhs.get());
}
#endif // !defined(NSCAP_NSCOMPTR_TO_RAW_COMPARISONS_ARE_AMBIGUOUS)
// Comparing an |nsCOMPtr| to |0|
class NSCAP_Zero;
template <class T>
inline
NSCAP_BOOL
@ -957,30 +995,6 @@ operator==( NSCAP_Zero* lhs, const nsCOMPtr<T>& rhs )
return NS_REINTERPRET_CAST(const void*, lhs) == NS_STATIC_CAST(const void*, rhs.get());
}
template <class T, class U>
inline
NSCAP_BOOL
operator!=( const nsCOMPtr<T>& lhs, const nsCOMPtr<U>& rhs )
{
return NS_STATIC_CAST(const void*, lhs.get()) != NS_STATIC_CAST(const void*, rhs.get());
}
template <class T, class U>
inline
NSCAP_BOOL
operator!=( const nsCOMPtr<T>& lhs, const U* rhs )
{
return NS_STATIC_CAST(const void*, lhs.get()) != NS_STATIC_CAST(const void*, rhs);
}
template <class T, class U>
inline
NSCAP_BOOL
operator!=( const U* lhs, const nsCOMPtr<T>& rhs )
{
return NS_STATIC_CAST(const void*, lhs) != NS_STATIC_CAST(const void*, rhs.get());
}
template <class T>
inline
NSCAP_BOOL
@ -999,6 +1013,10 @@ operator!=( NSCAP_Zero* lhs, const nsCOMPtr<T>& rhs )
return NS_REINTERPRET_CAST(const void*, lhs) != NS_STATIC_CAST(const void*, rhs.get());
}
// Comparing any two [XP]COM objects for identity
inline
NSCAP_BOOL
SameCOMIdentity( nsISupports* lhs, nsISupports* rhs )
@ -1006,6 +1024,8 @@ SameCOMIdentity( nsISupports* lhs, nsISupports* rhs )
return nsCOMPtr<nsISupports>( do_QueryInterface(lhs) ) == nsCOMPtr<nsISupports>( do_QueryInterface(rhs) );
}
template <class SourceType, class DestinationType>
inline
nsresult