diff options
author | Noel <noelgrandin@gmail.com> | 2020-10-12 09:52:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-26 07:35:36 +0100 |
commit | 4fbd63860500b2db76df4d5aedbe5e3aa31fac69 (patch) | |
tree | 5fa96dc262ba651e82244b0f9e508f79e88ea2df /writerperfect | |
parent | 62fa5bb8c1299469eacc21cb35ee670b65120713 (diff) |
switching long to a 64-bit type on 64-bit windows
(*) create a rewriting plugin to do most of the work, heavily
based on the fakebool plugin
(*) but there are still a number of "long"s in the codebase
that will need to be done by hand
(*) the plugin needs lots of handholding, due to needing to
add #include and update macros
Change-Id: I8184d7000ca482c0469514bb73178c3a1123b1e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104203
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'writerperfect')
-rw-r--r-- | writerperfect/inc/DirectoryStream.hxx | 5 | ||||
-rw-r--r-- | writerperfect/inc/WPXSvInputStream.hxx | 5 | ||||
-rw-r--r-- | writerperfect/qa/unit/WPXSvStreamTest.cxx | 6 | ||||
-rw-r--r-- | writerperfect/source/calc/MSWorksCalcImportFilter.cxx | 4 | ||||
-rw-r--r-- | writerperfect/source/common/DirectoryStream.cxx | 4 | ||||
-rw-r--r-- | writerperfect/source/common/WPXSvInputStream.cxx | 25 |
6 files changed, 26 insertions, 23 deletions
diff --git a/writerperfect/inc/DirectoryStream.hxx b/writerperfect/inc/DirectoryStream.hxx index 34075fe9fcdf..109d6cef65af 100644 --- a/writerperfect/inc/DirectoryStream.hxx +++ b/writerperfect/inc/DirectoryStream.hxx @@ -13,6 +13,7 @@ #include <librevenge-stream/librevenge-stream.h> #include <com/sun/star/uno/Reference.h> #include "writerperfectdllapi.h" +#include <tools/long.hxx> #include <memory> namespace com::sun::star::ucb @@ -44,8 +45,8 @@ public: virtual librevenge::RVNGInputStream* getSubStreamById(unsigned id) override; virtual const unsigned char* read(unsigned long numBytes, unsigned long& numBytesRead) override; - virtual int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) override; - virtual long tell() override; + virtual int seek(tools::Long offset, librevenge::RVNG_SEEK_TYPE seekType) override; + virtual tools::Long tell() override; virtual bool isEnd() override; private: diff --git a/writerperfect/inc/WPXSvInputStream.hxx b/writerperfect/inc/WPXSvInputStream.hxx index 0ac33a60ec01..becfefd1d6f5 100644 --- a/writerperfect/inc/WPXSvInputStream.hxx +++ b/writerperfect/inc/WPXSvInputStream.hxx @@ -12,6 +12,7 @@ #include <librevenge-stream/librevenge-stream.h> #include <com/sun/star/uno/Reference.h> +#include <tools/long.hxx> #include "writerperfectdllapi.h" #include <memory> @@ -39,8 +40,8 @@ public: virtual librevenge::RVNGInputStream* getSubStreamById(unsigned id) override; virtual const unsigned char* read(unsigned long numBytes, unsigned long& numBytesRead) override; - virtual int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) override; - virtual long tell() override; + virtual int seek(tools::Long offset, librevenge::RVNG_SEEK_TYPE seekType) override; + virtual tools::Long tell() override; virtual bool isEnd() override; private: diff --git a/writerperfect/qa/unit/WPXSvStreamTest.cxx b/writerperfect/qa/unit/WPXSvStreamTest.cxx index 21715229e299..75bcd1e60de7 100644 --- a/writerperfect/qa/unit/WPXSvStreamTest.cxx +++ b/writerperfect/qa/unit/WPXSvStreamTest.cxx @@ -182,7 +182,7 @@ void WPXSvStreamTest::testRead() void WPXSvStreamTest::testSeekSet() { const shared_ptr<RVNGInputStream> pInput(lcl_createStream()); - const long nLen = sizeof aText; + const tools::Long nLen = sizeof aText; // check initial state CPPUNIT_ASSERT_EQUAL(0L, pInput->tell()); @@ -220,7 +220,7 @@ void WPXSvStreamTest::testSeekSet() void WPXSvStreamTest::testSeekCur() { const shared_ptr<RVNGInputStream> pInput(lcl_createStream()); - const long nLen = sizeof aText; + const tools::Long nLen = sizeof aText; // check initial state CPPUNIT_ASSERT(!pInput->isEnd()); @@ -257,7 +257,7 @@ void WPXSvStreamTest::testSeekCur() void WPXSvStreamTest::testSeekEnd() { const shared_ptr<RVNGInputStream> pInput(lcl_createStream()); - const long nLen = sizeof aText; + const tools::Long nLen = sizeof aText; // check initial state CPPUNIT_ASSERT(!pInput->isEnd()); diff --git a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx index 83035d8b9926..6cf948e371ce 100644 --- a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx +++ b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx @@ -89,11 +89,11 @@ public: */ const unsigned char* read(unsigned long, unsigned long&) override { return nullptr; } //! returns actual offset position - long tell() override { return 0; } + tools::Long tell() override { return 0; } /*! \brief seeks to an offset position, from actual, beginning or ending position * \return 0 if ok */ - int seek(long, librevenge::RVNG_SEEK_TYPE) override { return 1; } + int seek(tools::Long, librevenge::RVNG_SEEK_TYPE) override { return 1; } //! returns true if we are at the end of the section/file bool isEnd() override { return true; } diff --git a/writerperfect/source/common/DirectoryStream.cxx b/writerperfect/source/common/DirectoryStream.cxx index 19ec454b293e..eb275abec5e5 100644 --- a/writerperfect/source/common/DirectoryStream.cxx +++ b/writerperfect/source/common/DirectoryStream.cxx @@ -211,9 +211,9 @@ const unsigned char* DirectoryStream::read(unsigned long, unsigned long& nNumByt return nullptr; } -int DirectoryStream::seek(long, librevenge::RVNG_SEEK_TYPE) { return -1; } +int DirectoryStream::seek(tools::Long, librevenge::RVNG_SEEK_TYPE) { return -1; } -long DirectoryStream::tell() { return 0; } +tools::Long DirectoryStream::tell() { return 0; } bool DirectoryStream::isEnd() { return true; } } diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx index 8a6a52f17f8f..40c50df8de5c 100644 --- a/writerperfect/source/common/WPXSvInputStream.cxx +++ b/writerperfect/source/common/WPXSvInputStream.cxx @@ -414,8 +414,8 @@ public: librevenge::RVNGInputStream* getSubStreamById(unsigned id); const unsigned char* read(unsigned long numBytes, unsigned long& numBytesRead); - int seek(long offset); - long tell(); + int seek(tools::Long offset); + tools::Long tell(); bool isEnd(); void invalidateReadBuffer(); @@ -495,7 +495,7 @@ const unsigned char* WPXSvInputStreamImpl::read(unsigned long numBytes, unsigned return reinterpret_cast<const unsigned char*>(maData.getConstArray()); } -long WPXSvInputStreamImpl::tell() +tools::Long WPXSvInputStreamImpl::tell() { if ((mnLength == 0) || !mxStream.is() || !mxSeekable.is()) return -1; @@ -504,11 +504,11 @@ long WPXSvInputStreamImpl::tell() const sal_Int64 tmpPosition = mxSeekable->getPosition(); if ((tmpPosition < 0) || (tmpPosition > LONG_MAX)) return -1; - return static_cast<long>(tmpPosition); + return static_cast<tools::Long>(tmpPosition); } } -int WPXSvInputStreamImpl::seek(long offset) +int WPXSvInputStreamImpl::seek(tools::Long offset) { if ((mnLength == 0) || !mxStream.is() || !mxSeekable.is()) return -1; @@ -723,7 +723,8 @@ void WPXSvInputStreamImpl::invalidateReadBuffer() { if (mpReadBuffer) { - seek(tell() + static_cast<long>(mnReadBufferPos) - static_cast<long>(mnReadBufferLength)); + seek(tell() + static_cast<tools::Long>(mnReadBufferPos) + - static_cast<tools::Long>(mnReadBufferLength)); mpReadBuffer = nullptr; mnReadBufferPos = 0; mnReadBufferLength = 0; @@ -881,14 +882,14 @@ const unsigned char* WPXSvInputStream::read(unsigned long numBytes, unsigned lon return mpImpl->mpReadBuffer; } -long WPXSvInputStream::tell() +tools::Long WPXSvInputStream::tell() { - long retVal = mpImpl->tell(); - return retVal - static_cast<long>(mpImpl->mnReadBufferLength) - + static_cast<long>(mpImpl->mnReadBufferPos); + tools::Long retVal = mpImpl->tell(); + return retVal - static_cast<tools::Long>(mpImpl->mnReadBufferLength) + + static_cast<tools::Long>(mpImpl->mnReadBufferPos); } -int WPXSvInputStream::seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) +int WPXSvInputStream::seek(tools::Long offset, librevenge::RVNG_SEEK_TYPE seekType) { sal_Int64 tmpOffset = offset; if (seekType == librevenge::RVNG_SEEK_CUR) @@ -913,7 +914,7 @@ int WPXSvInputStream::seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) >= static_cast<unsigned long>(mpImpl->tell()) - mpImpl->mnReadBufferLength) { mpImpl->mnReadBufferPos = static_cast<unsigned long>( - tmpOffset + static_cast<long>(mpImpl->mnReadBufferLength) - mpImpl->tell()); + tmpOffset + static_cast<tools::Long>(mpImpl->mnReadBufferLength) - mpImpl->tell()); return retVal; } |