Kaydet (Commit) 79c1b055 authored tarafından Matúš Kukan's avatar Matúš Kukan

Remove not used SvLockBytesInputStream

Change-Id: Id4e0852f6d204b3a1d2a7f5ce281730f5fcad8fd
üst 09186fce
...@@ -21,10 +21,7 @@ ...@@ -21,10 +21,7 @@
#define INCLUDED_SVL_STRMADPT_HXX #define INCLUDED_SVL_STRMADPT_HXX
#include <svl/svldllapi.h> #include <svl/svldllapi.h>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <cppuhelper/weak.hxx>
#include <tools/stream.hxx> #include <tools/stream.hxx>
...@@ -64,64 +61,6 @@ public: ...@@ -64,64 +61,6 @@ public:
virtual void Terminate() SAL_OVERRIDE; virtual void Terminate() SAL_OVERRIDE;
}; };
class SVL_DLLPUBLIC SvLockBytesInputStream: public cppu::OWeakObject,
public com::sun::star::io::XInputStream,
public com::sun::star::io::XSeekable
{
SvLockBytesRef m_xLockBytes;
sal_Int64 m_nPosition;
public:
SvLockBytesInputStream(SvLockBytes * pTheLockBytes):
m_xLockBytes(pTheLockBytes), m_nPosition(0) {}
virtual com::sun::star::uno::Any SAL_CALL
queryInterface(const com::sun::star::uno::Type & rType)
throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
virtual void SAL_CALL release() throw() SAL_OVERRIDE;
virtual sal_Int32 SAL_CALL
readBytes(com::sun::star::uno::Sequence< sal_Int8 > & rData,
sal_Int32 nBytesToRead)
throw (com::sun::star::io::IOException,
com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual sal_Int32 SAL_CALL
readSomeBytes(com::sun::star::uno::Sequence< sal_Int8 > & rData,
sal_Int32 nMaxBytesToRead)
throw (com::sun::star::io::IOException,
com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip)
throw (com::sun::star::io::IOException,
com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual sal_Int32 SAL_CALL available()
throw (com::sun::star::io::IOException,
com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL closeInput()
throw (com::sun::star::io::IOException,
com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL seek(sal_Int64 nLocation)
throw (com::sun::star::lang::IllegalArgumentException,
com::sun::star::io::IOException,
com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual sal_Int64 SAL_CALL getPosition()
throw (com::sun::star::io::IOException,
com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual sal_Int64 SAL_CALL getLength()
throw (com::sun::star::io::IOException,
com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
};
#endif // INCLUDED_SVL_STRMADPT_HXX #endif // INCLUDED_SVL_STRMADPT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -25,6 +25,9 @@ ...@@ -25,6 +25,9 @@
#include <set> #include <set>
#include <string.h> #include <string.h>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <rtl/alloc.h> #include <rtl/alloc.h>
#include <cppuhelper/queryinterface.hxx> #include <cppuhelper/queryinterface.hxx>
...@@ -235,182 +238,6 @@ void SvOutputStreamOpenLockBytes::Terminate() ...@@ -235,182 +238,6 @@ void SvOutputStreamOpenLockBytes::Terminate()
} }
// SvLockBytesInputStream
// virtual
uno::Any SAL_CALL SvLockBytesInputStream::queryInterface(uno::Type const &
rType)
throw (uno::RuntimeException, std::exception)
{
uno::Any
aReturn(cppu::queryInterface(rType,
static_cast< io::XInputStream * >(this),
static_cast< io::XSeekable * >(this)));
return aReturn.hasValue() ? aReturn : OWeakObject::queryInterface(rType);
}
// virtual
void SAL_CALL SvLockBytesInputStream::acquire() throw ()
{
OWeakObject::acquire();
}
// virtual
void SAL_CALL SvLockBytesInputStream::release() throw ()
{
OWeakObject::release();
}
// virtual
sal_Int32 SAL_CALL
SvLockBytesInputStream::readBytes(uno::Sequence< sal_Int8 > & rData,
sal_Int32 nBytesToRead)
throw (io::IOException, uno::RuntimeException, std::exception)
{
OSL_ASSERT(m_nPosition >= 0);
if (!m_xLockBytes.Is())
throw io::NotConnectedException();
if (
nBytesToRead < 0 ||
(
static_cast<sal_uInt64>(m_nPosition) > SAL_MAX_SIZE &&
nBytesToRead > 0
)
)
{
throw io::IOException();
}
rData.realloc(nBytesToRead);
sal_Int32 nSize = 0;
while (nSize < nBytesToRead)
{
sal_Size nCount;
ErrCode nError = m_xLockBytes->ReadAt(m_nPosition,
rData.getArray() + nSize,
nBytesToRead - nSize, &nCount);
if (nError != ERRCODE_NONE && nError != ERRCODE_IO_PENDING)
throw io::IOException();
m_nPosition += nCount;
nSize += nCount;
if (nError == ERRCODE_NONE && nCount == 0)
break;
}
rData.realloc(nSize);
return nSize;
}
// virtual
sal_Int32 SAL_CALL
SvLockBytesInputStream::readSomeBytes(uno::Sequence< sal_Int8 > & rData,
sal_Int32 nMaxBytesToRead)
throw (io::IOException, uno::RuntimeException, std::exception)
{
OSL_ASSERT(m_nPosition >= 0);
if (!m_xLockBytes.Is())
throw io::NotConnectedException();
if (static_cast<sal_uInt64>(m_nPosition) > SAL_MAX_SIZE
&& nMaxBytesToRead > 0)
throw io::IOException();
rData.realloc(nMaxBytesToRead);
sal_Size nCount = 0;
if (nMaxBytesToRead > 0)
{
ErrCode nError;
do
{
nError = m_xLockBytes->ReadAt(m_nPosition,
rData.getArray(),
nMaxBytesToRead,
&nCount);
if (nError != ERRCODE_NONE && nError != ERRCODE_IO_PENDING)
throw io::IOException();
m_nPosition += nCount;
}
while (nCount == 0 && nError == ERRCODE_IO_PENDING);
}
rData.realloc(sal_Int32(nCount));
return sal_Int32(nCount);
}
// virtual
void SAL_CALL SvLockBytesInputStream::skipBytes(sal_Int32 nBytesToSkip)
throw (io::IOException, uno::RuntimeException, std::exception)
{
if (!m_xLockBytes.Is())
throw io::NotConnectedException();
if (nBytesToSkip < 0)
throw io::IOException();
if (nBytesToSkip > SAL_MAX_INT64 - m_nPosition)
throw io::BufferSizeExceededException();
m_nPosition += nBytesToSkip;
}
// virtual
sal_Int32 SAL_CALL SvLockBytesInputStream::available()
throw (io::IOException, uno::RuntimeException, std::exception)
{
OSL_ASSERT(m_nPosition >= 0);
if (!m_xLockBytes.Is())
throw io::NotConnectedException();
SvLockBytesStat aStat;
if (m_xLockBytes->Stat(&aStat, SVSTATFLAG_DEFAULT) != ERRCODE_NONE)
throw io::IOException();
return aStat.nSize <= static_cast<sal_uInt64>(m_nPosition) ?
0 :
static_cast<sal_Size>(aStat.nSize - m_nPosition) <=
static_cast<sal_uInt32>(SAL_MAX_INT32) ?
static_cast<sal_Int32>(aStat.nSize - m_nPosition) :
SAL_MAX_INT32;
}
// virtual
void SAL_CALL SvLockBytesInputStream::closeInput()
throw (io::IOException, uno::RuntimeException, std::exception)
{
if (!m_xLockBytes.Is())
throw io::NotConnectedException();
m_xLockBytes = 0;
}
// virtual
void SAL_CALL SvLockBytesInputStream::seek(sal_Int64 nLocation)
throw (lang::IllegalArgumentException, io::IOException,
uno::RuntimeException, std::exception)
{
if (nLocation < 0)
throw lang::IllegalArgumentException();
if (!m_xLockBytes.Is())
throw io::NotConnectedException();
m_nPosition = nLocation;
}
// virtual
sal_Int64 SAL_CALL SvLockBytesInputStream::getPosition()
throw (io::IOException, uno::RuntimeException, std::exception)
{
if (!m_xLockBytes.Is())
throw io::NotConnectedException();
return m_nPosition;
}
// virtual
sal_Int64 SAL_CALL SvLockBytesInputStream::getLength()
throw (io::IOException, uno::RuntimeException, std::exception)
{
if (!m_xLockBytes.Is())
throw io::NotConnectedException();
SvLockBytesStat aStat;
if (m_xLockBytes->Stat(&aStat, SVSTATFLAG_DEFAULT) != ERRCODE_NONE)
throw io::IOException();
#if SAL_TYPES_SIZEOFPOINTER > 4 // avoid warnings if sal_Size < sal_Int64
if (aStat.nSize > static_cast<sal_uInt64>(SAL_MAX_INT64))
throw io::IOException();
#endif
return aStat.nSize;
}
// SvInputStream // SvInputStream
......
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