From a6cd5c06921743c86eab3d49783b721b5dd15ea7 Mon Sep 17 00:00:00 2001 From: "ruslan%netscape.com" Date: Wed, 12 Apr 2000 00:46:58 +0000 Subject: [PATCH] Add a quick constructor for nsISupportsPRBool as well as make it implement threadsafe isupports. Stream convs. use it. --- xpcom/ds/nsISupportsPrimitives.idl | 3 +++ xpcom/ds/nsSupportsPrimitives.cpp | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/xpcom/ds/nsISupportsPrimitives.idl b/xpcom/ds/nsISupportsPrimitives.idl index e88eade7930f..e724bcae7a1f 100644 --- a/xpcom/ds/nsISupportsPrimitives.idl +++ b/xpcom/ds/nsISupportsPrimitives.idl @@ -272,4 +272,7 @@ interface nsISupportsVoid : nsISupports { 0xba, 0xf8, 0x0, 0x80, 0x5f, 0x8a, 0x5d, 0xd7 } } #define NS_SUPPORTS_VOID_PROGID "component://netscape/supports-void" #define NS_SUPPORTS_VOID_CLASSNAME "Supports void" + +extern NS_COM nsresult NS_NewISupportsPRBool (nsISupportsPRBool ** aResult); + %} diff --git a/xpcom/ds/nsSupportsPrimitives.cpp b/xpcom/ds/nsSupportsPrimitives.cpp index 669880aa62b0..76b7e0bcbf24 100644 --- a/xpcom/ds/nsSupportsPrimitives.cpp +++ b/xpcom/ds/nsSupportsPrimitives.cpp @@ -233,7 +233,7 @@ NS_IMETHODIMP nsSupportsWStringImpl::SetDataWithLength(PRInt32 aLength, const PR /***************************************************************************/ -NS_IMPL_ISUPPORTS1(nsSupportsPRBoolImpl, nsISupportsPRBool) +NS_IMPL_THREADSAFE_ISUPPORTS1(nsSupportsPRBoolImpl, nsISupportsPRBool) nsSupportsPRBoolImpl::nsSupportsPRBoolImpl() : mData(PR_FALSE) @@ -274,6 +274,21 @@ NS_IMETHODIMP nsSupportsPRBoolImpl::ToString(char **_retval) return result ? NS_OK : NS_ERROR_OUT_OF_MEMORY; } +NS_COM nsresult +NS_NewISupportsPRBool (nsISupportsPRBool ** aResult) +{ + NS_ENSURE_ARG_POINTER (aResult); + nsISupportsPRBool * rval = (nsISupportsPRBool *) (new nsSupportsPRBoolImpl ()); + + if (!rval) + return NS_ERROR_OUT_OF_MEMORY; + + NS_ADDREF (rval); + *aResult = rval; + + return NS_OK; +} + /***************************************************************************/ NS_IMPL_ISUPPORTS1(nsSupportsPRUint8Impl, nsISupportsPRUint8)