Add necessary code to get NEW_STRING_APIS to compile properly on gcc-2.7.2.3. r=scc

git-svn-id: svn://10.0.0.236/trunk@69488 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
waterson%netscape.com 2000-05-13 00:05:29 +00:00
parent c058edee4d
commit 8f9c2e72ae
2 changed files with 52 additions and 0 deletions

View File

@ -956,6 +956,7 @@ operator==( const nsCOMPtr<T>& lhs, const nsCOMPtr<U>& rhs )
return NS_STATIC_CAST(const void*, lhs.get()) == NS_STATIC_CAST(const void*, rhs.get());
}
#ifdef HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
template <class T, class U>
inline
NSCAP_BOOL
@ -963,6 +964,7 @@ operator!=( const nsCOMPtr<T>& lhs, const nsCOMPtr<U>& rhs )
{
return NS_STATIC_CAST(const void*, lhs.get()) != NS_STATIC_CAST(const void*, rhs.get());
}
#endif
@ -1046,6 +1048,30 @@ operator!=( NSCAP_Zero* lhs, const nsCOMPtr<T>& rhs )
}
#ifdef HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
// We need to explicitly define comparison operators for `int'
// because the compiler is lame.
template <class T>
inline
NSCAP_BOOL
operator==( const nsCOMPtr<T>& lhs, int rhs )
// specifically to allow |smartPtr == 0|
{
return NS_STATIC_CAST(const void*, lhs.get()) == NS_REINTERPRET_CAST(const void*, rhs);
}
template <class T>
inline
NSCAP_BOOL
operator==( int lhs, const nsCOMPtr<T>& rhs )
// specifically to allow |0 == smartPtr|
{
return NS_REINTERPRET_CAST(const void*, lhs) == NS_STATIC_CAST(const void*, rhs.get());
}
#endif // !defined(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
// Comparing any two [XP]COM objects for identity

View File

@ -956,6 +956,7 @@ operator==( const nsCOMPtr<T>& lhs, const nsCOMPtr<U>& rhs )
return NS_STATIC_CAST(const void*, lhs.get()) == NS_STATIC_CAST(const void*, rhs.get());
}
#ifdef HAVE_CPP_UNAMBIGUOUS_STD_NOTEQUAL
template <class T, class U>
inline
NSCAP_BOOL
@ -963,6 +964,7 @@ operator!=( const nsCOMPtr<T>& lhs, const nsCOMPtr<U>& rhs )
{
return NS_STATIC_CAST(const void*, lhs.get()) != NS_STATIC_CAST(const void*, rhs.get());
}
#endif
@ -1046,6 +1048,30 @@ operator!=( NSCAP_Zero* lhs, const nsCOMPtr<T>& rhs )
}
#ifdef HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
// We need to explicitly define comparison operators for `int'
// because the compiler is lame.
template <class T>
inline
NSCAP_BOOL
operator==( const nsCOMPtr<T>& lhs, int rhs )
// specifically to allow |smartPtr == 0|
{
return NS_STATIC_CAST(const void*, lhs.get()) == NS_REINTERPRET_CAST(const void*, rhs);
}
template <class T>
inline
NSCAP_BOOL
operator==( int lhs, const nsCOMPtr<T>& rhs )
// specifically to allow |0 == smartPtr|
{
return NS_REINTERPRET_CAST(const void*, lhs) == NS_STATIC_CAST(const void*, rhs.get());
}
#endif // !defined(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
// Comparing any two [XP]COM objects for identity