summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-10-26 09:06:55 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-10-26 12:19:35 +0200
commitf2fa3440330c8bdc352c0633a133e773b0ac0fcf (patch)
treeb3c34554a7c219031c94426c2340e9b36fc34e3e
parentb9fd0d1c42686fed09ec8781780a8ffc61198bcf (diff)
vcl: minor cleanups in pdfdocument
Change-Id: Ib1284b819d4af2e8055698be4160bbb41acba851 Reviewed-on: https://gerrit.libreoffice.org/43866 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r--include/vcl/filter/pdfdocument.hxx18
-rw-r--r--vcl/source/filter/ipdf/pdfdocument.cxx27
2 files changed, 15 insertions, 30 deletions
diff --git a/include/vcl/filter/pdfdocument.hxx b/include/vcl/filter/pdfdocument.hxx
index e36fb687e0a0..dfc13534bff8 100644
--- a/include/vcl/filter/pdfdocument.hxx
+++ b/include/vcl/filter/pdfdocument.hxx
@@ -168,9 +168,9 @@ class VCL_DLLPUBLIC PDFNameElement : public PDFElement
{
OString m_aValue;
/// Offset after the '/' token.
- sal_uInt64 m_nLocation;
+ sal_uInt64 m_nLocation = 0;
/// Length till the next token start.
- sal_uInt64 m_nLength;
+ sal_uInt64 m_nLength = 0;
public:
PDFNameElement();
bool Read(SvStream& rStream) override;
@@ -234,16 +234,16 @@ enum class XRefEntryType
/// An entry in a cross-reference stream.
struct XRefEntry
{
- XRefEntryType m_eType;
+ XRefEntryType m_eType = XRefEntryType::NOT_COMPRESSED;
/**
* Non-compressed: The byte offset of the object, starting from the
* beginning of the file.
* Compressed: The object number of the object stream in which this object is
* stored.
*/
- sal_uInt64 m_nOffset;
+ sal_uInt64 m_nOffset = 0;
/// Are changed as part of an incremental update?.
- bool m_bDirty;
+ bool m_bDirty = false;
XRefEntry();
};
@@ -308,16 +308,16 @@ class VCL_DLLPUBLIC PDFDocument
std::map<size_t, PDFTrailerElement*> m_aOffsetTrailers;
/// List of EOF offsets we know.
std::vector<size_t> m_aEOFs;
- PDFTrailerElement* m_pTrailer;
+ PDFTrailerElement* m_pTrailer = nullptr;
/// When m_pTrailer is nullptr, this can still have a dictionary.
- PDFObjectElement* m_pXRefStream;
+ PDFObjectElement* m_pXRefStream = nullptr;
/// All editing takes place in this buffer, if it happens.
SvMemoryStream m_aEditBuffer;
/// Suggest a minimal, yet free signature ID to use for the next signature.
sal_uInt32 GetNextSignature();
/// Write the signature object as part of signing.
- sal_Int32 WriteSignatureObject(const OUString& rDescription, bool bAdES, sal_uInt64& rLastByteRangeOffset, sal_Int64& rSignatureContentOffset);
+ sal_Int32 WriteSignatureObject(const OUString& rDescription, bool bAdES, sal_uInt64& rLastByteRangeOffset, sal_Int64& rContentOffset);
/// Write the appearance object as part of signing.
sal_Int32 WriteAppearanceObject();
/// Write the annot object as part of signing.
@@ -354,7 +354,7 @@ public:
/// Access to the input document, even after the input stream is gone.
SvMemoryStream& GetEditBuffer();
/// Tokenize elements from current offset.
- bool Tokenize(SvStream& rStream, TokenizeMode eMode, std::vector< std::unique_ptr<PDFElement> >& rElements, PDFObjectElement* pObject);
+ bool Tokenize(SvStream& rStream, TokenizeMode eMode, std::vector< std::unique_ptr<PDFElement> >& rElements, PDFObjectElement* pObjectElement);
/// Register an object (owned directly or indirectly by m_aElements) as a provider for a given ID.
void SetIDObject(size_t nID, PDFObjectElement* pObject);
//@}
diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx
index 619041595c6b..7689597699a4 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -123,18 +123,9 @@ public:
sal_uInt64 GetLocation() const;
};
-XRefEntry::XRefEntry()
- : m_eType(XRefEntryType::NOT_COMPRESSED),
- m_nOffset(0),
- m_bDirty(false)
-{
-}
+XRefEntry::XRefEntry() = default;
-PDFDocument::PDFDocument()
- : m_pTrailer(nullptr),
- m_pXRefStream(nullptr)
-{
-}
+PDFDocument::PDFDocument() = default;
bool PDFDocument::RemoveSignature(size_t nPosition)
{
@@ -1332,11 +1323,9 @@ size_t PDFDocument::FindStartXRef(SvStream& rStream)
it = std::search(it, aBuf.end(), aPrefix.getStr(), aPrefix.getStr() + aPrefix.getLength());
if (it == aBuf.end())
break;
- else
- {
- itLastValid = it;
- ++it;
- }
+
+ itLastValid = it;
+ ++it;
}
if (itLastValid == aBuf.end())
{
@@ -2864,11 +2853,7 @@ bool PDFEndDictionaryElement::Read(SvStream& rStream)
return true;
}
-PDFNameElement::PDFNameElement()
- : m_nLocation(0),
- m_nLength(0)
-{
-}
+PDFNameElement::PDFNameElement() = default;
bool PDFNameElement::Read(SvStream& rStream)
{