diff --git a/mozilla/widget/src/photon/nsAppShell.cpp b/mozilla/widget/src/photon/nsAppShell.cpp index da92bcf63d4..9b84de21ab7 100644 --- a/mozilla/widget/src/photon/nsAppShell.cpp +++ b/mozilla/widget/src/photon/nsAppShell.cpp @@ -186,8 +186,7 @@ NS_METHOD nsAppShell::Spinup() } //Get the event queue for the thread. - //rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(mEventQueue)); - rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, &mEventQueue); + rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(mEventQueue)); // If we got an event queue, use it. if (mEventQueue) @@ -201,8 +200,7 @@ NS_METHOD nsAppShell::Spinup() } // Ask again nicely for the event queue now that we have created one. - //rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(mEventQueue)); - rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, &mEventQueue); + rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(mEventQueue)); // XXX shouldn't this be automatic? done: diff --git a/mozilla/widget/src/photon/nsAppShell.h b/mozilla/widget/src/photon/nsAppShell.h index 803f213c379..2f18b001b85 100644 --- a/mozilla/widget/src/photon/nsAppShell.h +++ b/mozilla/widget/src/photon/nsAppShell.h @@ -79,7 +79,7 @@ public: static PRBool gExitMainLoop; private: - nsIEventQueue* mEventQueue; + nsCOMPtr mEventQueue; int mFD; static PRBool mPtInited; diff --git a/mozilla/widget/src/photon/nsFilePicker.cpp b/mozilla/widget/src/photon/nsFilePicker.cpp index ff2d8e7ad1d..f944ef2688e 100644 --- a/mozilla/widget/src/photon/nsFilePicker.cpp +++ b/mozilla/widget/src/photon/nsFilePicker.cpp @@ -121,9 +121,7 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *aReturnVal) return PR_FALSE; } - char *title = ConvertToFileSystemCharset(mTitle.get()); - if (nsnull == title) - title = ToNewCString(mTitle); + char *title = ToNewUTF8String( mTitle ); nsCAutoString initialDir; mDisplayDirectory->GetNativePath(initialDir); @@ -140,7 +138,7 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *aReturnVal) char extensionBuffer[MAX_EXTENSION_LENGTH+1] = "*"; if( !mFilterList.IsEmpty() ) { - char *text = ConvertToFileSystemCharset( mFilterList.get( ) ); + char *text = ToNewUTF8String( mFilterList ); if( text ) { extensionBuffer[0] = 0; @@ -160,7 +158,7 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *aReturnVal) } else if (!mDefaultExtension.IsEmpty()) { // Someone was cool and told us what to do - char *convertedExt = ConvertToFileSystemCharset(mDefaultExtension.get()); + char *convertedExt = ToNewUTF8String( mDefaultExtension ); if (!convertedExt) { mDefaultExtension.ToCString(extensionBuffer, MAX_EXTENSION_LENGTH); } @@ -353,107 +351,6 @@ nsFilePicker::AppendFilter(const nsAString& aTitle, const nsAString& aFilter) } -//------------------------------------------------------------------------- -void nsFilePicker::GetFileSystemCharset(nsCString & fileSystemCharset) -{ - static nsCAutoString aCharset; - nsresult rv; - - if (aCharset.Length() < 1) { - nsCOMPtr platformCharset = do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &rv); - if (NS_SUCCEEDED(rv)) - rv = platformCharset->GetCharset(kPlatformCharsetSel_FileName, aCharset); - - NS_ASSERTION(NS_SUCCEEDED(rv), "error getting platform charset"); - if (NS_FAILED(rv)) - aCharset.Assign(NS_LITERAL_CSTRING("windows-1252")); - } - fileSystemCharset = aCharset; -} - - -//------------------------------------------------------------------------- -char * nsFilePicker::ConvertToFileSystemCharset(const nsAString& inString) -{ - char *outString = nsnull; - nsresult rv = NS_OK; - - // get file system charset and create a unicode encoder - if (nsnull == mUnicodeEncoder) { - nsCAutoString fileSystemCharset; - GetFileSystemCharset(fileSystemCharset); - - nsCOMPtr ccm = - do_GetService(kCharsetConverterManagerCID, &rv); - if (NS_SUCCEEDED(rv)) { - rv = ccm->GetUnicodeEncoderRaw(fileSystemCharset.get(), &mUnicodeEncoder); - } - } - - // converts from unicode to the file system charset - if (NS_SUCCEEDED(rv)) { - PRInt32 inLength = inString.Length(); - - const nsAFlatString& flatInString = PromiseFlatString(inString); - - PRInt32 outLength; - rv = mUnicodeEncoder->GetMaxLength(flatInString.get(), inLength, - &outLength); - if (NS_SUCCEEDED(rv)) { - outString = NS_STATIC_CAST( char*, nsMemory::Alloc( outLength+1 ) ); - if (nsnull == outString) { - return nsnull; - } - rv = mUnicodeEncoder->Convert(flatInString.get(), &inLength, outString, - &outLength); - if (NS_SUCCEEDED(rv)) { - outString[outLength] = '\0'; - } - } - } - - return NS_SUCCEEDED(rv) ? outString : nsnull; -} - -//------------------------------------------------------------------------- -PRUnichar * nsFilePicker::ConvertFromFileSystemCharset(const char *inString) -{ - PRUnichar *outString = nsnull; - nsresult rv = NS_OK; - - // get file system charset and create a unicode encoder - if (nsnull == mUnicodeDecoder) { - nsCAutoString fileSystemCharset; - GetFileSystemCharset(fileSystemCharset); - - nsCOMPtr ccm = - do_GetService(kCharsetConverterManagerCID, &rv); - if (NS_SUCCEEDED(rv)) { - rv = ccm->GetUnicodeDecoderRaw(fileSystemCharset.get(), &mUnicodeDecoder); - } - } - - // converts from the file system charset to unicode - if (NS_SUCCEEDED(rv)) { - PRInt32 inLength = strlen(inString); - PRInt32 outLength; - rv = mUnicodeDecoder->GetMaxLength(inString, inLength, &outLength); - if (NS_SUCCEEDED(rv)) { - outString = NS_STATIC_CAST( PRUnichar*, nsMemory::Alloc( (outLength+1) * sizeof( PRUnichar ) ) ); - if (nsnull == outString) { - return nsnull; - } - rv = mUnicodeDecoder->Convert(inString, &inLength, outString, &outLength); - if (NS_SUCCEEDED(rv)) { - outString[outLength] = 0; - } - } - } - - NS_ASSERTION(NS_SUCCEEDED(rv), "error charset conversion"); - return NS_SUCCEEDED(rv) ? outString : nsnull; -} - //------------------------------------------------------------------------- // // Set the filter index diff --git a/mozilla/widget/src/photon/nsFilePicker.h b/mozilla/widget/src/photon/nsFilePicker.h index 35465f14a6f..39d60cd4a34 100644 --- a/mozilla/widget/src/photon/nsFilePicker.h +++ b/mozilla/widget/src/photon/nsFilePicker.h @@ -82,9 +82,6 @@ protected: void GetFilterListArray(nsString& aFilterList); - static void GetFileSystemCharset(nsCString & fileSystemCharset); - char * ConvertToFileSystemCharset(const nsAString& inString); - PRUnichar * ConvertFromFileSystemCharset(const char *inString); PtWidget_t *mParentWidget; nsString mTitle; diff --git a/mozilla/widget/src/photon/nsSound.cpp b/mozilla/widget/src/photon/nsSound.cpp index 177c81cea43..5a1abe7bfed 100644 --- a/mozilla/widget/src/photon/nsSound.cpp +++ b/mozilla/widget/src/photon/nsSound.cpp @@ -90,7 +90,7 @@ NS_IMETHODIMP nsSound::OnStreamComplete(nsIStreamLoader *aLoader, nsISupports *context, nsresult aStatus, PRUint32 stringLen, - const char *stringData) + const PRUint8 *stringData) { nsresult rv = NS_ERROR_FAILURE;