summaryrefslogtreecommitdiff
path: root/poppler
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2019-11-27 22:56:46 +0100
committerAlbert Astals Cid <aacid@kde.org>2019-11-27 22:56:46 +0100
commit7bd2d1b9db89af824d3be7ee2bbfd1ba7be5d408 (patch)
treeb9e783900db70870c3acf46e99c54d734218cd2d /poppler
parent8eb7a123c2ad226598de498cc37fa9b8dccdd3bd (diff)
some more const
Diffstat (limited to 'poppler')
-rw-r--r--poppler/CMap.cc4
-rw-r--r--poppler/CMap.h10
-rw-r--r--poppler/CharCodeToUnicode.cc12
-rw-r--r--poppler/CharCodeToUnicode.h12
-rw-r--r--poppler/GfxFont.cc4
-rw-r--r--poppler/GfxFont.h6
-rw-r--r--poppler/NameToCharCode.cc18
-rw-r--r--poppler/NameToCharCode.h6
-rw-r--r--poppler/PageTransition.h17
9 files changed, 52 insertions, 37 deletions
diff --git a/poppler/CMap.cc b/poppler/CMap.cc
index 9953db32..edf1510a 100644
--- a/poppler/CMap.cc
+++ b/poppler/CMap.cc
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2008 Koji Otani <sho@bbr.jp>
-// Copyright (C) 2008, 2009, 2017, 2018 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2008, 2009, 2017-2019 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2013 Fabio D'Urso <fabiodurso@hotmail.it>
// Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com>
// Copyright (C) 2018 Adam Reichold <adam.reichold@t-online.de>
@@ -322,7 +322,7 @@ CMap::CMap(GooString *collectionA, GooString *cMapNameA, int wModeA) {
refCnt = 1;
}
-void CMap::useCMap(CMapCache *cache, char *useName) {
+void CMap::useCMap(CMapCache *cache, const char *useName) {
GooString *useNameStr;
CMap *subCMap;
diff --git a/poppler/CMap.h b/poppler/CMap.h
index c02a8a0a..6afe5bc6 100644
--- a/poppler/CMap.h
+++ b/poppler/CMap.h
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2008 Koji Otani <sho@bbr.jp>
-// Copyright (C) 2009, 2018 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2009, 2018, 2019 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2012, 2017 Adrian Johnson <ajohnson@redneon.com>
// Copyright (C) 2018 Adam Reichold <adam.reichold@t-online.de>
//
@@ -72,9 +72,9 @@ public:
void decRefCnt();
// Return collection name (<registry>-<ordering>).
- GooString *getCollection() { return collection; }
+ const GooString *getCollection() const { return collection; }
- GooString *getCMapName() { return cMapName; }
+ const GooString *getCMapName() const { return cMapName; }
// Return true if this CMap matches the specified <collectionA>, and
// <cMapNameA>.
@@ -86,7 +86,7 @@ public:
CID getCID(const char *s, int len, CharCode *c, int *nUsed);
// Return the writing mode (0=horizontal, 1=vertical).
- int getWMode() { return wMode; }
+ int getWMode() const { return wMode; }
void setReverseMap(unsigned int *rmap, unsigned int rmapSize, unsigned int ncand);
@@ -95,7 +95,7 @@ private:
void parse2(CMapCache *cache, int (*getCharFunc)(void *), void *data);
CMap(GooString *collectionA, GooString *cMapNameA);
CMap(GooString *collectionA, GooString *cMapNameA, int wModeA);
- void useCMap(CMapCache *cache, char *useName);
+ void useCMap(CMapCache *cache, const char *useName);
void useCMap(CMapCache *cache, Object *obj);
void copyVector(CMapVectorEntry *dest, CMapVectorEntry *src);
void addCIDs(unsigned int start, unsigned int end, unsigned int nBytes, CID firstCID);
diff --git a/poppler/CharCodeToUnicode.cc b/poppler/CharCodeToUnicode.cc
index 9d92f965..4ca57290 100644
--- a/poppler/CharCodeToUnicode.cc
+++ b/poppler/CharCodeToUnicode.cc
@@ -125,7 +125,7 @@ CharCodeToUnicode *CharCodeToUnicode::makeIdentityMapping() {
}
CharCodeToUnicode *CharCodeToUnicode::parseCIDToUnicode(const char *fileName,
- GooString *collection) {
+ const GooString *collection) {
FILE *f;
Unicode *mapA;
CharCode size, mapLenA;
@@ -166,7 +166,7 @@ CharCodeToUnicode *CharCodeToUnicode::parseCIDToUnicode(const char *fileName,
}
CharCodeToUnicode *CharCodeToUnicode::parseUnicodeToUnicode(
- GooString *fileName) {
+ const GooString *fileName) {
FILE *f;
Unicode *mapA;
CharCodeToUnicodeString *sMapA;
@@ -264,7 +264,7 @@ CharCodeToUnicode *CharCodeToUnicode::make8BitToUnicode(Unicode *toUnicode) {
return new CharCodeToUnicode(nullptr, toUnicode, 256, true, nullptr, 0, 0);
}
-CharCodeToUnicode *CharCodeToUnicode::parseCMap(GooString *buf, int nBits) {
+CharCodeToUnicode *CharCodeToUnicode::parseCMap(const GooString *buf, int nBits) {
CharCodeToUnicode *ctu;
ctu = new CharCodeToUnicode(nullptr);
@@ -273,7 +273,7 @@ CharCodeToUnicode *CharCodeToUnicode::parseCMap(GooString *buf, int nBits) {
return ctu;
}
-CharCodeToUnicode *CharCodeToUnicode::parseCMapFromFile(GooString *fileName,
+CharCodeToUnicode *CharCodeToUnicode::parseCMapFromFile(const GooString *fileName,
int nBits) {
CharCodeToUnicode *ctu;
FILE *f;
@@ -289,7 +289,7 @@ CharCodeToUnicode *CharCodeToUnicode::parseCMapFromFile(GooString *fileName,
return ctu;
}
-void CharCodeToUnicode::mergeCMap(GooString *buf, int nBits) {
+void CharCodeToUnicode::mergeCMap(const GooString *buf, int nBits) {
const char *p = buf->c_str();
parseCMap1(&getCharFromString, &p, nBits);
}
@@ -539,7 +539,7 @@ void CharCodeToUnicode::decRefCnt() {
}
}
-bool CharCodeToUnicode::match(GooString *tagA) {
+bool CharCodeToUnicode::match(const GooString *tagA) {
return tag && !tag->cmp(tagA);
}
diff --git a/poppler/CharCodeToUnicode.h b/poppler/CharCodeToUnicode.h
index f5c8d327..95eeb9a8 100644
--- a/poppler/CharCodeToUnicode.h
+++ b/poppler/CharCodeToUnicode.h
@@ -52,12 +52,12 @@ public:
// specified by <fileName>. Sets the initial reference count to 1.
// Returns NULL on failure.
static CharCodeToUnicode *parseCIDToUnicode(const char *fileName,
- GooString *collection);
+ const GooString *collection);
// Create a Unicode-to-Unicode mapping from the file specified by
// <fileName>. Sets the initial reference count to 1. Returns NULL
// on failure.
- static CharCodeToUnicode *parseUnicodeToUnicode(GooString *fileName);
+ static CharCodeToUnicode *parseUnicodeToUnicode(const GooString *fileName);
// Create the CharCode-to-Unicode mapping for an 8-bit font.
// <toUnicode> is an array of 256 Unicode indexes. Sets the initial
@@ -65,12 +65,12 @@ public:
static CharCodeToUnicode *make8BitToUnicode(Unicode *toUnicode);
// Parse a ToUnicode CMap for an 8- or 16-bit font.
- static CharCodeToUnicode *parseCMap(GooString *buf, int nBits);
- static CharCodeToUnicode *parseCMapFromFile(GooString *fileName, int nBits);
+ static CharCodeToUnicode *parseCMap(const GooString *buf, int nBits);
+ static CharCodeToUnicode *parseCMapFromFile(const GooString *fileName, int nBits);
// Parse a ToUnicode CMap for an 8- or 16-bit font, merging it into
// <this>.
- void mergeCMap(GooString *buf, int nBits);
+ void mergeCMap(const GooString *buf, int nBits);
~CharCodeToUnicode();
@@ -81,7 +81,7 @@ public:
void decRefCnt();
// Return true if this mapping matches the specified <tagA>.
- bool match(GooString *tagA);
+ bool match(const GooString *tagA);
// Set the mapping for <c>.
void setMapping(CharCode c, Unicode *u, int len);
diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index 392341de..6d1aba7c 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -233,7 +233,7 @@ GfxFont *GfxFont::makeFont(XRef *xref, const char *tagA, Ref idA, Dict *fontDict
return font;
}
-GfxFont::GfxFont(const char *tagA, Ref idA, GooString *nameA,
+GfxFont::GfxFont(const char *tagA, Ref idA, const GooString *nameA,
GfxFontType typeA, Ref embFontIDA) {
ok = false;
tag = new GooString(tagA);
@@ -759,7 +759,7 @@ GfxFontLoc *GfxFont::locateFont(XRef *xref, PSOutputDev *ps) {
return nullptr;
}
-GfxFontLoc *GfxFont::locateBase14Font(GooString *base14Name) {
+GfxFontLoc *GfxFont::locateBase14Font(const GooString *base14Name) {
GooString *path;
path = globalParams->findFontFile(base14Name);
diff --git a/poppler/GfxFont.h b/poppler/GfxFont.h
index 1eb17a6e..42c462e7 100644
--- a/poppler/GfxFont.h
+++ b/poppler/GfxFont.h
@@ -173,7 +173,7 @@ public:
// Build a GfxFont object.
static GfxFont *makeFont(XRef *xref, const char *tagA, Ref idA, Dict *fontDict);
- GfxFont(const char *tagA, Ref idA, GooString *nameA,
+ GfxFont(const char *tagA, Ref idA, const GooString *nameA,
GfxFontType typeA, Ref embFontIDA);
GfxFont(const GfxFont &) = delete;
@@ -258,7 +258,7 @@ public:
GfxFontLoc *locateFont(XRef *xref, PSOutputDev *ps);
// Locate a Base-14 font file for a specified font name.
- static GfxFontLoc *locateBase14Font(GooString *base14Name);
+ static GfxFontLoc *locateBase14Font(const GooString *base14Name);
// Read an external or embedded font file into a buffer.
char *readEmbFontFile(XRef *xref, int *len);
@@ -296,7 +296,7 @@ protected:
GooString *tag; // PDF font tag
Ref id; // reference (used as unique ID)
- GooString *name; // font name
+ const GooString *name; // font name
GooString *family; // font family
Stretch stretch; // font stretch
Weight weight; // font weight
diff --git a/poppler/NameToCharCode.cc b/poppler/NameToCharCode.cc
index 70fb99cf..ca6c362d 100644
--- a/poppler/NameToCharCode.cc
+++ b/poppler/NameToCharCode.cc
@@ -6,6 +6,20 @@
//
//========================================================================
+//========================================================================
+//
+// Modified under the Poppler project - http://poppler.freedesktop.org
+//
+// All changes made under the Poppler project to this file are licensed
+// under GPL version 2 or later
+//
+// Copyright (C) 2019 Albert Astals Cid <aacid@kde.org>
+//
+// 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
+//
+//========================================================================
+
#include <config.h>
#include <string.h>
@@ -85,7 +99,7 @@ void NameToCharCode::add(const char *name, CharCode c) {
++len;
}
-CharCode NameToCharCode::lookup(const char *name) {
+CharCode NameToCharCode::lookup(const char *name) const {
int h;
h = hash(name);
@@ -100,7 +114,7 @@ CharCode NameToCharCode::lookup(const char *name) {
return 0;
}
-int NameToCharCode::hash(const char *name) {
+int NameToCharCode::hash(const char *name) const {
const char *p;
unsigned int h;
diff --git a/poppler/NameToCharCode.h b/poppler/NameToCharCode.h
index 481e4e98..bebb6dd1 100644
--- a/poppler/NameToCharCode.h
+++ b/poppler/NameToCharCode.h
@@ -13,7 +13,7 @@
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
-// Copyright (C) 2018 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2018, 2019 Albert Astals Cid <aacid@kde.org>
//
// 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
@@ -39,11 +39,11 @@ public:
NameToCharCode& operator=(const NameToCharCode &) = delete;
void add(const char *name, CharCode c);
- CharCode lookup(const char *name);
+ CharCode lookup(const char *name) const;
private:
- int hash(const char *name);
+ int hash(const char *name) const;
NameToCharCodeEntry *tab;
int size;
diff --git a/poppler/PageTransition.h b/poppler/PageTransition.h
index 6eb52d8a..3fae180c 100644
--- a/poppler/PageTransition.h
+++ b/poppler/PageTransition.h
@@ -1,6 +1,7 @@
/* PageTransition.cc
* Copyright (C) 2005, Net Integration Technologies, Inc.
* Copyright (C) 2015, Arseniy Lartsev <arseniy@alumni.chalmers.se>
+ * Copyright (C) 2019, Albert Astals Cid <aacid@kde.org>
*
* 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
@@ -63,28 +64,28 @@ public:
~PageTransition ();
// Was the Page Transition created successfully?
- bool isOk() { return ok; }
+ bool isOk() const { return ok; }
// Get type
- PageTransitionType getType() { return type; }
+ PageTransitionType getType() const { return type; }
// Get duration
- double getDuration() { return duration; }
+ double getDuration() const { return duration; }
// Get alignment
- PageTransitionAlignment getAlignment() { return alignment; }
+ PageTransitionAlignment getAlignment() const { return alignment; }
// Get direction
- PageTransitionDirection getDirection() { return direction; }
+ PageTransitionDirection getDirection() const { return direction; }
// Get angle
- int getAngle() { return angle; }
+ int getAngle() const { return angle; }
// Get scale
- double getScale() { return scale; }
+ double getScale() const { return scale; }
// Is rectangular?
- bool isRectangular() { return rectangular; }
+ bool isRectangular() const { return rectangular; }
private: