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/source/common | |
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/source/common')
-rw-r--r-- | writerperfect/source/common/DirectoryStream.cxx | 4 | ||||
-rw-r--r-- | writerperfect/source/common/WPXSvInputStream.cxx | 25 |
2 files changed, 15 insertions, 14 deletions
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; } |