Bug 469072 - Annotations in XPCOM, and a couple related code fixups, to make outparams spit out useful warnings, r=bent
authorBenjamin Smedberg <benjamin@smedbergs.us>
Thu, 11 Dec 2008 15:13:52 -0500
changeset 22697 dabc6a7b1d50de26166c89ad2e34d3df2518ff0d
parent 22696 005a32ae9d7a6d1161084b70518d71976abc6761
child 22698 76ca5cd4892f499951cfeb34b882633db2a9cbdf
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs469072
milestone1.9.2a1pre
Bug 469072 - Annotations in XPCOM, and a couple related code fixups, to make outparams spit out useful warnings, r=bent
xpcom/ds/nsArray.cpp
xpcom/ds/nsHashPropertyBag.cpp
xpcom/ds/nsISupportsArray.idl
xpcom/ds/nsPersistentProperties.cpp
xpcom/ds/nsProperties.cpp
xpcom/ds/nsStringEnumerator.h
xpcom/ds/nsVariant.cpp
xpcom/ds/nsVariant.h
xpcom/glue/nsBaseHashtable.h
xpcom/glue/nsCOMPtr.h
xpcom/glue/nsGenericFactory.cpp
xpcom/glue/nsIClassInfoImpl.h
xpcom/glue/nsIGenericFactory.h
xpcom/io/nsFastLoadFile.h
xpcom/string/public/nsReadableUtils.h
--- a/xpcom/ds/nsArray.cpp
+++ b/xpcom/ds/nsArray.cpp
@@ -93,19 +93,21 @@ nsArray::QueryElementAt(PRUint32 aIndex,
 }
 
 NS_IMETHODIMP
 nsArray::IndexOf(PRUint32 aStartIndex, nsISupports* aElement,
                  PRUint32* aResult)
 {
     // optimize for the common case by forwarding to mArray
     if (aStartIndex == 0) {
-        *aResult = mArray.IndexOf(aElement);
-        if (*aResult == PR_UINT32_MAX)
+        PRUint32 idx = mArray.IndexOf(aElement);
+        if (idx == PR_UINT32_MAX)
             return NS_ERROR_FAILURE;
+
+        *aResult = idx;
         return NS_OK;
     }
 
     findIndexOfClosure closure = { aElement, aStartIndex, 0 };
     PRBool notFound = mArray.EnumerateForwards(FindElementCallback, &closure);
     if (notFound)
         return NS_ERROR_FAILURE;
 
--- a/xpcom/ds/nsHashPropertyBag.cpp
+++ b/xpcom/ds/nsHashPropertyBag.cpp
@@ -93,17 +93,18 @@ nsHashPropertyBag::HasKey(const nsAStrin
     *aResult = mPropertyHash.Get(name, nsnull);
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHashPropertyBag::Get(const nsAString& name, nsIVariant* *_retval)
 {
-    mPropertyHash.Get(name, _retval);
+    if (!mPropertyHash.Get(name, _retval))
+        *_retval = nsnull;
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHashPropertyBag::GetProperty(const nsAString& name, nsIVariant* *_retval)
 {
     PRBool isFound = mPropertyHash.Get(name, _retval);
--- a/xpcom/ds/nsISupportsArray.idl
+++ b/xpcom/ds/nsISupportsArray.idl
@@ -63,17 +63,17 @@ class nsISupportsArray;
 }
 #define NS_SUPPORTSARRAY_CONTRACTID "@mozilla.org/supports-array;1"
 #define NS_SUPPORTSARRAY_CLASSNAME "Supports Array"
  
 // Enumerator callback function. Return PR_FALSE to stop
 typedef PRBool (*nsISupportsArrayEnumFunc)(nsISupports* aElement, void *aData);
  
 NS_COM nsresult
-NS_NewArrayEnumerator(nsISimpleEnumerator* *result,
+NS_NewArrayEnumerator(nsISimpleEnumerator* *result NS_OUTPARAM,
                       nsISupportsArray* array);
 %}
 
 [scriptable, uuid(791eafa0-b9e6-11d1-8031-006008159b5a)]
 interface nsISupportsArray : nsICollection {
 
   [notxpcom] boolean Equals([const] in nsISupportsArray other);
   
--- a/xpcom/ds/nsPersistentProperties.cpp
+++ b/xpcom/ds/nsPersistentProperties.cpp
@@ -570,16 +570,19 @@ nsPersistentProperties::SetStringPropert
                (PL_DHashTableOperate(&mTable, flatKey.get(), PL_DHASH_ADD));
 
   if (entry->mKey) {
     aOldValue = entry->mValue;
     NS_WARNING(nsPrintfCString(aKey.Length() + 30,
                                "the property %s already exists\n",
                                flatKey.get()).get());
   }
+  else {
+    aOldValue.Truncate();
+  }
 
   entry->mKey = ArenaStrdup(flatKey, &mArena);
   entry->mValue = ArenaStrdup(PromiseFlatString(aNewValue), &mArena);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/xpcom/ds/nsProperties.cpp
+++ b/xpcom/ds/nsProperties.cpp
@@ -125,22 +125,23 @@ nsProperties::GetKeys(PRUint32 *count, c
 
     GetKeysEnumData gked;
     gked.keys = k;
     gked.next = 0;
     gked.res = NS_OK;
 
     EnumerateRead(GetKeysEnumerate, &gked);
 
-    if (NS_FAILED(gked.res)) {
+    nsresult rv = gked.res;
+    if (NS_FAILED(rv)) {
         // Free 'em all
         for (PRUint32 i = 0; i < gked.next; i++)
             nsMemory::Free(k[i]);
         nsMemory::Free(k);
-        return gked.res;
+        return rv;
     }
 
     *count = n;
     *keys = k;
     return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/xpcom/ds/nsStringEnumerator.h
+++ b/xpcom/ds/nsStringEnumerator.h
@@ -70,53 +70,53 @@
 // array.AppendCString("def");
 // NS_NewStringEnumerator(&enumerator, &array, PR_TRUE);
 //
 // // call some internal method which iterates the enumerator
 // InternalMethod(enumerator);
 // NS_RELEASE(enumerator);
 //
 NS_COM nsresult
-NS_NewUTF8StringEnumerator(nsIUTF8StringEnumerator** aResult,
+NS_NewUTF8StringEnumerator(nsIUTF8StringEnumerator** aResult NS_OUTPARAM,
                            const nsCStringArray* aArray);
 
 NS_COM nsresult
-NS_NewStringEnumerator(nsIStringEnumerator** aResult,
+NS_NewStringEnumerator(nsIStringEnumerator** aResult NS_OUTPARAM,
                        const nsStringArray* aArray);
 
 // Adopting string enumerators assume ownership of the array and will
 // call |operator delete| on the array when the enumerator is destroyed
 // this is useful when the provider creates an array solely for the
 // purpose of creating the enumerator.
 // For example:
 //
 // nsCStringArray* array = new nsCStringArray;
 // array->AppendString("abcd");
 // NS_NewAdoptingStringEnumerator(&result, array);
 NS_COM nsresult
-NS_NewAdoptingStringEnumerator(nsIStringEnumerator** aResult,
+NS_NewAdoptingStringEnumerator(nsIStringEnumerator** aResult NS_OUTPARAM,
                                nsStringArray* aArray);
 
 NS_COM nsresult
-NS_NewAdoptingUTF8StringEnumerator(nsIUTF8StringEnumerator** aResult,
+NS_NewAdoptingUTF8StringEnumerator(nsIUTF8StringEnumerator** aResult NS_OUTPARAM,
                                    nsCStringArray* aArray);
 
 
 // these versions take a refcounted "owner" which will be addreffed
 // when the enumerator is created, and destroyed when the enumerator
 // is released. This allows providers to give non-owning pointers to
 // ns*StringArray member variables without worrying about lifetime
 // issues
 // For example:
 //
 // nsresult MyClass::Enumerate(nsIUTF8StringEnumerator** aResult) {
 //     mCategoryList->AppendString("abcd");
 //     return NS_NewStringEnumerator(aResult, mCategoryList, this);
 // }
 //
 NS_COM nsresult
-NS_NewStringEnumerator(nsIStringEnumerator** aResult,
+NS_NewStringEnumerator(nsIStringEnumerator** aResult NS_OUTPARAM,
                        const nsStringArray* aArray,
                        nsISupports* aOwner);
 NS_COM nsresult
-NS_NewUTF8StringEnumerator(nsIUTF8StringEnumerator** aResult,
+NS_NewUTF8StringEnumerator(nsIUTF8StringEnumerator** aResult NS_OUTPARAM,
                            const nsCStringArray* aArray,
                            nsISupports* aOwner);
--- a/xpcom/ds/nsVariant.cpp
+++ b/xpcom/ds/nsVariant.cpp
@@ -256,18 +256,20 @@ static void FreeArray(nsDiscriminatedUni
     nsMemory::Free((char*)data->u.array.mArrayValue);
 
 #undef CASE__FREE_ARRAY_PTR
 #undef CASE__FREE_ARRAY_IFACE
 }
 
 static nsresult CloneArray(PRUint16 inType, const nsIID* inIID,
                            PRUint32 inCount, void* inValue,
-                           PRUint16* outType, nsIID* outIID,
-                           PRUint32* outCount, void** outValue)
+                           PRUint16* outType NS_OUTPARAM,
+                           nsIID* outIID NS_OUTPARAM,
+                           PRUint32* outCount NS_OUTPARAM,
+                           void** outValue)
 {
     NS_ASSERTION(inCount, "bad param");
     NS_ASSERTION(inValue, "bad param");
     NS_ASSERTION(outType, "bad param");
     NS_ASSERTION(outCount, "bad param");
     NS_ASSERTION(outValue, "bad param");
 
     PRUint32 allocatedValueCount = 0;
--- a/xpcom/ds/nsVariant.h
+++ b/xpcom/ds/nsVariant.h
@@ -131,29 +131,29 @@ public:
     static nsresult ConvertToInt64(const nsDiscriminatedUnion& data, PRInt64 *_retval);
     static nsresult ConvertToUint8(const nsDiscriminatedUnion& data, PRUint8 *_retval);
     static nsresult ConvertToUint16(const nsDiscriminatedUnion& data, PRUint16 *_retval);
     static nsresult ConvertToUint32(const nsDiscriminatedUnion& data, PRUint32 *_retval);
     static nsresult ConvertToUint64(const nsDiscriminatedUnion& data, PRUint64 *_retval);
     static nsresult ConvertToFloat(const nsDiscriminatedUnion& data, float *_retval);
     static nsresult ConvertToDouble(const nsDiscriminatedUnion& data, double *_retval);
     static nsresult ConvertToBool(const nsDiscriminatedUnion& data, PRBool *_retval);
-    static nsresult ConvertToChar(const nsDiscriminatedUnion& data, char *_retval);
-    static nsresult ConvertToWChar(const nsDiscriminatedUnion& data, PRUnichar *_retval);
-    static nsresult ConvertToID(const nsDiscriminatedUnion& data, nsID * _retval);
-    static nsresult ConvertToAString(const nsDiscriminatedUnion& data, nsAString & _retval);
+    static nsresult ConvertToChar(const nsDiscriminatedUnion& data, char *_retval NS_OUTPARAM);
+    static nsresult ConvertToWChar(const nsDiscriminatedUnion& data, PRUnichar *_retval NS_OUTPARAM);
+    static nsresult ConvertToID(const nsDiscriminatedUnion& data, nsID * _retval NS_OUTPARAM);
+    static nsresult ConvertToAString(const nsDiscriminatedUnion& data, nsAString & _retval NS_OUTPARAM);
     static nsresult ConvertToAUTF8String(const nsDiscriminatedUnion& data, nsAUTF8String & _retval);
     static nsresult ConvertToACString(const nsDiscriminatedUnion& data, nsACString & _retval);
     static nsresult ConvertToString(const nsDiscriminatedUnion& data, char **_retval);
     static nsresult ConvertToWString(const nsDiscriminatedUnion& data, PRUnichar **_retval);
     static nsresult ConvertToISupports(const nsDiscriminatedUnion& data, nsISupports **_retval);
-    static nsresult ConvertToInterface(const nsDiscriminatedUnion& data, nsIID * *iid, void * *iface);
-    static nsresult ConvertToArray(const nsDiscriminatedUnion& data, PRUint16 *type, nsIID* iid, PRUint32 *count, void * *ptr);
-    static nsresult ConvertToStringWithSize(const nsDiscriminatedUnion& data, PRUint32 *size, char **str);
-    static nsresult ConvertToWStringWithSize(const nsDiscriminatedUnion& data, PRUint32 *size, PRUnichar **str);
+    static nsresult ConvertToInterface(const nsDiscriminatedUnion& data, nsIID * *iid NS_OUTPARAM, void * *iface NS_OUTPARAM);
+    static nsresult ConvertToArray(const nsDiscriminatedUnion& data, PRUint16 *type NS_OUTPARAM, nsIID* iid NS_OUTPARAM, PRUint32 *count NS_OUTPARAM, void * *ptr);
+    static nsresult ConvertToStringWithSize(const nsDiscriminatedUnion& data, PRUint32 *size NS_OUTPARAM, char **str);
+    static nsresult ConvertToWStringWithSize(const nsDiscriminatedUnion& data, PRUint32 *size NS_OUTPARAM, PRUnichar **str);
 
     static nsresult SetFromVariant(nsDiscriminatedUnion* data, nsIVariant* aValue);
 
     static nsresult SetFromInt8(nsDiscriminatedUnion* data, PRUint8 aValue);
     static nsresult SetFromInt16(nsDiscriminatedUnion* data, PRInt16 aValue);
     static nsresult SetFromInt32(nsDiscriminatedUnion* data, PRInt32 aValue);
     static nsresult SetFromInt64(nsDiscriminatedUnion* data, PRInt64 aValue);
     static nsresult SetFromUint8(nsDiscriminatedUnion* data, PRUint8 aValue);
--- a/xpcom/glue/nsBaseHashtable.h
+++ b/xpcom/glue/nsBaseHashtable.h
@@ -116,17 +116,17 @@ public:
    * retrieve the value for a key.
    * @param aKey the key to retreive
    * @param pData data associated with this key will be placed at this
    *   pointer.  If you only need to check if the key exists, pData
    *   may be null.
    * @return PR_TRUE if the key exists. If key does not exist, pData is not
    *   modified.
    */
-  PRBool Get(KeyType aKey, UserDataType* pData) const
+  PRBool Get(KeyType aKey, UserDataType* pData NS_OUTPARAM) const
   {
     EntryType* ent = GetEntry(aKey);
 
     if (!ent)
       return PR_FALSE;
 
     if (pData)
       *pData = ent->mData;
--- a/xpcom/glue/nsCOMPtr.h
+++ b/xpcom/glue/nsCOMPtr.h
@@ -752,17 +752,17 @@ nsCOMPtr
           // already_AddRefed return values.
         {
           T* temp = 0;
           swap(temp);
           return temp;
         }
 
       void
-      forget( T** rhs )
+      forget( T** rhs NS_OUTPARAM )
           // Set the target of rhs to the value of mRawPtr and null out mRawPtr.
           // Useful to avoid unnecessary AddRef/Release pairs with "out"
           // parameters.
         {
           NS_ASSERTION(rhs, "Null pointer passed to forget!");
           *rhs = 0;
           swap(*rhs);
         }
@@ -1061,17 +1061,17 @@ class nsCOMPtr<nsISupports>
           nsISupports* temp = rhs;
           NSCAP_LOG_ASSIGNMENT(this, temp);
           NSCAP_LOG_RELEASE(this, mRawPtr);
           rhs = mRawPtr;
           mRawPtr = temp;
         }
 
       void
-      forget( nsISupports** rhs )
+      forget( nsISupports** rhs NS_OUTPARAM )
           // Set the target of rhs to the value of mRawPtr and null out mRawPtr.
           // Useful to avoid unnecessary AddRef/Release pairs with "out"
           // parameters.
         {
           NS_ASSERTION(rhs, "Null pointer passed to forget!");
           *rhs = 0;
           swap(*rhs);
         }
--- a/xpcom/glue/nsGenericFactory.cpp
+++ b/xpcom/glue/nsGenericFactory.cpp
@@ -467,17 +467,17 @@ nsGenericModule::UnregisterSelf(nsICompo
 
 NS_IMETHODIMP
 nsGenericModule::CanUnload(nsIComponentManager *aCompMgr, PRBool *okToUnload)
 {
     if (!okToUnload) {
         return NS_ERROR_INVALID_POINTER;
     }
     *okToUnload = PR_FALSE;
-    return NS_ERROR_FAILURE;
+    return NS_OK;
 }
 
 NS_COM_GLUE nsresult
 NS_NewGenericModule2(nsModuleInfo const *info, nsIModule* *result)
 {
     nsresult rv = NS_OK;
 
     // Create and initialize the module instance
--- a/xpcom/glue/nsIClassInfoImpl.h
+++ b/xpcom/glue/nsIClassInfoImpl.h
@@ -37,32 +37,33 @@
 #define nsIClassInfoImpl_h__
 
 #include "nsIClassInfo.h"
 
 #define NS_CLASSINFO_NAME(_class) _class##_classInfoGlobal
 #define NS_CI_INTERFACE_GETTER_NAME(_class) _class##_GetInterfacesHelper
 
 #define NS_DECL_CI_INTERFACE_GETTER(_class)                                   \
-  extern NS_IMETHODIMP NS_CI_INTERFACE_GETTER_NAME(_class)(PRUint32 *,        \
-                                                           nsIID ***);
+  extern NS_IMETHODIMP NS_CI_INTERFACE_GETTER_NAME(_class)                    \
+     (PRUint32 * NS_OUTPARAM, nsIID *** NS_OUTPARAM);
 
 #define NS_DECL_CLASSINFO(_class)                                             \
   NS_DECL_CI_INTERFACE_GETTER(_class)                                         \
   nsIClassInfo *NS_CLASSINFO_NAME(_class);
 
 #define NS_IMPL_QUERY_CLASSINFO(_class)                                       \
   if ( aIID.Equals(NS_GET_IID(nsIClassInfo)) ) {                              \
     extern nsIClassInfo *NS_CLASSINFO_NAME(_class);                           \
     foundInterface = static_cast<nsIClassInfo*>(NS_CLASSINFO_NAME(_class));   \
   } else
 
 #define NS_CLASSINFO_HELPER_BEGIN(_class, _c)                                 \
 NS_IMETHODIMP                                                                 \
-NS_CI_INTERFACE_GETTER_NAME(_class)(PRUint32 *count, nsIID ***array)          \
+NS_CI_INTERFACE_GETTER_NAME(_class)(PRUint32 *count NS_OUTPARAM,              \
+                                    nsIID ***array NS_OUTPARAM)               \
 {                                                                             \
     *count = _c;                                                              \
     *array = (nsIID **)nsMemory::Alloc(sizeof (nsIID *) * _c);
 
 #define NS_CLASSINFO_HELPER_ENTRY(_i, _interface)                             \
     (*array)[_i] = (nsIID *)nsMemory::Clone(&NS_GET_IID(_interface),          \
                                             sizeof(nsIID));
 
--- a/xpcom/glue/nsIGenericFactory.h
+++ b/xpcom/glue/nsIGenericFactory.h
@@ -182,18 +182,18 @@ typedef NS_CALLBACK(NSFactoryDestructorP
  * promise to implement. Note that nsISupports is an implicit member 
  * of any such list and need not be included. 
  *
  * Should set *count = 0 and *array = null and return NS_OK if getting the 
  * list is not supported.
  * 
  * @see nsIClassInfo.idl
  **/
-typedef NS_CALLBACK(NSGetInterfacesProcPtr)(PRUint32 *countp,
-                                            nsIID* **array);
+typedef NS_CALLBACK(NSGetInterfacesProcPtr)(PRUint32 * NS_OUTPARAM countp,
+                                            nsIID* ** NS_OUTPARAM array);
 
 /** 
  * NSGetLanguageHelperProcPtr
  *      
  * This function is used to implement class info.
  *
  * Get a language mapping specific helper object that may assist in using
  * objects of this class in a specific lanaguage. For instance, if asked
--- a/xpcom/io/nsFastLoadFile.h
+++ b/xpcom/io/nsFastLoadFile.h
@@ -397,17 +397,17 @@ class nsFastLoadFileReader
     nsFastLoadFooter mFooter;
 
     nsDocumentMapReadEntry* mCurrentDocumentMapEntry;
 
     friend class nsFastLoadFileUpdater;
 };
 
 NS_COM nsresult
-NS_NewFastLoadFileReader(nsIObjectInputStream* *aResult,
+NS_NewFastLoadFileReader(nsIObjectInputStream* *aResult NS_OUTPARAM,
                          nsIInputStream* aSrcStream);
 
 /**
  * Inherit from the concrete class nsBinaryInputStream, which inherits from
  * abstract nsIObjectInputStream but does not implement its direct methods.
  * Though the names are not as clear as I'd like, this seems to be the best
  * way to share nsBinaryStream.cpp code.
  */
@@ -521,17 +521,17 @@ class nsFastLoadFileWriter
     PLDHashTable mURIMap;
     PLDHashTable mDependencyMap;
 
     nsDocumentMapWriteEntry* mCurrentDocumentMapEntry;
     nsCOMPtr<nsIFastLoadFileIO> mFileIO;
 };
 
 NS_COM nsresult
-NS_NewFastLoadFileWriter(nsIObjectOutputStream* *aResult,
+NS_NewFastLoadFileWriter(nsIObjectOutputStream* *aResult NS_OUTPARAM,
                          nsIOutputStream* aDestStream,
                          nsIFastLoadFileIO* aFileIO);
 
 /**
  * Subclass of nsFastLoadFileWriter, friend of nsFastLoadFileReader which it
  * wraps when a FastLoad file needs to be updated.  The wrapped reader can be
  * used to demulitplex data for documents already in the FastLoad file, while
  * the updater writes new data over the old footer, then writes a new footer
@@ -572,13 +572,13 @@ class nsFastLoadFileUpdater
   protected:
     nsCOMPtr<nsIInputStream> mInputStream;
 
     // Kept in sync with mInputStream to avoid repeated QI
     nsCOMPtr<nsISeekableStream> mSeekableInput;
 };
 
 NS_COM nsresult
-NS_NewFastLoadFileUpdater(nsIObjectOutputStream* *aResult,
+NS_NewFastLoadFileUpdater(nsIObjectOutputStream* *aResult NS_OUTPARAM,
                           nsIOutputStream* aOutputStream,
                           nsIObjectInputStream* aReaderAsStream);
 
 #endif // nsFastLoadFile_h___
--- a/xpcom/string/public/nsReadableUtils.h
+++ b/xpcom/string/public/nsReadableUtils.h
@@ -53,27 +53,27 @@ inline size_t Distance( const nsReadingI
   {
     return end.get() - start.get();
   }
 inline size_t Distance( const nsReadingIterator<char>& start, const nsReadingIterator<char>& end )
   {
     return end.get() - start.get();
   }
 
-NS_COM void LossyCopyUTF16toASCII( const nsAString& aSource, nsACString& aDest );
-NS_COM void CopyASCIItoUTF16( const nsACString& aSource, nsAString& aDest );
+NS_COM void LossyCopyUTF16toASCII( const nsAString& aSource, nsACString& aDest NS_OUTPARAM );
+NS_COM void CopyASCIItoUTF16( const nsACString& aSource, nsAString& aDest NS_OUTPARAM );
 
-NS_COM void LossyCopyUTF16toASCII( const PRUnichar* aSource, nsACString& aDest );
-NS_COM void CopyASCIItoUTF16( const char* aSource, nsAString& aDest );
+NS_COM void LossyCopyUTF16toASCII( const PRUnichar* aSource, nsACString& aDest NS_OUTPARAM );
+NS_COM void CopyASCIItoUTF16( const char* aSource, nsAString& aDest NS_OUTPARAM );
 
-NS_COM void CopyUTF16toUTF8( const nsAString& aSource, nsACString& aDest );
-NS_COM void CopyUTF8toUTF16( const nsACString& aSource, nsAString& aDest );
+NS_COM void CopyUTF16toUTF8( const nsAString& aSource, nsACString& aDest NS_OUTPARAM );
+NS_COM void CopyUTF8toUTF16( const nsACString& aSource, nsAString& aDest NS_OUTPARAM );
 
-NS_COM void CopyUTF16toUTF8( const PRUnichar* aSource, nsACString& aDest );
-NS_COM void CopyUTF8toUTF16( const char* aSource, nsAString& aDest );
+NS_COM void CopyUTF16toUTF8( const PRUnichar* aSource, nsACString& aDest NS_OUTPARAM );
+NS_COM void CopyUTF8toUTF16( const char* aSource, nsAString& aDest NS_OUTPARAM );
 
 NS_COM void LossyAppendUTF16toASCII( const nsAString& aSource, nsACString& aDest );
 NS_COM void AppendASCIItoUTF16( const nsACString& aSource, nsAString& aDest );
 
 NS_COM void LossyAppendUTF16toASCII( const PRUnichar* aSource, nsACString& aDest );
 NS_COM void AppendASCIItoUTF16( const char* aSource, nsAString& aDest );
 
 NS_COM void AppendUTF16toUTF8( const nsAString& aSource, nsACString& aDest );