mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 11:26:09 +00:00
change |CallQueryInterface| to handle situations where |nsISupports| is ambiguous.
This commit is contained in:
parent
a04bdb34e3
commit
470c0f17ac
@ -531,16 +531,16 @@ getter_AddRefs( nsCOMPtr<T>& aSmartPtr )
|
||||
|
||||
|
||||
|
||||
template <class T>
|
||||
template <class SourceType, class DestinationType>
|
||||
inline
|
||||
nsresult
|
||||
CallQueryInterface( nsISupports* aSource, nsCOMPtr<T>* aDestination )
|
||||
CallQueryInterface( SourceType* aSource, nsCOMPtr<DestinationType>* aDestination )
|
||||
// a type-safe shortcut for calling the |QueryInterface()| member function
|
||||
{
|
||||
NS_PRECONDITION(aSource, "null parameter");
|
||||
NS_PRECONDITION(aDestination, "null parameter");
|
||||
|
||||
return aSource->QueryInterface(T::GetIID(), getter_AddRefs(*aDestination));
|
||||
return aSource->QueryInterface(DestinationType::GetIID(), getter_AddRefs(*aDestination));
|
||||
}
|
||||
|
||||
|
||||
|
@ -558,18 +558,19 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
|
||||
// exists in "nsCOMPtr.h" for use with |nsCOMPtr|s.
|
||||
|
||||
extern "C++" {
|
||||
// ...because some one is accidentally including this file inside an |extern "C"|
|
||||
|
||||
class nsISupports;
|
||||
|
||||
template <class T>
|
||||
template <class SourceType, class DestinationType>
|
||||
inline
|
||||
nsresult
|
||||
CallQueryInterface( nsISupports* aSource, T** aDestination )
|
||||
CallQueryInterface( SourceType* aSource, DestinationType** aDestination )
|
||||
// a type-safe shortcut for calling the |QueryInterface()| member function
|
||||
{
|
||||
NS_PRECONDITION(aSource, "null parameter");
|
||||
|
||||
return aSource->QueryInterface(T::GetIID(), aDestination);
|
||||
return aSource->QueryInterface(DestinationType::GetIID(), aDestination);
|
||||
}
|
||||
|
||||
} // extern "C++"
|
||||
|
@ -531,16 +531,16 @@ getter_AddRefs( nsCOMPtr<T>& aSmartPtr )
|
||||
|
||||
|
||||
|
||||
template <class T>
|
||||
template <class SourceType, class DestinationType>
|
||||
inline
|
||||
nsresult
|
||||
CallQueryInterface( nsISupports* aSource, nsCOMPtr<T>* aDestination )
|
||||
CallQueryInterface( SourceType* aSource, nsCOMPtr<DestinationType>* aDestination )
|
||||
// a type-safe shortcut for calling the |QueryInterface()| member function
|
||||
{
|
||||
NS_PRECONDITION(aSource, "null parameter");
|
||||
NS_PRECONDITION(aDestination, "null parameter");
|
||||
|
||||
return aSource->QueryInterface(T::GetIID(), getter_AddRefs(*aDestination));
|
||||
return aSource->QueryInterface(DestinationType::GetIID(), getter_AddRefs(*aDestination));
|
||||
}
|
||||
|
||||
|
||||
|
@ -558,18 +558,19 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
|
||||
// exists in "nsCOMPtr.h" for use with |nsCOMPtr|s.
|
||||
|
||||
extern "C++" {
|
||||
// ...because some one is accidentally including this file inside an |extern "C"|
|
||||
|
||||
class nsISupports;
|
||||
|
||||
template <class T>
|
||||
template <class SourceType, class DestinationType>
|
||||
inline
|
||||
nsresult
|
||||
CallQueryInterface( nsISupports* aSource, T** aDestination )
|
||||
CallQueryInterface( SourceType* aSource, DestinationType** aDestination )
|
||||
// a type-safe shortcut for calling the |QueryInterface()| member function
|
||||
{
|
||||
NS_PRECONDITION(aSource, "null parameter");
|
||||
|
||||
return aSource->QueryInterface(T::GetIID(), aDestination);
|
||||
return aSource->QueryInterface(DestinationType::GetIID(), aDestination);
|
||||
}
|
||||
|
||||
} // extern "C++"
|
||||
|
@ -531,16 +531,16 @@ getter_AddRefs( nsCOMPtr<T>& aSmartPtr )
|
||||
|
||||
|
||||
|
||||
template <class T>
|
||||
template <class SourceType, class DestinationType>
|
||||
inline
|
||||
nsresult
|
||||
CallQueryInterface( nsISupports* aSource, nsCOMPtr<T>* aDestination )
|
||||
CallQueryInterface( SourceType* aSource, nsCOMPtr<DestinationType>* aDestination )
|
||||
// a type-safe shortcut for calling the |QueryInterface()| member function
|
||||
{
|
||||
NS_PRECONDITION(aSource, "null parameter");
|
||||
NS_PRECONDITION(aDestination, "null parameter");
|
||||
|
||||
return aSource->QueryInterface(T::GetIID(), getter_AddRefs(*aDestination));
|
||||
return aSource->QueryInterface(DestinationType::GetIID(), getter_AddRefs(*aDestination));
|
||||
}
|
||||
|
||||
|
||||
|
@ -558,18 +558,19 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
|
||||
// exists in "nsCOMPtr.h" for use with |nsCOMPtr|s.
|
||||
|
||||
extern "C++" {
|
||||
// ...because some one is accidentally including this file inside an |extern "C"|
|
||||
|
||||
class nsISupports;
|
||||
|
||||
template <class T>
|
||||
template <class SourceType, class DestinationType>
|
||||
inline
|
||||
nsresult
|
||||
CallQueryInterface( nsISupports* aSource, T** aDestination )
|
||||
CallQueryInterface( SourceType* aSource, DestinationType** aDestination )
|
||||
// a type-safe shortcut for calling the |QueryInterface()| member function
|
||||
{
|
||||
NS_PRECONDITION(aSource, "null parameter");
|
||||
|
||||
return aSource->QueryInterface(T::GetIID(), aDestination);
|
||||
return aSource->QueryInterface(DestinationType::GetIID(), aDestination);
|
||||
}
|
||||
|
||||
} // extern "C++"
|
||||
|
Loading…
Reference in New Issue
Block a user