glib/poppler-action.cc | 14 +++++----- glib/poppler-annot.cc | 18 +++++++------- glib/poppler-document.cc | 2 - glib/poppler-form-field.cc | 4 +-- glib/poppler-private.h | 2 - poppler/Annot.cc | 16 ++++++------ poppler/Annot.h | 54 +++++++++++++++++++++--------------------- poppler/Catalog.cc | 5 ++- poppler/Catalog.h | 5 ++- poppler/Form.cc | 6 ++-- poppler/Form.h | 6 ++-- poppler/Link.h | 23 +++++++++-------- poppler/PDFDoc.h | 3 +- poppler/UTF.cc | 3 +- poppler/UTF.h | 3 +- qt5/src/poppler-annotation.cc | 5 ++- qt5/src/poppler-document.cc | 9 ++++++- qt5/src/poppler-form.cc | 4 +-- qt5/src/poppler-page.cc | 2 - qt5/src/poppler-private.cc | 4 +-- qt5/src/poppler-private.h | 4 +-- qt5/src/poppler-qt5.h | 7 +++++ utils/JSInfo.cc | 7 +++-- utils/JSInfo.h | 3 +- 24 files changed, 116 insertions(+), 93 deletions(-)
New commits: commit 0a79dc3036111e86a11bd290057da6674da3b311 Author: Albert Astals Cid <[email protected]> Date: Thu Apr 5 18:15:33 2018 +0200 Add some more const diff --git a/glib/poppler-action.cc b/glib/poppler-action.cc index b9e05244..ff31e52b 100644 --- a/glib/poppler-action.cc +++ b/glib/poppler-action.cc @@ -317,7 +317,7 @@ dest_new_goto (PopplerDocument *document, } static PopplerDest * -dest_new_named (GooString *named_dest) +dest_new_named (const GooString *named_dest) { PopplerDest *dest; @@ -340,7 +340,7 @@ build_goto_dest (PopplerDocument *document, LinkGoTo *link) { LinkDest *link_dest; - GooString *named_dest; + const GooString *named_dest; /* Return if it isn't OK */ if (! link->isOk ()) { @@ -365,7 +365,7 @@ build_goto_remote (PopplerAction *action, LinkGoToR *link) { LinkDest *link_dest; - GooString *named_dest; + const GooString *named_dest; /* Return if it isn't OK */ if (! link->isOk ()) { @@ -403,7 +403,7 @@ static void build_uri (PopplerAction *action, LinkURI *link) { - gchar *uri; + const gchar *uri; uri = link->getURI()->getCString (); if (uri != nullptr) @@ -414,7 +414,7 @@ static void build_named (PopplerAction *action, LinkNamed *link) { - gchar *name; + const gchar *name; name = link->getName ()->getCString (); if (name != nullptr) @@ -434,7 +434,7 @@ find_annot_movie_for_action (PopplerDocument *document, annotObj = xref->fetch (ref->num, ref->gen); } else if (link->hasAnnotTitle ()) { - GooString *title = link->getAnnotTitle (); + const GooString *title = link->getAnnotTitle (); int i; for (i = 1; i <= document->doc->getNumPages (); ++i) { @@ -521,7 +521,7 @@ static void build_javascript (PopplerAction *action, LinkJavaScript *link) { - GooString *script; + const GooString *script; script = link->getScript(); if (script) diff --git a/glib/poppler-annot.cc b/glib/poppler-annot.cc index 929135aa..74e3e66e 100644 --- a/glib/poppler-annot.cc +++ b/glib/poppler-annot.cc @@ -793,7 +793,7 @@ poppler_annot_get_annot_type (PopplerAnnot *poppler_annot) gchar * poppler_annot_get_contents (PopplerAnnot *poppler_annot) { - GooString *contents; + const GooString *contents; g_return_val_if_fail (POPPLER_IS_ANNOT (poppler_annot), NULL); @@ -841,7 +841,7 @@ poppler_annot_set_contents (PopplerAnnot *poppler_annot, gchar * poppler_annot_get_name (PopplerAnnot *poppler_annot) { - GooString *name; + const GooString *name; g_return_val_if_fail (POPPLER_IS_ANNOT (poppler_annot), NULL); @@ -864,7 +864,7 @@ poppler_annot_get_name (PopplerAnnot *poppler_annot) gchar * poppler_annot_get_modified (PopplerAnnot *poppler_annot) { - GooString *text; + const GooString *text; g_return_val_if_fail (POPPLER_IS_ANNOT (poppler_annot), NULL); @@ -1073,7 +1073,7 @@ gchar * poppler_annot_markup_get_label (PopplerAnnotMarkup *poppler_annot) { AnnotMarkup *annot; - GooString *text; + const GooString *text; g_return_val_if_fail (POPPLER_IS_ANNOT_MARKUP (poppler_annot), NULL); @@ -1338,7 +1338,7 @@ GDate * poppler_annot_markup_get_date (PopplerAnnotMarkup *poppler_annot) { AnnotMarkup *annot; - GooString *annot_date; + const GooString *annot_date; time_t timet; g_return_val_if_fail (POPPLER_IS_ANNOT_MARKUP (poppler_annot), NULL); @@ -1372,7 +1372,7 @@ gchar * poppler_annot_markup_get_subject (PopplerAnnotMarkup *poppler_annot) { AnnotMarkup *annot; - GooString *text; + const GooString *text; g_return_val_if_fail (POPPLER_IS_ANNOT_MARKUP (poppler_annot), NULL); @@ -1498,7 +1498,7 @@ gchar * poppler_annot_text_get_icon (PopplerAnnotText *poppler_annot) { AnnotText *annot; - GooString *text; + const GooString *text; g_return_val_if_fail (POPPLER_IS_ANNOT_TEXT (poppler_annot), NULL); @@ -1776,7 +1776,7 @@ gchar * poppler_annot_file_attachment_get_name (PopplerAnnotFileAttachment *poppler_annot) { AnnotFileAttachment *annot; - GooString *name; + const GooString *name; g_return_val_if_fail (POPPLER_IS_ANNOT_FILE_ATTACHMENT (poppler_annot), NULL); @@ -1855,7 +1855,7 @@ gchar * poppler_annot_movie_get_title (PopplerAnnotMovie *poppler_annot) { AnnotMovie *annot; - GooString *title; + const GooString *title; g_return_val_if_fail (POPPLER_IS_ANNOT_MOVIE (poppler_annot), NULL); diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc index fe33649d..98fa10e9 100644 --- a/glib/poppler-document.cc +++ b/glib/poppler-document.cc @@ -2891,7 +2891,7 @@ poppler_document_get_form_field (PopplerDocument *document, } gboolean -_poppler_convert_pdf_date_to_gtime (GooString *date, +_poppler_convert_pdf_date_to_gtime (const GooString *date, time_t *gdate) { gchar *date_string; diff --git a/glib/poppler-form-field.cc b/glib/poppler-form-field.cc index b5b15995..982ce149 100644 --- a/glib/poppler-form-field.cc +++ b/glib/poppler-form-field.cc @@ -267,7 +267,7 @@ poppler_form_field_button_set_state (PopplerFormField *field, gchar* poppler_form_field_get_partial_name (PopplerFormField *field) { - GooString *tmp; + const GooString *tmp; g_return_val_if_fail (POPPLER_IS_FORM_FIELD (field), NULL); @@ -290,7 +290,7 @@ poppler_form_field_get_partial_name (PopplerFormField *field) gchar* poppler_form_field_get_mapping_name (PopplerFormField *field) { - GooString *tmp; + const GooString *tmp; g_return_val_if_fail (POPPLER_IS_FORM_FIELD (field), NULL); diff --git a/glib/poppler-private.h b/glib/poppler-private.h index 6c9a6f2f..7a0225d7 100644 --- a/glib/poppler-private.h +++ b/glib/poppler-private.h @@ -136,7 +136,7 @@ PopplerAnnot *_poppler_annot_circle_new (Annot *annot); PopplerAnnot *_poppler_annot_square_new (Annot *annot); char *_poppler_goo_string_to_utf8(const GooString *s); -gboolean _poppler_convert_pdf_date_to_gtime (GooString *date, +gboolean _poppler_convert_pdf_date_to_gtime (const GooString *date, time_t *gdate); /* diff --git a/poppler/Annot.cc b/poppler/Annot.cc index dc07f880..56ed573f 100644 --- a/poppler/Annot.cc +++ b/poppler/Annot.cc @@ -1610,7 +1610,7 @@ Annot::~Annot() { #endif } -void Annot::setDrawColor(AnnotColor *drawColor, GBool fill) { +void Annot::setDrawColor(const AnnotColor *drawColor, GBool fill) { const double *values = drawColor->getValues(); switch (drawColor->getSpace()) { @@ -4645,7 +4645,7 @@ void AnnotWidget::drawBorder() { AnnotColor adjustedColor; double w = border->getWidth(); - AnnotColor *aColor = appearCharacs->getBorderColor(); + const AnnotColor *aColor = appearCharacs->getBorderColor(); if (!aColor) aColor = appearCharacs->getBackColor(); if (!aColor) @@ -4744,7 +4744,7 @@ void AnnotWidget::drawBorder() { } void AnnotWidget::drawFormFieldButton(GfxResources *resources, GooString *da) { - GooString *caption = nullptr; + const GooString *caption = nullptr; if (appearCharacs) caption = appearCharacs->getNormalCaption(); @@ -4757,7 +4757,7 @@ void AnnotWidget::drawFormFieldButton(GfxResources *resources, GooString *da) { drawText(caption, da, resources, gFalse, 0, fieldQuadCenter, gFalse, gTrue); } else if (appearCharacs) { - AnnotColor *aColor = appearCharacs->getBorderColor(); + const AnnotColor *aColor = appearCharacs->getBorderColor(); if (aColor) { double dx = rect->x2 - rect->x1; double dy = rect->y2 - rect->y1; @@ -4830,7 +4830,7 @@ void AnnotWidget::generateFieldAppearance() { // draw the background if (appearCharacs) { - AnnotColor *aColor = appearCharacs->getBackColor(); + const AnnotColor *aColor = appearCharacs->getBackColor(); if (aColor) { setDrawColor(aColor, gTrue); appearBuf->appendf("0 0 {0:.2f} {1:.2f} re f\n", @@ -6580,7 +6580,7 @@ AnnotRichMedia::Asset::~Asset() delete name; } -GooString* AnnotRichMedia::Asset::getName() const { +const GooString* AnnotRichMedia::Asset::getName() const { return name; } @@ -6679,7 +6679,7 @@ AnnotRichMedia::Instance* AnnotRichMedia::Configuration::getInstance(int index) return instances[index]; } -GooString* AnnotRichMedia::Configuration::getName() const { +const GooString* AnnotRichMedia::Configuration::getName() const { return name; } @@ -6740,7 +6740,7 @@ AnnotRichMedia::Params::~Params() delete flashVars; } -GooString* AnnotRichMedia::Params::getFlashVars() const { +const GooString* AnnotRichMedia::Params::getFlashVars() const { return flashVars; } diff --git a/poppler/Annot.h b/poppler/Annot.h index bfc852cc..772517db 100644 --- a/poppler/Annot.h +++ b/poppler/Annot.h @@ -445,14 +445,14 @@ public: AnnotAppearanceCharacs(const AnnotAppearanceCharacs &) = delete; AnnotAppearanceCharacs& operator=(const AnnotAppearanceCharacs &) = delete; - int getRotation() { return rotation; } - AnnotColor *getBorderColor() { return borderColor; } - AnnotColor *getBackColor() { return backColor; } - GooString *getNormalCaption() { return normalCaption; } - GooString *getRolloverCaption() { return rolloverCaption; } - GooString *getAlternateCaption() { return alternateCaption; } - AnnotIconFit *getIconFit() { return iconFit; } - AnnotAppearanceCharacsTextPos getPosition() { return position; } + int getRotation() const { return rotation; } + const AnnotColor *getBorderColor() const { return borderColor; } + const AnnotColor *getBackColor() const { return backColor; } + const GooString *getNormalCaption() const { return normalCaption; } + const GooString *getRolloverCaption() const { return rolloverCaption; } + const GooString *getAlternateCaption() const { return alternateCaption; } + const AnnotIconFit *getIconFit() const { return iconFit; } + AnnotAppearanceCharacsTextPos getPosition() const { return position; } protected: @@ -618,13 +618,13 @@ public: AnnotSubtype getType() const { return type; } PDFRectangle *getRect() const { return rect; } void getRect(double *x1, double *y1, double *x2, double *y2) const; - GooString *getContents() const { return contents; } + const GooString *getContents() const { return contents; } int getPageNum() const { return page; } - GooString *getName() const { return name; } - GooString *getModified() const { return modified; } + const GooString *getName() const { return name; } + const GooString *getModified() const { return modified; } Guint getFlags() const { return flags; } AnnotAppearance *getAppearStreams() const { return appearStreams; } - GooString *getAppearState() const { return appearState; } + const GooString *getAppearState() const { return appearState; } AnnotBorder *getBorder() const { return border; } AnnotColor *getColor() const { return color; } int getTreeKey() const { return treeKey; } @@ -645,7 +645,7 @@ private: protected: virtual ~Annot(); virtual void removeReferencedObjects(); // Called by Page::removeAnnot - void setDrawColor(AnnotColor *color, GBool fill); + void setDrawColor(const AnnotColor *color, GBool fill); void setLineStyleForBorder(AnnotBorder *border); void drawCircle(double cx, double cy, double r, GBool fill); void drawCircleTopLeft(double cx, double cy, double r); @@ -743,13 +743,13 @@ public: ~AnnotMarkup(); // getters - GooString *getLabel() const { return label; } + const GooString *getLabel() const { return label; } AnnotPopup *getPopup() const { return popup; } double getOpacity() const { return opacity; } // getRC - GooString *getDate() const { return date; } + const GooString *getDate() const { return date; } int getInReplyToID() const { return inReplyTo.num; } - GooString *getSubject() const { return subject; } + const GooString *getSubject() const { return subject; } AnnotMarkupReplyType getReplyTo() const { return replyTo; } AnnotExternalDataType getExData() const { return exData; } @@ -806,7 +806,7 @@ public: // getters GBool getOpen() const { return open; } - GooString *getIcon() const { return icon; } + const GooString *getIcon() const { return icon; } AnnotTextState getState() const { return state; } void setOpen(GBool openA); @@ -837,7 +837,7 @@ class AnnotMovie: public Annot { void draw(Gfx *gfx, GBool printing) override; - GooString* getTitle() { return title; } + const GooString* getTitle() const { return title; } Movie* getMovie() { return movie; } private: @@ -859,7 +859,7 @@ class AnnotScreen: public Annot { AnnotScreen(PDFDoc *docA, Object *dictObject, Object *obj); ~AnnotScreen(); - GooString* getTitle() { return title; } + const GooString* getTitle() const { return title; } AnnotAppearanceCharacs *getAppearCharacs() { return appearCharacs; } LinkAction* getAction() { return action; } // The caller should now delete the result @@ -948,10 +948,10 @@ public: void setIntent(AnnotFreeTextIntent new_intent); // getters - GooString *getAppearanceString() const { return appearanceString; } + const GooString *getAppearanceString() const { return appearanceString; } AnnotFreeTextQuadding getQuadding() const { return quadding; } // return rc - GooString *getStyleString() const { return styleString; } + const GooString *getStyleString() const { return styleString; } AnnotCalloutLine *getCalloutLine() const { return calloutLine; } AnnotFreeTextIntent getIntent() const { return intent; } AnnotBorderEffect *getBorderEffect() const { return borderEffect; } @@ -1097,7 +1097,7 @@ public: void setIcon(GooString *new_icon); // getters - GooString *getIcon() const { return icon; } + const GooString *getIcon() const { return icon; } private: @@ -1267,7 +1267,7 @@ public: // getters Object *getFile() { return &file; } - GooString *getName() const { return name; } + const GooString *getName() const { return name; } private: @@ -1295,7 +1295,7 @@ public: // getters Sound *getSound() { return sound; } - GooString *getName() const { return name; } + const GooString *getName() const { return name; } private: @@ -1439,7 +1439,7 @@ public: Params(const Params &) = delete; Params& operator=(const Params &) = delete; - GooString* getFlashVars() const; + const GooString* getFlashVars() const; private: // optional @@ -1486,7 +1486,7 @@ public: Configuration& operator=(const Configuration &) = delete; Type getType() const; - GooString* getName() const; + const GooString* getName() const; int getInstancesCount() const; Instance* getInstance(int index) const; @@ -1508,7 +1508,7 @@ public: Asset(const Asset &) = delete; Asset& operator=(const Asset &) = delete; - GooString* getName() const; + const GooString* getName() const; Object* getFileSpec() const; private: diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc index c423dea2..d259bda6 100644 --- a/poppler/Catalog.cc +++ b/poppler/Catalog.cc @@ -33,6 +33,7 @@ // Copyright (C) 2014 Ed Porras <[email protected]> // Copyright (C) 2015 Even Rouault <[email protected]> // Copyright (C) 2016 Masamichi Hosoda <[email protected]> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <[email protected]>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -382,7 +383,7 @@ int Catalog::findPage(int num, int gen) { return 0; } -LinkDest *Catalog::findDest(GooString *name) { +LinkDest *Catalog::findDest(const GooString *name) { // try named destination dictionary then name tree if (getDests()->isDict()) { Object obj1 = getDests()->dictLookup(name->getCString()); @@ -684,7 +685,7 @@ int NameTree::Entry::cmp(const void *voidKey, const void *voidEntry) return key->cmp(&entry->name); } -Object NameTree::lookup(GooString *name) +Object NameTree::lookup(const GooString *name) { Entry **entry; diff --git a/poppler/Catalog.h b/poppler/Catalog.h index 4acb67fc..0467159a 100644 --- a/poppler/Catalog.h +++ b/poppler/Catalog.h @@ -26,6 +26,7 @@ // Copyright (C) 2013, 2017 Adrian Johnson <[email protected]> // Copyright (C) 2013 José Aliste <[email protected]> // Copyright (C) 2016 Masamichi Hosoda <[email protected]> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <[email protected]>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -73,7 +74,7 @@ public: NameTree& operator=(const NameTree &) = delete; void init(XRef *xref, Object *tree); - Object lookup(GooString *name); + Object lookup(const GooString *name); int numEntries() { return length; }; // iterator accessor, note it returns a pointer to the internal object, do not free nor delete it Object *getValue(int i); @@ -154,7 +155,7 @@ public: // Find a named destination. Returns the link destination, or // NULL if <name> is not a destination. - LinkDest *findDest(GooString *name); + LinkDest *findDest(const GooString *name); Object *getDests(); diff --git a/poppler/Form.cc b/poppler/Form.cc index 8e6ca9a4..673b606f 100644 --- a/poppler/Form.cc +++ b/poppler/Form.cc @@ -153,7 +153,7 @@ void FormWidget::decodeID (unsigned id, unsigned* pageNum, unsigned* fieldNum) *fieldNum = (id << 4*sizeof(unsigned)) >> 4*sizeof(unsigned); } -GooString *FormWidget::getPartialName() const { +const GooString *FormWidget::getPartialName() const { return field->getPartialName(); } @@ -162,11 +162,11 @@ void FormWidget::setPartialName(const GooString &name) field->setPartialName(name); } -GooString *FormWidget::getAlternateUiName() const { +const GooString *FormWidget::getAlternateUiName() const { return field->getAlternateUiName(); } -GooString *FormWidget::getMappingName() const { +const GooString *FormWidget::getMappingName() const { return field->getMappingName(); } diff --git a/poppler/Form.h b/poppler/Form.h index 83aaeb03..c70a4b83 100644 --- a/poppler/Form.h +++ b/poppler/Form.h @@ -111,10 +111,10 @@ public: double getFontSize() const; - GooString *getPartialName() const; + const GooString *getPartialName() const; void setPartialName(const GooString &name); - GooString *getAlternateUiName() const; - GooString *getMappingName() const; + const GooString *getAlternateUiName() const; + const GooString *getMappingName() const; GooString *getFullyQualifiedName(); GBool isModified () const; diff --git a/poppler/Link.h b/poppler/Link.h index 05892cff..d6d1f988 100644 --- a/poppler/Link.h +++ b/poppler/Link.h @@ -18,6 +18,7 @@ // Copyright (C) 2010, 2011 Carlos Garcia Campos <[email protected]> // Copyright (C) 2012 Tobias Koening <[email protected]> // Copyright (C) 2018 Albert Astals Cid <[email protected]> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <[email protected]>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -163,7 +164,7 @@ public: // Accessors. LinkActionKind getKind() override { return actionGoTo; } LinkDest *getDest() { return dest; } - GooString *getNamedDest() { return namedDest; } + const GooString *getNamedDest() const { return namedDest; } private: @@ -192,9 +193,9 @@ public: // Accessors. LinkActionKind getKind() override { return actionGoToR; } - GooString *getFileName() { return fileName; } + const GooString *getFileName() const { return fileName; } LinkDest *getDest() { return dest; } - GooString *getNamedDest() { return namedDest; } + const GooString *getNamedDest() const { return namedDest; } private: @@ -223,8 +224,8 @@ public: // Accessors. LinkActionKind getKind() override { return actionLaunch; } - GooString *getFileName() { return fileName; } - GooString *getParams() { return params; } + const GooString *getFileName() const { return fileName; } + const GooString *getParams() const { return params; } private: @@ -250,7 +251,7 @@ public: // Accessors. LinkActionKind getKind() override { return actionURI; } - GooString *getURI() { return uri; } + const GooString *getURI() const { return uri; } private: @@ -272,7 +273,7 @@ public: GBool isOk() override { return name != NULL; } LinkActionKind getKind() override { return actionNamed; } - GooString *getName() { return name; } + const GooString *getName() const { return name; } private: @@ -306,7 +307,7 @@ public: GBool hasAnnotRef() { return annotRef.num >= 0; } GBool hasAnnotTitle() { return annotTitle != NULL; } Ref *getAnnotRef() { return &annotRef; } - GooString *getAnnotTitle() { return annotTitle; } + const GooString *getAnnotTitle() const { return annotTitle; } OperationType getOperation() { return operation; } @@ -354,7 +355,7 @@ public: MediaRendition* getMedia() { return media; } - GooString *getScript() { return js; } + const GooString *getScript() const { return js; } private: @@ -412,7 +413,7 @@ public: GBool isOk() override { return js != NULL; } LinkActionKind getKind() override { return actionJavaScript; } - GooString *getScript() { return js; } + const GooString *getScript() const { return js; } private: @@ -468,7 +469,7 @@ public: // Accessors. LinkActionKind getKind() override { return actionUnknown; } - GooString *getAction() { return action; } + const GooString *getAction() const { return action; } private: diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h index 5af54777..412dafab 100644 --- a/poppler/PDFDoc.h +++ b/poppler/PDFDoc.h @@ -30,6 +30,7 @@ // Copyright (C) 2015 André Guerreiro <[email protected]> // Copyright (C) 2015 André Esser <[email protected]> // Copyright (C) 2016 Jakub Alba <[email protected]> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <[email protected]>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -192,7 +193,7 @@ public: // Find a named destination. Returns the link destination, or // NULL if <name> is not a destination. - LinkDest *findDest(GooString *name) + LinkDest *findDest(const GooString *name) { return catalog->findDest(name); } // Process the links for a page. diff --git a/poppler/UTF.cc b/poppler/UTF.cc index da2faad1..a2003bff 100644 --- a/poppler/UTF.cc +++ b/poppler/UTF.cc @@ -18,6 +18,7 @@ // Copyright (C) 2012 Hib Eris <[email protected]> // Copyright (C) 2016, 2018 Albert Astals Cid <[email protected]> // Copyright (C) 2016 Jason Crain <[email protected]> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <[email protected]>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -85,7 +86,7 @@ int UTF16toUCS4(const Unicode *utf16, int utf16Len, Unicode **ucs4) return len; } -int TextStringToUCS4(GooString *textStr, Unicode **ucs4) +int TextStringToUCS4(const GooString *textStr, Unicode **ucs4) { int i, len; const char *s; diff --git a/poppler/UTF.h b/poppler/UTF.h index 704ba4de..a86c056d 100644 --- a/poppler/UTF.h +++ b/poppler/UTF.h @@ -6,6 +6,7 @@ // // Copyright (C) 2012, 2017 Adrian Johnson <[email protected]> // Copyright (C) 2016 Jason Crain <[email protected]> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <[email protected]>. Work sponsored by the LiMux project of the city of Munich // //======================================================================== @@ -34,7 +35,7 @@ int UTF16toUCS4(const Unicode *utf16, int utf16_len, Unicode **ucs4_out); // ucs4 - if the number of UCS-4 characters is > 0, allocates and // returns UCS-4 string. Free with gfree. // returns number of UCS-4 characters -int TextStringToUCS4(GooString *textStr, Unicode **ucs4); +int TextStringToUCS4(const GooString *textStr, Unicode **ucs4); // check if UCS-4 character is valid bool UnicodeIsValid(Unicode ucs4); diff --git a/qt5/src/poppler-annotation.cc b/qt5/src/poppler-annotation.cc index 42f2e9fe..6a2ec893 100644 --- a/qt5/src/poppler-annotation.cc +++ b/qt5/src/poppler-annotation.cc @@ -5,6 +5,7 @@ * Copyright (C) 2012-2014 Fabio D'Urso <[email protected]> * Copyright (C) 2012, 2015, Tobias Koenig <[email protected]> * Copyright (C) 2018 Adam Reichold <[email protected]> + * Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <[email protected]>. Work sponsored by the LiMux project of the city of Munich * Adapting code from * Copyright (C) 2004 by Enrico Ros <[email protected]> * @@ -535,7 +536,7 @@ QList<Annotation*> AnnotationPrivate::findAnnotations(::Page *pdfPage, DocumentD MovieObject *movie = new MovieObject( movieann ); m->setMovie( movie ); // -> movieTitle - GooString * movietitle = movieann->getTitle(); + const GooString * movietitle = movieann->getTitle(); if ( movietitle ) m->setMovieTitle( QString::fromLatin1( movietitle->getCString() ) ); break; @@ -556,7 +557,7 @@ QList<Annotation*> AnnotationPrivate::findAnnotations(::Page *pdfPage, DocumentD s->setAction( static_cast<Poppler::LinkRendition *>(popplerLink) ); // -> screenTitle - GooString * screentitle = screenann->getTitle(); + const GooString * screentitle = screenann->getTitle(); if ( screentitle ) s->setScreenTitle( UnicodeParsedString( screentitle ) ); break; diff --git a/qt5/src/poppler-document.cc b/qt5/src/poppler-document.cc index 0eeb923f..121f1206 100644 --- a/qt5/src/poppler-document.cc +++ b/qt5/src/poppler-document.cc @@ -12,6 +12,7 @@ * Copyright (C) 2016 Jakub Alba <[email protected]> * Copyright (C) 2017 Adrian Johnson <[email protected]> * Copyright (C) 2017 Suzuki Toshiya <[email protected]> + * Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <[email protected]>. Work sponsored by the LiMux project of the city of Munich * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -793,7 +794,7 @@ namespace Poppler { return result; } - QDateTime convertDate( char *dateString ) + QDateTime convertDate( const char *dateString ) { int year, mon, day, hour, min, sec, tzHours, tzMins; char tz; @@ -824,6 +825,12 @@ namespace Poppler { return QDateTime(); } + QDateTime convertDate( char *dateString ) + { + return convertDate( (const char *) dateString ); + } + + bool isCmsAvailable() { #if defined(USE_CMS) diff --git a/qt5/src/poppler-form.cc b/qt5/src/poppler-form.cc index 9c6e119c..ff737bdc 100644 --- a/qt5/src/poppler-form.cc +++ b/qt5/src/poppler-form.cc @@ -114,7 +114,7 @@ int FormField::id() const QString FormField::name() const { QString name; - if (GooString *goo = m_formData->fm->getPartialName()) + if (const GooString *goo = m_formData->fm->getPartialName()) { name = QString::fromLatin1(goo->getCString()); } @@ -141,7 +141,7 @@ QString FormField::fullyQualifiedName() const QString FormField::uiName() const { QString name; - if (GooString *goo = m_formData->fm->getAlternateUiName()) + if (const GooString *goo = m_formData->fm->getAlternateUiName()) { name = QString::fromLatin1(goo->getCString()); } diff --git a/qt5/src/poppler-page.cc b/qt5/src/poppler-page.cc index 381a608b..28ee1cd8 100644 --- a/qt5/src/poppler-page.cc +++ b/qt5/src/poppler-page.cc @@ -226,7 +226,7 @@ Link* PageData::convertLinkActionToLink(::LinkAction * a, DocumentData *parentDo case actionLaunch: { LinkLaunch * e = (LinkLaunch *)a; - GooString * p = e->getParams(); + const GooString * p = e->getParams(); popplerLink = new LinkExecute( linkArea, e->getFileName()->getCString(), p ? p->getCString() : nullptr ); } break; diff --git a/qt5/src/poppler-private.cc b/qt5/src/poppler-private.cc index 0461c359..308343fe 100644 --- a/qt5/src/poppler-private.cc +++ b/qt5/src/poppler-private.cc @@ -180,7 +180,7 @@ namespace Debug { // no 'destination' but an internal 'named reference'. we could // get the destination for the page now, but it's VERY time consuming, // so better storing the reference and provide the viewport on demand - GooString *s = g->getNamedDest(); + const GooString *s = g->getNamedDest(); QChar *charArray = new QChar[s->getLength()]; for (int i = 0; i < s->getLength(); ++i) charArray[i] = QChar(s->getCString()[i]); QString aux(charArray, s->getLength()); @@ -204,7 +204,7 @@ namespace Debug { // no 'destination' but an internal 'named reference'. we could // get the destination for the page now, but it's VERY time consuming, // so better storing the reference and provide the viewport on demand - GooString *s = g->getNamedDest(); + const GooString *s = g->getNamedDest(); QChar *charArray = new QChar[s->getLength()]; for (int i = 0; i < s->getLength(); ++i) charArray[i] = QChar(s->getCString()[i]); QString aux(charArray, s->getLength()); diff --git a/qt5/src/poppler-private.h b/qt5/src/poppler-private.h index 85852d5b..d37393a2 100644 --- a/qt5/src/poppler-private.h +++ b/qt5/src/poppler-private.h @@ -73,13 +73,13 @@ namespace Poppler { class LinkDestinationData { public: - LinkDestinationData( LinkDest *l, GooString *nd, Poppler::DocumentData *pdfdoc, bool external ) + LinkDestinationData( LinkDest *l, const GooString *nd, Poppler::DocumentData *pdfdoc, bool external ) : ld(l), namedDest(nd), doc(pdfdoc), externalDest(external) { } LinkDest *ld; - GooString *namedDest; + const GooString *namedDest; Poppler::DocumentData *doc; bool externalDest; }; diff --git a/qt5/src/poppler-qt5.h b/qt5/src/poppler-qt5.h index 3adbf02f..34339d15 100644 --- a/qt5/src/poppler-qt5.h +++ b/qt5/src/poppler-qt5.h @@ -1965,6 +1965,13 @@ height = dummy.height(); POPPLER_QT5_EXPORT QDateTime convertDate( char *dateString ); /** + Conversion from PDF date string format to QDateTime + + \since 0.64 + */ + POPPLER_QT5_EXPORT QDateTime convertDate( const char *dateString ); + + /** Whether the color management functions are available. \since 0.12 diff --git a/utils/JSInfo.cc b/utils/JSInfo.cc index a67c3aeb..e90c1407 100644 --- a/utils/JSInfo.cc +++ b/utils/JSInfo.cc @@ -6,6 +6,7 @@ // // Copyright (C) 2013 Adrian Johnson <[email protected]> // Copyright (C) 2016, 2017 Albert Astals Cid <[email protected]> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <[email protected]>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -34,7 +35,7 @@ JSInfo::JSInfo(PDFDoc *docA, int firstPage) { JSInfo::~JSInfo() { } -void JSInfo::printJS(GooString *js) { +void JSInfo::printJS(const GooString *js) { Unicode *u = nullptr; char buf[8]; int i, n, len; @@ -58,7 +59,7 @@ void JSInfo::scanLinkAction(LinkAction *link, const char *action, bool deleteLin hasJS = gTrue; if (print) { LinkJavaScript *linkjs = static_cast<LinkJavaScript *>(link); - GooString *s = linkjs->getScript(); + const GooString *s = linkjs->getScript(); if (s && s->getCString()) { fprintf(file, "%s:\n", action); printJS(s); @@ -72,7 +73,7 @@ void JSInfo::scanLinkAction(LinkAction *link, const char *action, bool deleteLin if (linkr->getScript()) { hasJS = gTrue; if (print) { - GooString *s = linkr->getScript(); + const GooString *s = linkr->getScript(); if (s && s->getCString()) { fprintf(file, "%s (Rendition):\n", action); printJS(s); diff --git a/utils/JSInfo.h b/utils/JSInfo.h index b2d7b7f0..6dee717d 100644 --- a/utils/JSInfo.h +++ b/utils/JSInfo.h @@ -6,6 +6,7 @@ // // Copyright (C) 2013 Adrian Johnson <[email protected]> // Copyright (C) 2016 Albert Astals Cid <[email protected]> +// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <[email protected]>. Work sponsored by the LiMux project of the city of Munich // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -54,7 +55,7 @@ private: void scan(int nPages); void scanLinkAction(LinkAction *link, const char *action, bool deleteLink = true); - void printJS(GooString *js); + void printJS(const GooString *js); }; _______________________________________________ poppler mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/poppler
