[poppler] poppler/GlobalParams.cc poppler/GlobalParams.h utils/printencodings.cc
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Oct 29 14:39:54 UTC 2021
poppler/GlobalParams.cc | 8 ++++----
poppler/GlobalParams.h | 2 +-
utils/printencodings.cc | 12 +++++-------
3 files changed, 10 insertions(+), 12 deletions(-)
New commits:
commit c297b22e096cd853973d8d670be383d9e38b96a8
Author: Albert Astals Cid <aacid at kde.org>
Date: Fri Oct 29 16:13:13 2021 +0200
Change GlobalParams::getEncodingNames to something saner
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 47aa85a2..7f512665 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -1200,14 +1200,14 @@ const UnicodeMap *GlobalParams::getTextEncoding()
return getUnicodeMap(textEncoding->toStr());
}
-std::vector<GooString *> *GlobalParams::getEncodingNames()
+std::vector<std::string> GlobalParams::getEncodingNames()
{
- auto *const result = new std::vector<GooString *>;
+ std::vector<std::string> result;
for (const auto &unicodeMap : residentUnicodeMaps) {
- result->push_back(new GooString(unicodeMap.first));
+ result.push_back(unicodeMap.first);
}
for (const auto &unicodeMap : unicodeMaps) {
- result->push_back(new GooString(unicodeMap.first));
+ result.push_back(unicodeMap.first);
}
return result;
}
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index 44875ed1..9fc315d7 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -126,7 +126,7 @@ public:
const UnicodeMap *getUtf8Map();
- std::vector<GooString *> *getEncodingNames();
+ std::vector<std::string> getEncodingNames();
//----- functions to set parameters
void addFontFile(const GooString *fontName, const GooString *path);
diff --git a/utils/printencodings.cc b/utils/printencodings.cc
index 5f561483..3e727c70 100644
--- a/utils/printencodings.cc
+++ b/utils/printencodings.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008, 2019, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2008, 2019, 2021, Albert Astals Cid <aacid at kde.org>
* Copyright (C) 2017, Adrian Johnson <ajohnson at redneon.com>
* Copyright (C) 2018, Adam Reichold <adam.reichold at t-online.de>
* Copyright (C) 2019, Oliver Sander <oliver.sander at tu-dresden.de>
@@ -28,14 +28,12 @@
void printEncodings()
{
- std::vector<GooString *> *encNames = globalParams->getEncodingNames();
+ std::vector<std::string> encNames = globalParams->getEncodingNames();
- std::sort(encNames->begin(), encNames->end(), [](void *lhs, void *rhs) { return static_cast<GooString *>(lhs)->cmp(static_cast<GooString *>(rhs)) < 0; });
+ std::sort(encNames.begin(), encNames.end());
printf("Available encodings are:\n");
- for (const GooString *enc : *encNames) {
- printf("%s\n", enc->c_str());
+ for (const std::string &enc : encNames) {
+ printf("%s\n", enc.c_str());
}
-
- delete encNames;
}
More information about the poppler
mailing list