From 03491c71e448963bc5b4f8a4811d966b064da9ce Mon Sep 17 00:00:00 2001 From: "amardare%qnx.com" Date: Tue, 28 Sep 2004 20:57:03 +0000 Subject: [PATCH] Changes for qnx(photon) platform. They should not affect building/runtime other platforms. Fixed the setting of window title in the embedded mozserver. --- embedding/browser/photon/src/EmbedWindow.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/embedding/browser/photon/src/EmbedWindow.cpp b/embedding/browser/photon/src/EmbedWindow.cpp index 080830a522d2..ee559e4ce11e 100644 --- a/embedding/browser/photon/src/EmbedWindow.cpp +++ b/embedding/browser/photon/src/EmbedWindow.cpp @@ -402,7 +402,8 @@ EmbedWindow::SetTitle(const PRUnichar *aTitle) PtCallbackInfo_t cbinfo; PtMozillaInfoCb_t info; nsString mTitleString(aTitle); - char *str; + const char *str; + int to_free = 0; mTitle = aTitle; @@ -419,19 +420,23 @@ EmbedWindow::SetTitle(const PRUnichar *aTitle) /* see if the title is empty */ if( mTitleString.Length() == 0 ) { - if( moz->EmbedRef->mURI.Length() > 0 ) + if( moz->EmbedRef->mURI.Length() > 0 ) { str = ToNewCString( moz->EmbedRef->mURI ); + to_free = 1; + } else { - str = (char*) nsMemory::Alloc( 2 ); - str[0] = ' '; str[1] = 0; + str = " "; } } - else str = ToNewCString(mTitleString); + else { + NS_ConvertUCS2toUTF8 theUnicodeString( mTitleString ); + str = theUnicodeString.get( ); + } - info.data = str; + info.data = (char*) str; PtInvokeCallbackList(cb, (PtWidget_t *) moz, &cbinfo); - nsMemory::Free( (void*)str ); + if( to_free ) nsMemory::Free( (void*)str ); return NS_OK; }