Kaydet (Commit) 16032347 authored tarafından Caolán McNamara's avatar Caolán McNamara

ByteString->rtl::OString

üst 6ccc829c
...@@ -670,12 +670,12 @@ DirEntry::DirEntry( const String& rInitName, FSysPathStyle eStyle ) ...@@ -670,12 +670,12 @@ DirEntry::DirEntry( const String& rInitName, FSysPathStyle eStyle )
return; return;
} }
ByteString aTmpName(rInitName, osl_getThreadTextEncoding()); ByteString aTmpName(rtl::OUStringToOString(rInitName, osl_getThreadTextEncoding()));
if( aTmpName.CompareIgnoreCaseToAscii("file:",5 ) == COMPARE_EQUAL ) if( aTmpName.CompareIgnoreCaseToAscii("file:",5 ) == COMPARE_EQUAL )
{ {
#ifndef BOOTSTRAP #ifndef BOOTSTRAP
DBG_WARNING( "File URLs are not permitted but accepted" ); DBG_WARNING( "File URLs are not permitted but accepted" );
aTmpName = ByteString(String(INetURLObject( rInitName ).PathToFileName()), osl_getThreadTextEncoding()); aTmpName = rtl::OUStringToOString(INetURLObject( rInitName ).PathToFileName(), osl_getThreadTextEncoding());
eStyle = FSYS_STYLE_HOST; eStyle = FSYS_STYLE_HOST;
#endif // BOOTSTRAP #endif // BOOTSTRAP
} }
...@@ -686,7 +686,7 @@ DirEntry::DirEntry( const String& rInitName, FSysPathStyle eStyle ) ...@@ -686,7 +686,7 @@ DirEntry::DirEntry( const String& rInitName, FSysPathStyle eStyle )
if ( FileBase::getFileURLFromSystemPath( OUString( rInitName ), aTmp ) == FileBase::E_None ) if ( FileBase::getFileURLFromSystemPath( OUString( rInitName ), aTmp ) == FileBase::E_None )
{ {
aOInitName = OUString( rInitName ); aOInitName = OUString( rInitName );
aTmpName = ByteString( String(aOInitName), osl_getThreadTextEncoding() ); aTmpName = rtl::OUStringToOString(aOInitName, osl_getThreadTextEncoding());
} }
#ifdef DBG_UTIL #ifdef DBG_UTIL
...@@ -730,7 +730,7 @@ DirEntry::DirEntry( const ByteString& rInitName, FSysPathStyle eStyle ) ...@@ -730,7 +730,7 @@ DirEntry::DirEntry( const ByteString& rInitName, FSysPathStyle eStyle )
{ {
#ifndef BOOTSTRAP #ifndef BOOTSTRAP
DBG_WARNING( "File URLs are not permitted but accepted" ); DBG_WARNING( "File URLs are not permitted but accepted" );
aTmpName = ByteString(String(INetURLObject( rInitName ).PathToFileName()), osl_getThreadTextEncoding()); aTmpName = rtl::OUStringToOString(INetURLObject( rInitName ).PathToFileName(), osl_getThreadTextEncoding());
eStyle = FSYS_STYLE_HOST; eStyle = FSYS_STYLE_HOST;
#endif #endif
} }
...@@ -905,12 +905,12 @@ sal_Bool DirEntry::First() ...@@ -905,12 +905,12 @@ sal_Bool DirEntry::First()
String aUniPathName( GetPath().GetFull() ); String aUniPathName( GetPath().GetFull() );
#ifndef BOOTSTRAP #ifndef BOOTSTRAP
FSysRedirector::DoRedirect( aUniPathName ); FSysRedirector::DoRedirect( aUniPathName );
ByteString aPathName(aUniPathName, osl_getThreadTextEncoding()); rtl::OString aPathName(rtl::OUStringToOString(aUniPathName, osl_getThreadTextEncoding()));
#else #else
ByteString aPathName(aUniPathName, gsl_getSystemTextEncoding()); rtl::OString aPathName(rtl::OUStringToOString(aUniPathName, gsl_getSystemTextEncoding()));
#endif #endif
DIR *pDir = opendir( (char*) aPathName.GetBuffer() ); DIR *pDir = opendir(aPathName.getStr());
if ( pDir ) if ( pDir )
{ {
#ifndef BOOTSTRAP #ifndef BOOTSTRAP
...@@ -966,7 +966,7 @@ String DirEntry::GetFull( FSysPathStyle eStyle, sal_Bool bWithDelimiter, ...@@ -966,7 +966,7 @@ String DirEntry::GetFull( FSysPathStyle eStyle, sal_Bool bWithDelimiter,
} }
else else
{ {
aRet = ByteString(GetName( eStyle ), osl_getThreadTextEncoding()); aRet = rtl::OUStringToOString(GetName(eStyle), osl_getThreadTextEncoding());
} }
//! Hack //! Hack
...@@ -1388,9 +1388,9 @@ void DirEntry::SetName( const String& rName, FSysPathStyle eFormatter ) ...@@ -1388,9 +1388,9 @@ void DirEntry::SetName( const String& rName, FSysPathStyle eFormatter )
eFlag = FSYS_FLAG_INVALID; eFlag = FSYS_FLAG_INVALID;
} }
else else
{ {
aName = ByteString(rName, osl_getThreadTextEncoding()); aName = rtl::OUStringToOString(rName, osl_getThreadTextEncoding());
} }
} }
/************************************************************************* /*************************************************************************
...@@ -1477,10 +1477,10 @@ void DirEntry::SetBase( const String& rBase, char cSep ) ...@@ -1477,10 +1477,10 @@ void DirEntry::SetBase( const String& rBase, char cSep )
{ {
// es wurde ein cSep an der Position p1 gefunden // es wurde ein cSep an der Position p1 gefunden
aName.Erase( 0, static_cast< xub_StrLen >(p1 - p0) ); aName.Erase( 0, static_cast< xub_StrLen >(p1 - p0) );
aName.Insert( ByteString(rBase, osl_getThreadTextEncoding()), 0 ); aName.Insert(ByteString(rBase, osl_getThreadTextEncoding()), 0 );
} }
else else
aName = ByteString(rBase, osl_getThreadTextEncoding()); aName = rtl::OUStringToOString(rBase, osl_getThreadTextEncoding());
} }
/************************************************************************* /*************************************************************************
...@@ -1508,7 +1508,7 @@ const DirEntry& DirEntry::SetTempNameBase( const String &rBase ) ...@@ -1508,7 +1508,7 @@ const DirEntry& DirEntry::SetTempNameBase( const String &rBase )
DirEntry aTempDir = DirEntry().TempName().GetPath(); DirEntry aTempDir = DirEntry().TempName().GetPath();
aTempDir += DirEntry( rBase ); aTempDir += DirEntry( rBase );
#ifdef UNX #ifdef UNX
ByteString aName( aTempDir.GetFull(), osl_getThreadTextEncoding()); ByteString aName(rtl::OUStringToOString(aTempDir.GetFull(), osl_getThreadTextEncoding()));
if ( access( aName.GetBuffer(), W_OK | X_OK | R_OK ) ) if ( access( aName.GetBuffer(), W_OK | X_OK | R_OK ) )
{ {
// Create the directory and only on success give all rights to // Create the directory and only on success give all rights to
...@@ -1557,7 +1557,7 @@ DirEntry DirEntry::TempName( DirEntryKind eKind ) const ...@@ -1557,7 +1557,7 @@ DirEntry DirEntry::TempName( DirEntryKind eKind ) const
if ( pWild ) if ( pWild )
{ {
if ( pParent ) if ( pParent )
aDirName = ByteString(pParent->GetFull(), osl_getThreadTextEncoding()); aDirName = rtl::OUStringToOString(pParent->GetFull(), osl_getThreadTextEncoding());
strncpy( pfx, aName.GetBuffer(), Min( (int)5, (int)(pWild-aName.GetBuffer()) ) ); strncpy( pfx, aName.GetBuffer(), Min( (int)5, (int)(pWild-aName.GetBuffer()) ) );
pfx[ pWild-aName.GetBuffer() ] = 0; pfx[ pWild-aName.GetBuffer() ] = 0;
const char *pExt = strchr( pWild, '.' ); const char *pExt = strchr( pWild, '.' );
...@@ -1571,7 +1571,7 @@ DirEntry DirEntry::TempName( DirEntryKind eKind ) const ...@@ -1571,7 +1571,7 @@ DirEntry DirEntry::TempName( DirEntryKind eKind ) const
} }
else else
{ {
aDirName = ByteString(GetFull(), osl_getThreadTextEncoding()); aDirName = rtl::OUStringToOString(GetFull(), osl_getThreadTextEncoding());
strcpy( pfx, "lo" ); strcpy( pfx, "lo" );
strcpy( ext, ".tmp" ); strcpy( ext, ".tmp" );
} }
...@@ -1651,7 +1651,7 @@ DirEntry DirEntry::TempName( DirEntryKind eKind ) const ...@@ -1651,7 +1651,7 @@ DirEntry DirEntry::TempName( DirEntryKind eKind ) const
#endif #endif
if ( FSYS_KIND_DIR == eKind ) if ( FSYS_KIND_DIR == eKind )
{ {
if ( 0 == _mkdir( ByteString(aRedirected.GetBuffer(), osl_getThreadTextEncoding()).GetBuffer() ) ) if (0 == _mkdir(rtl::OUStringToOString(aRedirected, osl_getThreadTextEncoding()).getStr()))
{ {
aRet = DirEntry( aRetVal ); aRet = DirEntry( aRetVal );
break; break;
...@@ -1660,7 +1660,7 @@ DirEntry DirEntry::TempName( DirEntryKind eKind ) const ...@@ -1660,7 +1660,7 @@ DirEntry DirEntry::TempName( DirEntryKind eKind ) const
else else
{ {
#if defined(UNX) #if defined(UNX)
if( access( ByteString(aRedirected, osl_getThreadTextEncoding()).GetBuffer(), F_OK ) ) if (access(rtl::OUStringToOString(aRedirected, osl_getThreadTextEncoding()).getStr(), F_OK))
{ {
aRet = DirEntry( aRetVal ); aRet = DirEntry( aRetVal );
break; break;
...@@ -1866,12 +1866,12 @@ sal_Bool DirEntry::MakeDir( sal_Bool bSloppy ) const ...@@ -1866,12 +1866,12 @@ sal_Bool DirEntry::MakeDir( sal_Bool bSloppy ) const
#ifndef BOOTSTRAP #ifndef BOOTSTRAP
FSysRedirector::DoRedirect( aDirName ); FSysRedirector::DoRedirect( aDirName );
#endif #endif
ByteString bDirName( aDirName, osl_getThreadTextEncoding() ); rtl::OString bDirName(rtl::OUStringToOString(aDirName, osl_getThreadTextEncoding()));
#ifdef WIN32 #ifdef WIN32
SetLastError(0); SetLastError(0);
#endif #endif
sal_Bool bResult = (0 == _mkdir( (char*) bDirName.GetBuffer() )); sal_Bool bResult = (0 == _mkdir(bDirName.getStr()));
if ( !bResult ) if ( !bResult )
{ {
// Wer hat diese Methode const gemacht ? // Wer hat diese Methode const gemacht ?
...@@ -1903,10 +1903,10 @@ FSysError DirEntry::CopyTo( const DirEntry& rDest, FSysAction nActions ) const ...@@ -1903,10 +1903,10 @@ FSysError DirEntry::CopyTo( const DirEntry& rDest, FSysAction nActions ) const
#ifdef UNX #ifdef UNX
{ {
// Hardlink anlegen // Hardlink anlegen
HACK(redirection missing) HACK(redirection missing)
ByteString aThis(GetFull(), osl_getThreadTextEncoding()); rtl::OString aThis(rtl::OUStringToOString(GetFull(), osl_getThreadTextEncoding()));
ByteString aDest(rDest.GetFull(), osl_getThreadTextEncoding()); rtl::OString aDest(rtl::OUStringToOString(rDest.GetFull(), osl_getThreadTextEncoding()));
if (link( aThis.GetBuffer(), aDest.GetBuffer() ) == -1) if (link(aThis.getStr(), aDest.getStr()) == -1)
return Sys2SolarError_Impl( errno ); return Sys2SolarError_Impl( errno );
else else
return FSYS_ERR_OK; return FSYS_ERR_OK;
...@@ -1961,8 +1961,8 @@ FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const ...@@ -1961,8 +1961,8 @@ FSysError DirEntry::MoveTo( const DirEntry& rNewName ) const
FSysRedirector::DoRedirect(aTo); FSysRedirector::DoRedirect(aTo);
#endif #endif
ByteString bFrom(aFrom, osl_getThreadTextEncoding()); ByteString bFrom(rtl::OUStringToOString(aFrom, osl_getThreadTextEncoding()));
ByteString bTo(aTo, osl_getThreadTextEncoding()); ByteString bTo(rtl::OUStringToOString(aTo, osl_getThreadTextEncoding()));
#ifdef WNT #ifdef WNT
// MoveTo nun atomar // MoveTo nun atomar
...@@ -2095,7 +2095,7 @@ FSysError DirEntry::Kill( FSysAction nActions ) const ...@@ -2095,7 +2095,7 @@ FSysError DirEntry::Kill( FSysAction nActions ) const
#ifndef BOOTSTRAP #ifndef BOOTSTRAP
FSysRedirector::DoRedirect( aTmpName ); FSysRedirector::DoRedirect( aTmpName );
#endif #endif
ByteString bTmpName( aTmpName, osl_getThreadTextEncoding()); ByteString bTmpName(rtl::OUStringToOString(aTmpName, osl_getThreadTextEncoding()));
char *pName = new char[bTmpName.Len()+2]; char *pName = new char[bTmpName.Len()+2];
strcpy( pName, bTmpName.GetBuffer() ); strcpy( pName, bTmpName.GetBuffer() );
......
...@@ -230,7 +230,7 @@ String DirEntry::GetVolume() const ...@@ -230,7 +230,7 @@ String DirEntry::GetVolume() const
aPath.ToAbs(); aPath.ToAbs();
struct stat buf; struct stat buf;
while (stat (ByteString(aPath.GetFull(), osl_getThreadTextEncoding()).GetBuffer(), &buf)) while (stat(rtl::OUStringToOString(aPath.GetFull(), osl_getThreadTextEncoding()).getStr(), &buf))
{ {
if (aPath.Level() <= 1) if (aPath.Level() <= 1)
return String(); return String();
...@@ -251,7 +251,7 @@ DirEntry DirEntry::GetDevice() const ...@@ -251,7 +251,7 @@ DirEntry DirEntry::GetDevice() const
aPath.ToAbs(); aPath.ToAbs();
struct stat buf; struct stat buf;
while (stat (ByteString(aPath.GetFull(), osl_getThreadTextEncoding()).GetBuffer(), &buf)) while (stat(rtl::OUStringToOString(aPath.GetFull(), osl_getThreadTextEncoding()).getStr(), &buf))
{ {
if (aPath.Level() <= 1) if (aPath.Level() <= 1)
return String(); return String();
...@@ -275,14 +275,14 @@ sal_Bool DirEntry::SetCWD( sal_Bool bSloppy ) const ...@@ -275,14 +275,14 @@ sal_Bool DirEntry::SetCWD( sal_Bool bSloppy ) const
DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
ByteString aPath( GetFull(), osl_getThreadTextEncoding()); rtl::OString aPath(rtl::OUStringToOString(GetFull(), osl_getThreadTextEncoding()));
if ( !chdir( aPath.GetBuffer() ) ) if (!chdir(aPath.getStr()))
{ {
return sal_True; return sal_True;
} }
else else
{ {
if ( bSloppy && !chdir(aPath.GetBuffer()) ) if (bSloppy && !chdir(aPath.getStr()))
{ {
return sal_True; return sal_True;
} }
...@@ -306,7 +306,7 @@ sal_uInt16 DirReader_Impl::Read() ...@@ -306,7 +306,7 @@ sal_uInt16 DirReader_Impl::Read()
{ {
if (!pDosDir) if (!pDosDir)
{ {
pDosDir = opendir( (char*) ByteString(aPath, osl_getThreadTextEncoding()).GetBuffer() ); pDosDir = opendir(rtl::OUStringToOString(aPath, osl_getThreadTextEncoding()).getStr());
} }
if (!pDosDir) if (!pDosDir)
...@@ -402,8 +402,8 @@ sal_Bool FileStat::Update( const DirEntry& rDirEntry, sal_Bool ) ...@@ -402,8 +402,8 @@ sal_Bool FileStat::Update( const DirEntry& rDirEntry, sal_Bool )
} }
struct stat aStat; struct stat aStat;
ByteString aPath( rDirEntry.GetFull(), osl_getThreadTextEncoding() ); rtl::OString aPath(rtl::OUStringToOString(rDirEntry.GetFull(), osl_getThreadTextEncoding()));
if ( stat( (char*) aPath.GetBuffer(), &aStat ) ) if (stat(aPath.getStr(), &aStat))
{ {
// pl: #67851# // pl: #67851#
// do this here, because an existing filename containing "wildcards" // do this here, because an existing filename containing "wildcards"
...@@ -412,10 +412,10 @@ sal_Bool FileStat::Update( const DirEntry& rDirEntry, sal_Bool ) ...@@ -412,10 +412,10 @@ sal_Bool FileStat::Update( const DirEntry& rDirEntry, sal_Bool )
// are handled badly across the whole Office // are handled badly across the whole Office
// Sonderbehandlung falls es sich um eine Wildcard handelt // Sonderbehandlung falls es sich um eine Wildcard handelt
ByteString aTempName( rDirEntry.GetName(), osl_getThreadTextEncoding() ); rtl::OString aTempName(rtl::OUStringToOString(rDirEntry.GetName(), osl_getThreadTextEncoding()));
if ( strchr( (char*) aTempName.GetBuffer(), '?' ) || if ( aTempName.indexOf('?') != -1 ||
strchr( (char*) aTempName.GetBuffer(), '*' ) || aTempName.indexOf('*') != -1 ||
strchr( (char*) aTempName.GetBuffer(), ';' ) ) aTempName.indexOf(';') != -1 )
{ {
nKindFlags = FSYS_KIND_WILD; nKindFlags = FSYS_KIND_WILD;
nError = FSYS_ERR_OK; nError = FSYS_ERR_OK;
...@@ -506,7 +506,7 @@ void FileStat::SetDateTime( const String& rFileName, ...@@ -506,7 +506,7 @@ void FileStat::SetDateTime( const String& rFileName,
struct utimbuf u_time; struct utimbuf u_time;
u_time.actime = time; u_time.actime = time;
u_time.modtime = time; u_time.modtime = time;
utime (ByteString(rFileName, osl_getThreadTextEncoding()).GetBuffer(), &u_time); utime(rtl::OUStringToOString(rFileName, osl_getThreadTextEncoding()).getStr(), &u_time);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment