summaryrefslogtreecommitdiff
path: root/extensions/source/plugin
diff options
context:
space:
mode:
authorAndras Timar <atimar@suse.com>2013-03-29 17:13:55 +0100
committerAndras Timar <atimar@suse.com>2013-04-04 16:47:02 +0000
commit31518d86976d7b2a68a88fdcde51ae1dd9bbb826 (patch)
treecd3f7568528f6eb8df7a71fa1f0756d14bd14cd7 /extensions/source/plugin
parent06064c69f9e7fc2cbc9da98134ac0e44399d482d (diff)
writing out tools/fsys.hxx (extensions)
Change-Id: I6b2132e7441be1579f6233ec56fdaf8807a60b55 Reviewed-on: https://gerrit.libreoffice.org/3119 Reviewed-by: Andras Timar <atimar@suse.com> Tested-by: Andras Timar <atimar@suse.com>
Diffstat (limited to 'extensions/source/plugin')
-rw-r--r--extensions/source/plugin/base/context.cxx15
-rw-r--r--extensions/source/plugin/base/plcom.cxx8
-rw-r--r--extensions/source/plugin/base/xplugin.cxx41
3 files changed, 32 insertions, 32 deletions
diff --git a/extensions/source/plugin/base/context.cxx b/extensions/source/plugin/base/context.cxx
index a4992014317f..1a3b532548f5 100644
--- a/extensions/source/plugin/base/context.cxx
+++ b/extensions/source/plugin/base/context.cxx
@@ -48,8 +48,8 @@
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/frame/Desktop.hpp>
-#include <tools/fsys.hxx>
#include <tools/urlobj.hxx>
+#include <osl/file.hxx>
#include <cppuhelper/implbase1.hxx>
@@ -203,7 +203,7 @@ void XPluginContext_Impl::postURL(const Reference< ::com::sun::star::plugin::XPl
if( file )
{
- String aFileName( (char*)buf.getConstArray(), m_aEncoding );
+ OUString aFileName( (char*)buf.getConstArray(), strlen((char*)buf.getConstArray()), m_aEncoding );
INetURLObject aFilePath( aFileName );
aFileName = aFilePath.PathToFileName();
SvFileStream aStream( aFileName, STREAM_READ );
@@ -215,7 +215,8 @@ void XPluginContext_Impl::postURL(const Reference< ::com::sun::star::plugin::XPl
aStream.Seek( STREAM_SEEK_TO_BEGIN );
aStream.Read( aBuf.getArray(), nBytes );
aStream.Close();
- DirEntry( aFileName ).Kill();
+ osl::FileBase::getFileURLFromSystemPath( aFileName, aFileName );
+ osl::File::remove( aFileName );
}
}
@@ -278,9 +279,8 @@ FileSink::FileSink( const Reference< ::com::sun::star::uno::XComponentContext >
m_aMIMEType( mimetype ),
m_aTarget( target )
{
- DirEntry aEntry;
- m_aFileName = aEntry.TempName().GetFull();
- ::rtl::OString aFile = ::rtl::OUStringToOString( m_aFileName, osl_getThreadTextEncoding() );
+ osl::FileBase::createTempFile( 0, 0, &m_aFileName );
+ OString aFile = OUStringToOString( m_aFileName, osl_getThreadTextEncoding() );
fp = fopen( aFile.getStr() , "wb" );
Reference< ::com::sun::star::io::XActiveDataControl > xControl( source, UNO_QUERY );
@@ -292,8 +292,7 @@ FileSink::FileSink( const Reference< ::com::sun::star::uno::XComponentContext >
FileSink::~FileSink()
{
- DirEntry aEntry( m_aFileName );
- aEntry.Kill();
+ osl::File::remove( m_aFileName );
}
void FileSink::closeOutput() throw()
diff --git a/extensions/source/plugin/base/plcom.cxx b/extensions/source/plugin/base/plcom.cxx
index 4239c857187f..11fc4e30b765 100644
--- a/extensions/source/plugin/base/plcom.cxx
+++ b/extensions/source/plugin/base/plcom.cxx
@@ -45,7 +45,7 @@
#include <cstdarg>
-#include <tools/fsys.hxx>
+#include <osl/file.hxx>
#include <plugin/impl.hxx>
PluginComm::PluginComm( const ::rtl::OString& rLibName, bool bReusable ) :
@@ -61,10 +61,10 @@ PluginComm::~PluginComm()
PluginManager::get().getPluginComms().remove( this );
while( m_aFilesToDelete.size() )
{
- String aFile = m_aFilesToDelete.front();
+ OUString aFile( m_aFilesToDelete.front() );
m_aFilesToDelete.pop_front();
- DirEntry aEntry( aFile );
- aEntry.Kill();
+ osl::FileBase::getFileURLFromSystemPath( aFile, aFile );
+ osl::File::remove( aFile );
}
}
diff --git a/extensions/source/plugin/base/xplugin.cxx b/extensions/source/plugin/base/xplugin.cxx
index 24fa2c75a871..5e96bee3a39e 100644
--- a/extensions/source/plugin/base/xplugin.cxx
+++ b/extensions/source/plugin/base/xplugin.cxx
@@ -45,7 +45,6 @@
#include <comphelper/processfactory.hxx>
#include <plugin/impl.hxx>
-#include <tools/fsys.hxx>
#include <ucbhelper/content.hxx>
#include <tools/urlobj.hxx>
#include <tools/string.hxx>
@@ -68,9 +67,6 @@ using namespace com::sun::star::beans;
using namespace com::sun::star::plugin;
using namespace osl;
-using ::rtl::OUString;
-using ::rtl::OString;
-
class PluginDisposer : public salhelper::Timer
{
private:
@@ -100,8 +96,6 @@ void PluginDisposer::onShot()
release();
}
-//==================================================================================================
-
Any XPlugin_Impl::queryInterface( const Type& type ) throw( RuntimeException )
{
return OWeakAggObject::queryInterface( type );
@@ -964,20 +958,27 @@ PluginInputStream::PluginInputStream( XPlugin_Impl* pPlugin,
Guard< Mutex > aGuard( m_pPlugin->getMutex() );
m_pPlugin->getInputStreams().push_back( this );
- DirEntry aEntry;
- aEntry = aEntry.TempName();
+ OUString aTmpFile;
+ osl::FileBase::createTempFile( 0, 0, &aTmpFile );
// set correct extension, some plugins need that
- DirEntry aName( String( m_aNPStream.url, m_pPlugin->getTextEncoding() ) );
- String aExtension = aName.GetExtension();
- if( aExtension.Len() )
- aEntry.SetExtension( aExtension );
- m_aFileStream.Open( aEntry.GetFull(), STREAM_READ | STREAM_WRITE );
+ OUString aName( m_aNPStream.url, strlen( m_aNPStream.url ), m_pPlugin->getTextEncoding() );
+ OUString aExtension;
+ sal_Int32 nSepInd = aName.lastIndexOf(".");
+ if( nSepInd != -1 )
+ {
+ aExtension = aName.copy( nSepInd + 1, aName.getLength() - nSepInd - 1 );
+ }
+ if( !aExtension.isEmpty() )
+ {
+ aTmpFile += aExtension;
+ }
+ m_aFileStream.Open( aTmpFile, STREAM_READ | STREAM_WRITE );
if( ! m_aFileStream.IsOpen() )
{
- // #74808# might be that the extension scrambled the whole filename
- aEntry = aEntry.TempName();
- m_aFileStream.Open( aEntry.GetFull(), STREAM_READ | STREAM_WRITE );
+ // might be that the extension scrambled the whole filename
+ osl::FileBase::createTempFile( 0, 0, &aTmpFile );
+ m_aFileStream.Open( aTmpFile, STREAM_READ | STREAM_WRITE );
}
}
@@ -987,12 +988,12 @@ PluginInputStream::~PluginInputStream()
m_pPlugin->getInputStreams().remove( this );
- String aFile( m_aFileStream.GetFileName() );
+ OUString aFile( m_aFileStream.GetFileName() );
m_aFileStream.Close();
if( m_pPlugin )
{
- rtl::OString aFileName(rtl::OUStringToOString(aFile, m_pPlugin->getTextEncoding()));
+ OString aFileName(OUStringToOString(aFile, m_pPlugin->getTextEncoding()));
if( m_pPlugin->getPluginComm() && m_nMode != -1 )
// mode -1 means either an error occurred,
// or the plugin is already disposing
@@ -1009,10 +1010,10 @@ PluginInputStream::~PluginInputStream()
m_pPlugin->getInputStreams().remove( this );
}
else
- DirEntry( m_aFileStream.GetFileName() ).Kill();
+ osl::File::remove( aFile );
}
else
- DirEntry( m_aFileStream.GetFileName() ).Kill();
+ osl::File::remove( aFile );
if( m_pContent )
delete m_pContent;
}