ByteString -> rtl::OString

This commit is contained in:
Caolán McNamara 2011-06-16 22:28:08 +01:00
parent 74a007ef73
commit e178d5a97f

View file

@ -228,8 +228,9 @@ WMAdaptor* WMAdaptor::createWMAdaptor( SalDisplay* pSalDisplay )
pAdaptor = new WMAdaptor( pSalDisplay ); pAdaptor = new WMAdaptor( pSalDisplay );
#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "Window Manager's name is \"%s\"\n", fprintf(stderr, "Window Manager's name is \"%s\"\n",
ByteString( pAdaptor->getWindowManagerName(), RTL_TEXTENCODING_ISO_8859_1 ).GetBuffer() ); rtl::OUStringToOString(pAdaptor->getWindowManagerName(),
RTL_TEXTENCODING_UTF8).getStr());
#endif #endif
return pAdaptor; return pAdaptor;
} }
@ -1075,10 +1076,11 @@ void GnomeWMAdaptor::initAtoms()
void WMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const void WMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const
{ {
ByteString aTitle( rWMName, osl_getThreadTextEncoding() ); rtl::OString aTitle(rtl::OUStringToOString(rWMName,
osl_getThreadTextEncoding()));
if( ! rWMName.Len() && m_aWMName.EqualsAscii( "Dtwm" ) ) if( ! rWMName.Len() && m_aWMName.EqualsAscii( "Dtwm" ) )
aTitle = " "; aTitle = rtl::OString(' ');
::rtl::OString aWMLocale; ::rtl::OString aWMLocale;
rtl_Locale* pLocale = NULL; rtl_Locale* pLocale = NULL;
@ -1140,7 +1142,7 @@ void WMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const
} }
#endif #endif
char* pT = const_cast<char*>(aTitle.GetBuffer()); char* pT = const_cast<char*>(aTitle.getStr());
XTextProperty aProp = { NULL, None, 0, 0 }; XTextProperty aProp = { NULL, None, 0, 0 };
if( bTrustXmb ) if( bTrustXmb )
{ {
@ -1151,10 +1153,10 @@ void WMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const
&aProp ); &aProp );
} }
unsigned char* pData = aProp.nitems ? aProp.value : (unsigned char*)aTitle.GetBuffer(); unsigned char* pData = aProp.nitems ? aProp.value : (unsigned char*)aTitle.getStr();
Atom nType = aProp.nitems ? aProp.encoding : XA_STRING; Atom nType = aProp.nitems ? aProp.encoding : XA_STRING;
int nFormat = aProp.nitems ? aProp.format : 8; int nFormat = aProp.nitems ? aProp.format : 8;
int nBytes = aProp.nitems ? aProp.nitems : aTitle.Len(); int nBytes = aProp.nitems ? aProp.nitems : aTitle.getLength();
const SystemEnvData* pEnv = pFrame->GetSystemData(); const SystemEnvData* pEnv = pFrame->GetSystemData();
XChangeProperty( m_pDisplay, XChangeProperty( m_pDisplay,
(XLIB_Window)pEnv->aShellWindow, (XLIB_Window)pEnv->aShellWindow,
@ -1195,7 +1197,7 @@ void NetWMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const
{ {
WMAdaptor::setWMName( pFrame, rWMName ); WMAdaptor::setWMName( pFrame, rWMName );
ByteString aTitle( rWMName, RTL_TEXTENCODING_UTF8 ); rtl::OString aTitle(rtl::OUStringToOString(rWMName, RTL_TEXTENCODING_UTF8));
const SystemEnvData* pEnv = pFrame->GetSystemData(); const SystemEnvData* pEnv = pFrame->GetSystemData();
if( m_aWMAtoms[ NET_WM_NAME ] ) if( m_aWMAtoms[ NET_WM_NAME ] )
XChangeProperty( m_pDisplay, XChangeProperty( m_pDisplay,
@ -1204,8 +1206,8 @@ void NetWMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const
m_aWMAtoms[ UTF8_STRING ], m_aWMAtoms[ UTF8_STRING ],
8, 8,
PropModeReplace, PropModeReplace,
(unsigned char*)aTitle.GetBuffer(), (unsigned char*)aTitle.getStr(),
aTitle.Len()+1 ); aTitle.getLength()+1 );
if( m_aWMAtoms[ NET_WM_ICON_NAME ] ) if( m_aWMAtoms[ NET_WM_ICON_NAME ] )
XChangeProperty( m_pDisplay, XChangeProperty( m_pDisplay,
(XLIB_Window)pEnv->aShellWindow, (XLIB_Window)pEnv->aShellWindow,
@ -1213,8 +1215,8 @@ void NetWMAdaptor::setWMName( X11SalFrame* pFrame, const String& rWMName ) const
m_aWMAtoms[ UTF8_STRING ], m_aWMAtoms[ UTF8_STRING ],
8, 8,
PropModeReplace, PropModeReplace,
(unsigned char*)aTitle.GetBuffer(), (unsigned char*)aTitle.getStr(),
aTitle.Len()+1 ); aTitle.getLength()+1 );
// The +1 copies the terminating null byte. Although // The +1 copies the terminating null byte. Although
// the spec says, this should not be necessary // the spec says, this should not be necessary
// at least the kwin implementation seems to depend // at least the kwin implementation seems to depend