Commit 7bd2d1b9 authored by Albert Astals Cid's avatar Albert Astals Cid

some more const

parent 8eb7a123
......@@ -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;
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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);
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
/* 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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment