From 4813adfada062a9161b55e412e3997b748123f7f Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 19 Mar 2020 17:17:04 +0100 Subject: Some more const --- glib/demo/annots.c | 2 +- splash/SplashFTFont.cc | 4 ++-- splash/SplashScreen.cc | 8 ++++---- splash/SplashScreen.h | 6 +++--- utils/InMemoryFile.cc | 3 ++- utils/pdfattach.cc | 4 ++-- utils/pdfdetach.cc | 2 +- 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/glib/demo/annots.c b/glib/demo/annots.c index bbcc31c2..591f0e4f 100644 --- a/glib/demo/annots.c +++ b/glib/demo/annots.c @@ -44,7 +44,7 @@ typedef struct const gchar *label; } Annotations; -static Annotations supported_annots[] = { +static const Annotations supported_annots[] = { { POPPLER_ANNOT_TEXT, "Text" }, { POPPLER_ANNOT_LINE, "Line" }, { POPPLER_ANNOT_SQUARE, "Square" }, diff --git a/splash/SplashFTFont.cc b/splash/SplashFTFont.cc index 1eafd3ee..48cfb39d 100644 --- a/splash/SplashFTFont.cc +++ b/splash/SplashFTFont.cc @@ -11,7 +11,7 @@ // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2005, 2007-2011, 2014, 2018 Albert Astals Cid +// Copyright (C) 2005, 2007-2011, 2014, 2018, 2020 Albert Astals Cid // Copyright (C) 2006 Kristian Høgsberg // Copyright (C) 2009 Petr Gajdos // Copyright (C) 2010 Suzuki Toshiya @@ -327,7 +327,7 @@ struct SplashFTFontPath { }; SplashPath *SplashFTFont::getGlyphPath(int c) { - static FT_Outline_Funcs outlineFuncs = { + static const FT_Outline_Funcs outlineFuncs = { #if FREETYPE_MINOR <= 1 (int (*)(FT_Vector *, void *))&glyphPathMoveTo, (int (*)(FT_Vector *, void *))&glyphPathLineTo, diff --git a/splash/SplashScreen.cc b/splash/SplashScreen.cc index 28a9917e..eac54587 100644 --- a/splash/SplashScreen.cc +++ b/splash/SplashScreen.cc @@ -11,7 +11,7 @@ // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2009, 2016, 2018 Albert Astals Cid +// Copyright (C) 2009, 2016, 2018, 2020 Albert Astals Cid // Copyright (C) 2012 Fabio D'Urso // // To see a description of the changes please see the Changelog file that @@ -30,7 +30,7 @@ #include "SplashMath.h" #include "SplashScreen.h" -static SplashScreenParams defaultParams = { +static const SplashScreenParams defaultParams = { splashScreenDispersed, // type 2, // size 2, // dotRadius @@ -62,7 +62,7 @@ struct cmpDistancesFunctor { // sqrt(2)). If is false, this generates an optimal // threshold matrix using recursive tesselation. Gamma correction // (gamma = 1 / 1.33) is also computed here. -SplashScreen::SplashScreen(SplashScreenParams *params) { +SplashScreen::SplashScreen(const SplashScreenParams *params) { if (!params) { params = &defaultParams; @@ -80,7 +80,7 @@ void SplashScreen::createMatrix() unsigned char u; int black, white, i; - SplashScreenParams *params = screenParams; + const SplashScreenParams *params = screenParams; // size must be a power of 2, and at least 2 for (size = 2, log2Size = 1; size < params->size; size <<= 1, ++log2Size) ; diff --git a/splash/SplashScreen.h b/splash/SplashScreen.h index ef12cc0a..27b48b50 100644 --- a/splash/SplashScreen.h +++ b/splash/SplashScreen.h @@ -11,7 +11,7 @@ // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2009, 2018 Albert Astals Cid +// Copyright (C) 2009, 2018, 2020 Albert Astals Cid // // 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 @@ -32,7 +32,7 @@ class SplashScreen { public: - SplashScreen(SplashScreenParams *params); + SplashScreen(const SplashScreenParams *params); SplashScreen(SplashScreen *screen); ~SplashScreen(); @@ -65,7 +65,7 @@ private: int distance(int x0, int y0, int x1, int y1); void buildSCDMatrix(int r); - SplashScreenParams *screenParams; // params to create the other members + const SplashScreenParams *screenParams; // params to create the other members unsigned char *mat; // threshold matrix int size; // size of the threshold matrix int sizeM1; // size - 1 diff --git a/utils/InMemoryFile.cc b/utils/InMemoryFile.cc index c34bd113..56225381 100644 --- a/utils/InMemoryFile.cc +++ b/utils/InMemoryFile.cc @@ -11,6 +11,7 @@ // This file is licensed under the GPLv2 or later // // Copyright (C) 2018, 2019 Greg Knight +// Copyright (C) 2020 Albert Astals Cid // //======================================================================== @@ -63,7 +64,7 @@ FILE* InMemoryFile::open(const char* mode) fprintf(stderr, "InMemoryFile: BUG: Why is this opened more than once?"); return nullptr; // maybe there's some legit reason for it, whoever comes up with one can remove this line } - static cookie_io_functions_t methods = { + static const cookie_io_functions_t methods = { /* .read = */ [](void* self, char* buf, size_t sz) { return ((InMemoryFile*)self)->_read(buf, sz); }, /* .write = */ [](void* self, const char* buf, size_t sz) { return ((InMemoryFile*)self)->_write(buf, sz); }, /* .seek = */ [](void* self, off64_t* offset, int whence) { return ((InMemoryFile*)self)->_seek(offset, whence); }, diff --git a/utils/pdfattach.cc b/utils/pdfattach.cc index 7aed4b21..f4f71cbb 100644 --- a/utils/pdfattach.cc +++ b/utils/pdfattach.cc @@ -4,7 +4,7 @@ // // This file is licensed under the GPLv2 or later // -// Copyright (C) 2019 Albert Astals Cid +// Copyright (C) 2019, 2020 Albert Astals Cid // Copyright (C) 2019 Oliver Sander // // To see a description of the changes please see the Changelog file that @@ -27,7 +27,7 @@ static bool doReplace = false; static bool printVersion = false; static bool printHelp = false; -static ArgDesc argDesc[] = { +static const ArgDesc argDesc[] = { {"-replace", argFlag, &doReplace, 0, "replace embedded file with same name (if it exists)"}, {"-v", argFlag, &printVersion, 0, diff --git a/utils/pdfdetach.cc b/utils/pdfdetach.cc index ca7bbcbd..9e3efca5 100644 --- a/utils/pdfdetach.cc +++ b/utils/pdfdetach.cc @@ -55,7 +55,7 @@ static char userPassword[33] = "\001"; static bool printVersion = false; static bool printHelp = false; -static ArgDesc argDesc[] = { +static const ArgDesc argDesc[] = { {"-list", argFlag, &doList, 0, "list all embedded files"}, {"-save", argInt, &saveNum, 0, -- cgit v1.2.3