[poppler] goo/GooString.cc goo/GooString.h poppler/PDFDoc.cc
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Sep 15 20:29:32 UTC 2022
goo/GooString.cc | 12 +-----------
goo/GooString.h | 3 +--
poppler/PDFDoc.cc | 4 ++--
3 files changed, 4 insertions(+), 15 deletions(-)
New commits:
commit d6b7ef8794bad35366257e2644843f686326f4df
Author: Oliver Sander <oliver.sander at tu-dresden.de>
Date: Thu Sep 15 16:19:19 2022 +0200
Remove the psmode argument from GooString::sanitizedName
It is always 'false'.
diff --git a/goo/GooString.cc b/goo/GooString.cc
index f2fb3031..19a913a8 100644
--- a/goo/GooString.cc
+++ b/goo/GooString.cc
@@ -625,20 +625,10 @@ bool GooString::endsWith(const char *suffix) const
return endsWith(toStr(), suffix);
}
-GooString *GooString::sanitizedName(bool psmode) const
+GooString *GooString::sanitizedName() const
{
auto *name = new GooString();
- if (psmode) {
- // ghostscript chokes on names that begin with out-of-limits
- // numbers, e.g., 1e4foo is handled correctly (as a name), but
- // 1e999foo generates a limitcheck error
- const auto c = getChar(0);
- if (c >= '0' && c <= '9') {
- name->append('f');
- }
- }
-
for (const auto c : *this) {
if (c <= (char)0x20 || c >= (char)0x7f || c == ' ' || c == '(' || c == ')' || c == '<' || c == '>' || c == '[' || c == ']' || c == '{' || c == '}' || c == '/' || c == '%' || c == '#') {
char buf[8];
diff --git a/goo/GooString.h b/goo/GooString.h
index 4535f7a6..053c65f3 100644
--- a/goo/GooString.h
+++ b/goo/GooString.h
@@ -259,9 +259,8 @@ public:
// Sanitizes the string so that it does
// not contain any ( ) < > [ ] { } / %
- // The postscript mode also has some more strict checks
// The caller owns the return value
- POPPLER_PRIVATE_EXPORT GooString *sanitizedName(bool psmode) const;
+ POPPLER_PRIVATE_EXPORT GooString *sanitizedName() const;
};
#endif
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 0e851ffd..1840a3f5 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -1221,7 +1221,7 @@ void PDFDoc::writeDictionary(Dict *dict, OutStream *outStr, XRef *xRef, unsigned
outStr->printf("<<");
for (int i = 0; i < dict->getLength(); i++) {
GooString keyName(dict->getKey(i));
- GooString *keyNameToPrint = keyName.sanitizedName(false /* non ps mode */);
+ GooString *keyNameToPrint = keyName.sanitizedName();
outStr->printf("/%s ", keyNameToPrint->c_str());
delete keyNameToPrint;
Object obj1 = dict->getValNF(i).copy();
@@ -1371,7 +1371,7 @@ void PDFDoc::writeObject(Object *obj, OutStream *outStr, XRef *xRef, unsigned in
}
case objName: {
GooString name(obj->getName());
- GooString *nameToPrint = name.sanitizedName(false /* non ps mode */);
+ GooString *nameToPrint = name.sanitizedName();
outStr->printf("/%s ", nameToPrint->c_str());
delete nameToPrint;
break;
More information about the poppler
mailing list