diff options
author | Oliver Sander <oliver.sander@tu-dresden.de> | 2018-11-09 18:42:04 +0100 |
---|---|---|
committer | Albert Astals Cid <tsdgeos@yahoo.es> | 2018-11-11 22:07:02 +0000 |
commit | 817b0f12453985c416a0388cdd4a09697d092b7f (patch) | |
tree | 10c369ab08ee87097a9691daa0633cbc8a92a4da | |
parent | fb7f34b1f9706c4912384eabd5dbf44b6c88c71d (diff) |
Rename GooString::getCString GooString::c_str
This is the name used by std::string.
84 files changed, 632 insertions, 632 deletions
diff --git a/cpp/poppler-document.cpp b/cpp/poppler-document.cpp index cdb47c4c..b1d9451f 100644 --- a/cpp/poppler-document.cpp +++ b/cpp/poppler-document.cpp @@ -864,10 +864,10 @@ bool document::get_pdf_id(std::string *permanent_id, std::string *update_id) con } if (permanent_id) { - *permanent_id = goo_permanent_id.getCString(); + *permanent_id = goo_permanent_id.c_str(); } if (update_id) { - *update_id = goo_update_id.getCString(); + *update_id = goo_update_id.c_str(); } return true; diff --git a/cpp/poppler-embedded-file.cpp b/cpp/poppler-embedded-file.cpp index bf7ab4d7..77772e23 100644 --- a/cpp/poppler-embedded-file.cpp +++ b/cpp/poppler-embedded-file.cpp @@ -80,7 +80,7 @@ bool embedded_file::is_valid() const std::string embedded_file::name() const { const GooString *goo = d->file_spec->getFileName(); - return goo ? std::string(goo->getCString()) : std::string(); + return goo ? std::string(goo->c_str()) : std::string(); } /** @@ -132,7 +132,7 @@ byte_array embedded_file::checksum() const if (!cs) { return byte_array(); } - const char *ccs = cs->getCString(); + const char *ccs = cs->c_str(); byte_array data(cs->getLength()); for (int i = 0; i < cs->getLength(); ++i) { data[i] = ccs[i]; @@ -146,7 +146,7 @@ byte_array embedded_file::checksum() const std::string embedded_file::mime_type() const { const GooString *goo = d->file_spec->getEmbeddedFile()->mimeType(); - return goo ? std::string(goo->getCString()) : std::string(); + return goo ? std::string(goo->c_str()) : std::string(); } /** diff --git a/cpp/poppler-font.cpp b/cpp/poppler-font.cpp index f338287e..61e90493 100644 --- a/cpp/poppler-font.cpp +++ b/cpp/poppler-font.cpp @@ -43,10 +43,10 @@ public: , is_subset(fi->getSubset()) { if (fi->getName()) { - font_name = fi->getName()->getCString(); + font_name = fi->getName()->c_str(); } if (fi->getFile()) { - font_file = fi->getFile()->getCString(); + font_file = fi->getFile()->c_str(); } } diff --git a/cpp/poppler-page.cpp b/cpp/poppler-page.cpp index bc7dcfdc..9d9526cc 100644 --- a/cpp/poppler-page.cpp +++ b/cpp/poppler-page.cpp @@ -287,7 +287,7 @@ ustring page::text(const rectf &r, text_layout_enum layout_mode) const } else { s.reset(td.getText(r.left(), r.top(), r.right(), r.bottom())); } - return ustring::from_utf8(s->getCString()); + return ustring::from_utf8(s->c_str()); } /* diff --git a/cpp/poppler-private.cpp b/cpp/poppler-private.cpp index 2cdc53e7..8125da2b 100644 --- a/cpp/poppler-private.cpp +++ b/cpp/poppler-private.cpp @@ -58,7 +58,7 @@ rectf detail::pdfrectangle_to_rectf(const PDFRectangle &pdfrect) ustring detail::unicode_GooString_to_ustring(const GooString *str) { - const char *data = str->getCString(); + const char *data = str->c_str(); const int len = str->getLength(); int i = 0; diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc index b3bcccea..06b724a8 100644 --- a/fofi/FoFiTrueType.cc +++ b/fofi/FoFiTrueType.cc @@ -530,7 +530,7 @@ void FoFiTrueType::convertToType42(const char *psName, char **encoding, ok = true; buf = GooString::format("%!PS-TrueTypeFont-{0:2g}\n", (double)getS32BE(0, &ok) / 65536.0); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; // begin the font dictionary @@ -542,7 +542,7 @@ void FoFiTrueType::convertToType42(const char *psName, char **encoding, (*outputFunc)(outputStream, "/FontMatrix [1 0 0 1 0 0] def\n", 30); buf = GooString::format("/FontBBox [{0:d} {1:d} {2:d} {3:d}] def\n", bbox[0], bbox[1], bbox[2], bbox[3]); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; (*outputFunc)(outputStream, "/PaintType 0 def\n", 17); @@ -590,7 +590,7 @@ void FoFiTrueType::convertToCIDType2(const char *psName, ok = true; buf = GooString::format("%!PS-TrueTypeFont-{0:2g}\n", (double)getS32BE(0, &ok) / 65536.0); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; // begin the font dictionary @@ -608,7 +608,7 @@ void FoFiTrueType::convertToCIDType2(const char *psName, (*outputFunc)(outputStream, "/GDBytes 2 def\n", 15); if (cidMap) { buf = GooString::format("/CIDCount {0:d} def\n", nCIDs); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; if (nCIDs > 32767) { (*outputFunc)(outputStream, "/CIDMap [", 9); @@ -620,7 +620,7 @@ void FoFiTrueType::convertToCIDType2(const char *psName, cid = cidMap[i+j+k]; buf = GooString::format("{0:02x}{1:02x}", (cid >> 8) & 0xff, cid & 0xff); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } (*outputFunc)(outputStream, "\n", 1); @@ -637,7 +637,7 @@ void FoFiTrueType::convertToCIDType2(const char *psName, cid = cidMap[i+j]; buf = GooString::format("{0:02x}{1:02x}", (cid >> 8) & 0xff, cid & 0xff); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } (*outputFunc)(outputStream, "\n", 1); @@ -647,32 +647,32 @@ void FoFiTrueType::convertToCIDType2(const char *psName, } else { // direct mapping - just fill the string(s) with s[i]=i buf = GooString::format("/CIDCount {0:d} def\n", nGlyphs); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; if (nGlyphs > 32767) { (*outputFunc)(outputStream, "/CIDMap [\n", 10); for (i = 0; i < nGlyphs; i += 32767) { j = nGlyphs - i < 32767 ? nGlyphs - i : 32767; buf = GooString::format(" {0:d} string 0 1 {1:d} {{\n", 2 * j, j - 1); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; buf = GooString::format(" 2 copy dup 2 mul exch {0:d} add -8 bitshift put\n", i); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; buf = GooString::format(" 1 index exch dup 2 mul 1 add exch {0:d} add" " 255 and put\n", i); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; (*outputFunc)(outputStream, " } for\n", 8); } (*outputFunc)(outputStream, "] def\n", 6); } else { buf = GooString::format("/CIDMap {0:d} string\n", 2 * nGlyphs); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; buf = GooString::format(" 0 1 {0:d} {{\n", nGlyphs - 1); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; (*outputFunc)(outputStream, " 2 copy dup 2 mul exch -8 bitshift put\n", 42); @@ -685,7 +685,7 @@ void FoFiTrueType::convertToCIDType2(const char *psName, (*outputFunc)(outputStream, "/FontMatrix [1 0 0 1 0 0] def\n", 30); buf = GooString::format("/FontBBox [{0:d} {1:d} {2:d} {3:d}] def\n", bbox[0], bbox[1], bbox[2], bbox[3]); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; (*outputFunc)(outputStream, "/PaintType 0 def\n", 17); (*outputFunc)(outputStream, "/Encoding [] readonly def\n", 26); @@ -775,13 +775,13 @@ void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs, (*outputFunc)(outputStream, "/FontName /", 11); (*outputFunc)(outputStream, psName, strlen(psName)); buf = GooString::format("_{0:02x} def\n", i >> 8); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; (*outputFunc)(outputStream, "/FontType 42 def\n", 17); (*outputFunc)(outputStream, "/FontMatrix [1 0 0 1 0 0] def\n", 30); buf = GooString::format("/FontBBox [{0:d} {1:d} {2:d} {3:d}] def\n", bbox[0], bbox[1], bbox[2], bbox[3]); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; (*outputFunc)(outputStream, "/PaintType 0 def\n", 17); (*outputFunc)(outputStream, "/sfnts ", 7); @@ -790,7 +790,7 @@ void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs, (*outputFunc)(outputStream, "/Encoding 256 array\n", 20); for (j = 0; j < 256 && i+j < n; ++j) { buf = GooString::format("dup {0:d} /c{1:02x} put\n", j, j); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } (*outputFunc)(outputStream, "readonly def\n", 13); @@ -799,7 +799,7 @@ void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs, for (j = 0; j < 256 && i+j < n; ++j) { buf = GooString::format("/c{0:02x} {1:d} def\n", j, cidMap ? cidMap[i+j] : i+j); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } (*outputFunc)(outputStream, "end readonly def\n", 17); @@ -818,7 +818,7 @@ void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs, (*outputFunc)(outputStream, "/Encoding [\n", 12); for (i = 0; i < n; i += 256) { buf = GooString::format("{0:d}\n", i >> 8); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } (*outputFunc)(outputStream, "] def\n", 6); @@ -827,7 +827,7 @@ void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs, (*outputFunc)(outputStream, "/", 1); (*outputFunc)(outputStream, psName, strlen(psName)); buf = GooString::format("_{0:02x} findfont\n", i >> 8); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } (*outputFunc)(outputStream, "] def\n", 6); @@ -865,7 +865,7 @@ void FoFiTrueType::cvtEncoding(char **encoding, name = ".notdef"; } buf = GooString::format("dup {0:d} /", i); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; (*outputFunc)(outputStream, name, strlen(name)); (*outputFunc)(outputStream, " put\n", 5); @@ -873,7 +873,7 @@ void FoFiTrueType::cvtEncoding(char **encoding, } else { for (i = 0; i < 256; ++i) { buf = GooString::format("dup {0:d} /c{1:02x} put\n", i, i); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } } @@ -922,7 +922,7 @@ void FoFiTrueType::cvtCharStrings(char **encoding, (*outputFunc)(outputStream, "/", 1); (*outputFunc)(outputStream, name, strlen(name)); buf = GooString::format(" {0:d} def\n", k); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } } @@ -1193,7 +1193,7 @@ void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc, // start the sfnts array if (name) { (*outputFunc)(outputStream, "/", 1); - (*outputFunc)(outputStream, name->getCString(), name->getLength()); + (*outputFunc)(outputStream, name->c_str(), name->getLength()); (*outputFunc)(outputStream, " [\n", 3); } else { (*outputFunc)(outputStream, "/sfnts [\n", 9); @@ -1264,7 +1264,7 @@ void FoFiTrueType::dumpString(const Guchar *s, int length, for (i = 0; i < length; i += 32) { for (j = 0; j < 32 && i+j < length; ++j) { buf = GooString::format("{0:02x}", s[i+j] & 0xff); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } if (i % (65536 - 32) == 65536 - 64) { diff --git a/fofi/FoFiType1C.cc b/fofi/FoFiType1C.cc index d079f0b5..0ba0c135 100644 --- a/fofi/FoFiType1C.cc +++ b/fofi/FoFiType1C.cc @@ -110,7 +110,7 @@ FoFiType1C::~FoFiType1C() { } const char *FoFiType1C::getName() const { - return name ? name->getCString() : nullptr; + return name ? name->c_str() : nullptr; } char **FoFiType1C::getEncoding() const { @@ -204,7 +204,7 @@ void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, bo if (psName) { psNameLen = strlen(psName); } else { - psName = name->getCString(); + psName = name->c_str(); psNameLen = name->getLength(); } @@ -263,41 +263,41 @@ void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, bo (*outputFunc)(outputStream, "/isFixedPitch false def\n", 24); } buf = GooString::format("/ItalicAngle {0:.4g} def\n", topDict.italicAngle); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; buf = GooString::format("/UnderlinePosition {0:.4g} def\n", topDict.underlinePosition); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; buf = GooString::format("/UnderlineThickness {0:.4g} def\n", topDict.underlineThickness); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; (*outputFunc)(outputStream, "end readonly def\n", 17); (*outputFunc)(outputStream, "/FontName /", 11); (*outputFunc)(outputStream, psName, psNameLen); (*outputFunc)(outputStream, " def\n", 5); buf = GooString::format("/PaintType {0:d} def\n", topDict.paintType); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; (*outputFunc)(outputStream, "/FontType 1 def\n", 16); buf = GooString::format("/FontMatrix [{0:.8g} {1:.8g} {2:.8g} {3:.8g} {4:.8g} {5:.8g}] readonly def\n", topDict.fontMatrix[0], topDict.fontMatrix[1], topDict.fontMatrix[2], topDict.fontMatrix[3], topDict.fontMatrix[4], topDict.fontMatrix[5]); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; buf = GooString::format("/FontBBox [{0:.4g} {1:.4g} {2:.4g} {3:.4g}] readonly def\n", topDict.fontBBox[0], topDict.fontBBox[1], topDict.fontBBox[2], topDict.fontBBox[3]); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; buf = GooString::format("/StrokeWidth {0:.4g} def\n", topDict.strokeWidth); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; if (topDict.uniqueID != 0) { buf = GooString::format("/UniqueID {0:d} def\n", topDict.uniqueID); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } @@ -313,7 +313,7 @@ void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, bo for (i = 0; i < 256; ++i) { if (enc[i]) { buf = GooString::format("dup {0:d} /{1:s} put\n", i, enc[i]); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } } @@ -343,7 +343,7 @@ void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, bo for (i = 0; i < privateDicts[0].nBlueValues; ++i) { buf = GooString::format("{0:s}{1:d}", i > 0 ? " " : "", privateDicts[0].blueValues[i]); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } eexecWrite(&eb, "] def\n"); @@ -353,7 +353,7 @@ void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, bo for (i = 0; i < privateDicts[0].nOtherBlues; ++i) { buf = GooString::format("{0:s}{1:d}", i > 0 ? " " : "", privateDicts[0].otherBlues[i]); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } eexecWrite(&eb, "] def\n"); @@ -363,7 +363,7 @@ void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, bo for (i = 0; i < privateDicts[0].nFamilyBlues; ++i) { buf = GooString::format("{0:s}{1:d}", i > 0 ? " " : "", privateDicts[0].familyBlues[i]); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } eexecWrite(&eb, "] def\n"); @@ -373,7 +373,7 @@ void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, bo for (i = 0; i < privateDicts[0].nFamilyOtherBlues; ++i) { buf = GooString::format("{0:s}{1:d}", i > 0 ? " " : "", privateDicts[0].familyOtherBlues[i]); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } eexecWrite(&eb, "] def\n"); @@ -381,27 +381,27 @@ void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, bo if (privateDicts[0].blueScale != 0.039625) { buf = GooString::format("/BlueScale {0:.4g} def\n", privateDicts[0].blueScale); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } if (privateDicts[0].blueShift != 7) { buf = GooString::format("/BlueShift {0:d} def\n", privateDicts[0].blueShift); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } if (privateDicts[0].blueFuzz != 1) { buf = GooString::format("/BlueFuzz {0:d} def\n", privateDicts[0].blueFuzz); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } if (privateDicts[0].hasStdHW) { buf = GooString::format("/StdHW [{0:.4g}] def\n", privateDicts[0].stdHW); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } if (privateDicts[0].hasStdVW) { buf = GooString::format("/StdVW [{0:.4g}] def\n", privateDicts[0].stdVW); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } if (privateDicts[0].nStemSnapH) { @@ -409,7 +409,7 @@ void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, bo for (i = 0; i < privateDicts[0].nStemSnapH; ++i) { buf = GooString::format("{0:s}{1:.4g}", i > 0 ? " " : "", privateDicts[0].stemSnapH[i]); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } eexecWrite(&eb, "] def\n"); @@ -419,7 +419,7 @@ void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, bo for (i = 0; i < privateDicts[0].nStemSnapV; ++i) { buf = GooString::format("{0:s}{1:.4g}", i > 0 ? " " : "", privateDicts[0].stemSnapV[i]); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } eexecWrite(&eb, "] def\n"); @@ -427,25 +427,25 @@ void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, bo if (privateDicts[0].hasForceBold) { buf = GooString::format("/ForceBold {0:s} def\n", privateDicts[0].forceBold ? "true" : "false"); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } if (privateDicts[0].forceBoldThreshold != 0) { buf = GooString::format("/ForceBoldThreshold {0:.4g} def\n", privateDicts[0].forceBoldThreshold); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } if (privateDicts[0].languageGroup != 0) { buf = GooString::format("/LanguageGroup {0:d} def\n", privateDicts[0].languageGroup); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } if (privateDicts[0].expansionFactor != 0.06) { buf = GooString::format("/ExpansionFactor {0:.4g} def\n", privateDicts[0].expansionFactor); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } @@ -459,7 +459,7 @@ void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, bo // write the CharStrings buf = GooString::format("2 index /CharStrings {0:d} dict dup begin\n", nGlyphs); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; for (i = 0; i < nGlyphs; ++i) { ok = true; @@ -599,7 +599,7 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, (*outputFunc)(outputStream, " /Ordering (Identity) def\n", 27); } buf = GooString::format(" /Supplement {0:d} def\n", topDict.supplement); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; (*outputFunc)(outputStream, "end def\n", 8); if (topDict.hasFontMatrix) { @@ -607,7 +607,7 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, topDict.fontMatrix[0], topDict.fontMatrix[1], topDict.fontMatrix[2], topDict.fontMatrix[3], topDict.fontMatrix[4], topDict.fontMatrix[5]); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } else if (privateDicts[0].hasFontMatrix) { (*outputFunc)(outputStream, "/FontMatrix [1 0 0 1 0 0] def\n", 30); @@ -618,7 +618,7 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, buf = GooString::format("/FontBBox [{0:.4g} {1:.4g} {2:.4g} {3:.4g}] def\n", topDict.fontBBox[0], topDict.fontBBox[1], topDict.fontBBox[2], topDict.fontBBox[3]); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; (*outputFunc)(outputStream, "/FontInfo 1 dict dup begin\n", 27); (*outputFunc)(outputStream, " /FSType 8 def\n", 16); @@ -626,29 +626,29 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, // CIDFont-specific entries buf = GooString::format("/CIDCount {0:d} def\n", nCIDs); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; (*outputFunc)(outputStream, "/FDBytes 1 def\n", 15); buf = GooString::format("/GDBytes {0:d} def\n", gdBytes); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; (*outputFunc)(outputStream, "/CIDMapOffset 0 def\n", 20); if (topDict.paintType != 0) { buf = GooString::format("/PaintType {0:d} def\n", topDict.paintType); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; buf = GooString::format("/StrokeWidth {0:.4g} def\n", topDict.strokeWidth); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } // FDArray entry buf = GooString::format("/FDArray {0:d} array\n", nFDs); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; for (i = 0; i < nFDs; ++i) { buf = GooString::format("dup {0:d} 10 dict begin\n", i); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; (*outputFunc)(outputStream, "/FontType 1 def\n", 16); if (privateDicts[i].hasFontMatrix) { @@ -659,13 +659,13 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, privateDicts[i].fontMatrix[3], privateDicts[i].fontMatrix[4], privateDicts[i].fontMatrix[5]); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } else { (*outputFunc)(outputStream, "/FontMatrix [1 0 0 1 0 0] def\n", 30); } buf = GooString::format("/PaintType {0:d} def\n", topDict.paintType); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; (*outputFunc)(outputStream, "/Private 32 dict begin\n", 23); if (privateDicts[i].nBlueValues) { @@ -673,7 +673,7 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, for (j = 0; j < privateDicts[i].nBlueValues; ++j) { buf = GooString::format("{0:s}{1:d}", j > 0 ? " " : "", privateDicts[i].blueValues[j]); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } (*outputFunc)(outputStream, "] def\n", 6); @@ -683,7 +683,7 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, for (j = 0; j < privateDicts[i].nOtherBlues; ++j) { buf = GooString::format("{0:s}{1:d}", j > 0 ? " " : "", privateDicts[i].otherBlues[j]); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } (*outputFunc)(outputStream, "] def\n", 6); @@ -694,7 +694,7 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, buf = GooString::format("{0:s}{1:d}", j > 0 ? " " : "", privateDicts[i].familyBlues[j]); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } (*outputFunc)(outputStream, "] def\n", 6); @@ -704,7 +704,7 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, for (j = 0; j < privateDicts[i].nFamilyOtherBlues; ++j) { buf = GooString::format("{0:s}{1:d}", j > 0 ? " " : "", privateDicts[i].familyOtherBlues[j]); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } (*outputFunc)(outputStream, "] def\n", 6); @@ -712,28 +712,28 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, if (privateDicts[i].blueScale != 0.039625) { buf = GooString::format("/BlueScale {0:.4g} def\n", privateDicts[i].blueScale); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } if (privateDicts[i].blueShift != 7) { buf = GooString::format("/BlueShift {0:d} def\n", privateDicts[i].blueShift); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } if (privateDicts[i].blueFuzz != 1) { buf = GooString::format("/BlueFuzz {0:d} def\n", privateDicts[i].blueFuzz); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } if (privateDicts[i].hasStdHW) { buf = GooString::format("/StdHW [{0:.4g}] def\n", privateDicts[i].stdHW); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } if (privateDicts[i].hasStdVW) { buf = GooString::format("/StdVW [{0:.4g}] def\n", privateDicts[i].stdVW); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } if (privateDicts[i].nStemSnapH) { @@ -741,7 +741,7 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, for (j = 0; j < privateDicts[i].nStemSnapH; ++j) { buf = GooString::format("{0:s}{1:.4g}", j > 0 ? " " : "", privateDicts[i].stemSnapH[j]); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } (*outputFunc)(outputStream, "] def\n", 6); @@ -751,7 +751,7 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, for (j = 0; j < privateDicts[i].nStemSnapV; ++j) { buf = GooString::format("{0:s}{1:.4g}", j > 0 ? " " : "", privateDicts[i].stemSnapV[j]); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } (*outputFunc)(outputStream, "] def\n", 6); @@ -759,25 +759,25 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, if (privateDicts[i].hasForceBold) { buf = GooString::format("/ForceBold {0:s} def\n", privateDicts[i].forceBold ? "true" : "false"); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } if (privateDicts[i].forceBoldThreshold != 0) { buf = GooString::format("/ForceBoldThreshold {0:.4g} def\n", privateDicts[i].forceBoldThreshold); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } if (privateDicts[i].languageGroup != 0) { buf = GooString::format("/LanguageGroup {0:d} def\n", privateDicts[i].languageGroup); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } if (privateDicts[i].expansionFactor != 0.06) { buf = GooString::format("/ExpansionFactor {0:.4g} def\n", privateDicts[i].expansionFactor); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } (*outputFunc)(outputStream, "currentdict end def\n", 20); @@ -789,7 +789,7 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, offset = (nCIDs + 1) * (1 + gdBytes); buf = GooString::format("(Hex) {0:d} StartData\n", offset + charStrings->getLength()); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; // write the charstring offset (CIDMap) table @@ -807,7 +807,7 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, } for (k = 0; k <= gdBytes; ++k) { buf = GooString::format("{0:02x}", buf2[k] & 0xff); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } } @@ -819,7 +819,7 @@ void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes, for (i = 0; i < n; i += 32) { for (j = 0; j < 32 && i+j < n; ++j) { buf = GooString::format("{0:02x}", charStrings->getChar(i+j) & 0xff); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } if (i + 32 >= n) { @@ -904,7 +904,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, (*outputFunc)(outputStream, "/FontName /", 11); (*outputFunc)(outputStream, psName, strlen(psName)); buf = GooString::format("_{0:02x} def\n", i >> 8); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; (*outputFunc)(outputStream, "/FontType 1 def\n", 16); if (privateDicts[fd].hasFontMatrix) { @@ -915,7 +915,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, privateDicts[fd].fontMatrix[3], privateDicts[fd].fontMatrix[4], privateDicts[fd].fontMatrix[5]); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } else if (topDict.hasFontMatrix) { (*outputFunc)(outputStream, "/FontMatrix [1 0 0 1 0 0] def\n", 30); @@ -926,26 +926,26 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, buf = GooString::format("/FontBBox [{0:.4g} {1:.4g} {2:.4g} {3:.4g}] def\n", topDict.fontBBox[0], topDict.fontBBox[1], topDict.fontBBox[2], topDict.fontBBox[3]); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; buf = GooString::format("/PaintType {0:d} def\n", topDict.paintType); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; if (topDict.paintType != 0) { buf = GooString::format("/StrokeWidth {0:.4g} def\n", topDict.strokeWidth); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } (*outputFunc)(outputStream, "/Encoding 256 array\n", 20); for (j = 0; j < 256 && i+j < nCIDs; ++j) { buf = GooString::format("dup {0:d} /c{1:02x} put\n", j, j); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } if (j < 256) { buf = GooString::format("{0:d} 1 255 {{ 1 index exch /.notdef put }} for\n", j); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } (*outputFunc)(outputStream, "readonly def\n", 13); @@ -974,7 +974,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, buf = GooString::format("{0:s}{1:d}", k > 0 ? " " : "", privateDicts[fd].blueValues[k]); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } eexecWrite(&eb, "] def\n"); @@ -985,7 +985,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, buf = GooString::format("{0:s}{1:d}", k > 0 ? " " : "", privateDicts[fd].otherBlues[k]); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } eexecWrite(&eb, "] def\n"); @@ -995,7 +995,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, for (k = 0; k < privateDicts[fd].nFamilyBlues; ++k) { buf = GooString::format("{0:s}{1:d}", k > 0 ? " " : "", privateDicts[fd].familyBlues[k]); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } eexecWrite(&eb, "] def\n"); @@ -1005,7 +1005,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, for (k = 0; k < privateDicts[fd].nFamilyOtherBlues; ++k) { buf = GooString::format("{0:s}{1:d}", k > 0 ? " " : "", privateDicts[fd].familyOtherBlues[k]); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } eexecWrite(&eb, "] def\n"); @@ -1013,29 +1013,29 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, if (privateDicts[fd].blueScale != 0.039625) { buf = GooString::format("/BlueScale {0:.4g} def\n", privateDicts[fd].blueScale); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } if (privateDicts[fd].blueShift != 7) { buf = GooString::format("/BlueShift {0:d} def\n", privateDicts[fd].blueShift); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } if (privateDicts[fd].blueFuzz != 1) { buf = GooString::format("/BlueFuzz {0:d} def\n", privateDicts[fd].blueFuzz); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } if (privateDicts[fd].hasStdHW) { buf = GooString::format("/StdHW [{0:.4g}] def\n", privateDicts[fd].stdHW); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } if (privateDicts[fd].hasStdVW) { buf = GooString::format("/StdVW [{0:.4g}] def\n", privateDicts[fd].stdVW); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } if (privateDicts[fd].nStemSnapH) { @@ -1043,7 +1043,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, for (k = 0; k < privateDicts[fd].nStemSnapH; ++k) { buf = GooString::format("{0:s}{1:.4g}", k > 0 ? " " : "", privateDicts[fd].stemSnapH[k]); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } eexecWrite(&eb, "] def\n"); @@ -1053,7 +1053,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, for (k = 0; k < privateDicts[fd].nStemSnapV; ++k) { buf = GooString::format("{0:s}{1:.4g}", k > 0 ? " " : "", privateDicts[fd].stemSnapV[k]); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } eexecWrite(&eb, "] def\n"); @@ -1061,25 +1061,25 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, if (privateDicts[fd].hasForceBold) { buf = GooString::format("/ForceBold {0:s} def\n", privateDicts[fd].forceBold ? "true" : "false"); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } if (privateDicts[fd].forceBoldThreshold != 0) { buf = GooString::format("/ForceBoldThreshold {0:.4g} def\n", privateDicts[fd].forceBoldThreshold); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } if (privateDicts[fd].languageGroup != 0) { buf = GooString::format("/LanguageGroup {0:d} def\n", privateDicts[fd].languageGroup); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } if (privateDicts[fd].expansionFactor != 0.06) { buf = GooString::format("/ExpansionFactor {0:.4g} def\n", privateDicts[fd].expansionFactor); - eexecWrite(&eb, buf->getCString()); + eexecWrite(&eb, buf->c_str()); delete buf; } @@ -1108,7 +1108,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, getIndexVal(&charStringsIdx, cidMap[i+j], &val, &ok); if (ok) { buf = GooString::format("c{0:02x}", j); - eexecCvtGlyph(&eb, buf->getCString(), val.pos, val.len, + eexecCvtGlyph(&eb, buf->c_str(), val.pos, val.len, &subrIdx, &privateDicts[fd]); delete buf; } @@ -1145,7 +1145,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, topDict.fontMatrix[0], topDict.fontMatrix[1], topDict.fontMatrix[2], topDict.fontMatrix[3], topDict.fontMatrix[4], topDict.fontMatrix[5]); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } else { (*outputFunc)(outputStream, "/FontMatrix [1 0 0 1 0 0] def\n", 30); @@ -1154,7 +1154,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, (*outputFunc)(outputStream, "/Encoding [\n", 12); for (i = 0; i < nCIDs; i += 256) { buf = GooString::format("{0:d}\n", i >> 8); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } (*outputFunc)(outputStream, "] def\n", 6); @@ -1163,7 +1163,7 @@ void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes, (*outputFunc)(outputStream, "/", 1); (*outputFunc)(outputStream, psName, strlen(psName)); buf = GooString::format("_{0:02x} findfont\n", i >> 8); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } (*outputFunc)(outputStream, "] def\n", 6); @@ -1184,9 +1184,9 @@ void FoFiType1C::eexecCvtGlyph(Type1CEexecBuf *eb, const char *glyphName, cvtGlyph(offset, nBytes, charBuf, subrIdx, pDict, true); buf = GooString::format("/{0:s} {1:d} RD ", glyphName, charBuf->getLength()); - eexecWrite(eb, buf->getCString()); + eexecWrite(eb, buf->c_str()); delete buf; - eexecWriteCharstring(eb, (Guchar *)charBuf->getCString(), + eexecWriteCharstring(eb, (Guchar *)charBuf->c_str(), charBuf->getLength()); eexecWrite(eb, " ND\n"); diff --git a/glib/poppler-action.cc b/glib/poppler-action.cc index 679e8301..dcee6fb3 100644 --- a/glib/poppler-action.cc +++ b/glib/poppler-action.cc @@ -329,7 +329,7 @@ dest_new_named (const GooString *named_dest) } dest->type = POPPLER_DEST_NAMED; - dest->named_dest = g_strdup (named_dest->getCString ()); + dest->named_dest = g_strdup (named_dest->c_str ()); return dest; } @@ -392,10 +392,10 @@ build_launch (PopplerAction *action, const LinkLaunch *link) { if (link->getFileName()) { - action->launch.file_name = g_strdup (link->getFileName()->getCString ()); + action->launch.file_name = g_strdup (link->getFileName()->c_str ()); } if (link->getParams()) { - action->launch.params = g_strdup (link->getParams()->getCString ()); + action->launch.params = g_strdup (link->getParams()->c_str ()); } } @@ -405,7 +405,7 @@ build_uri (PopplerAction *action, { const gchar *uri; - uri = link->getURI()->getCString (); + uri = link->getURI()->c_str (); if (uri != nullptr) action->uri.uri = g_strdup (uri); } @@ -416,7 +416,7 @@ build_named (PopplerAction *action, { const gchar *name; - name = link->getName ()->getCString (); + name = link->getName ()->c_str (); if (name != nullptr) action->named.named_dest = g_strdup (name); } diff --git a/glib/poppler-attachment.cc b/glib/poppler-attachment.cc index b2677f2c..dd7064bf 100644 --- a/glib/poppler-attachment.cc +++ b/glib/poppler-attachment.cc @@ -115,7 +115,7 @@ _poppler_attachment_new (FileSpec *emb_file) _poppler_convert_pdf_date_to_gtime (embFile->modDate (), (time_t *)&attachment->mtime); if (embFile->checksum () && embFile->checksum ()->getLength () > 0) - attachment->checksum = g_string_new_len (embFile->checksum ()->getCString (), + attachment->checksum = g_string_new_len (embFile->checksum ()->c_str (), embFile->checksum ()->getLength ()); priv->obj_stream = embFile->streamObject()->copy(); } diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc index 29eab496..7945c162 100644 --- a/glib/poppler-document.cc +++ b/glib/poppler-document.cc @@ -517,9 +517,9 @@ poppler_document_get_id (PopplerDocument *document, if (document->doc->getID (permanent_id ? &permanent : nullptr, update_id ? &update : nullptr)) { if (permanent_id) - *permanent_id = (gchar *)g_memdup (permanent.getCString(), 32); + *permanent_id = (gchar *)g_memdup (permanent.c_str(), 32); if (update_id) - *update_id = (gchar *)g_memdup (update.getCString(), 32); + *update_id = (gchar *)g_memdup (update.c_str(), 32); retval = TRUE; } @@ -726,7 +726,7 @@ char *_poppler_goo_string_to_utf8(const GooString *s) char *result; if (s->hasUnicodeMarker()) { - result = g_convert (s->getCString () + 2, + result = g_convert (s->c_str () + 2, s->getLength () - 2, "UTF-8", "UTF-16BE", nullptr, nullptr, nullptr); } else { @@ -1566,7 +1566,7 @@ poppler_document_get_metadata (PopplerDocument *document) GooString *s = catalog->readMetadata (); if (s != nullptr) { - retval = g_strdup (s->getCString()); + retval = g_strdup (s->c_str()); delete s; } } @@ -2137,7 +2137,7 @@ unicode_to_char (const Unicode *unicode, gstr.append(buf, n); } - return g_strdup (gstr.getCString ()); + return g_strdup (gstr.c_str ()); } /** @@ -2256,7 +2256,7 @@ poppler_fonts_iter_get_full_name (PopplerFontsIter *iter) name = info->getName(); if (name != nullptr) { - return info->getName()->getCString(); + return info->getName()->c_str(); } else { return nullptr; } @@ -2311,7 +2311,7 @@ poppler_fonts_iter_get_substitute_name (PopplerFontsIter *iter) name = info->getSubstituteName(); if (name != nullptr) { - return name->getCString(); + return name->c_str(); } else { return nullptr; } @@ -2336,7 +2336,7 @@ poppler_fonts_iter_get_file_name (PopplerFontsIter *iter) file = info->getFile(); if (file != nullptr) { - return file->getCString(); + return file->c_str(); } else { return nullptr; } @@ -2382,7 +2382,7 @@ poppler_fonts_iter_get_encoding (PopplerFontsIter *iter) encoding = info->getEncoding(); if (encoding != nullptr) { - return encoding->getCString(); + return encoding->c_str(); } else { return nullptr; } @@ -3151,11 +3151,11 @@ _poppler_convert_pdf_date_to_gtime (const GooString *date, gboolean retval; if (date->hasUnicodeMarker()) { - date_string = g_convert (date->getCString () + 2, + date_string = g_convert (date->c_str () + 2, date->getLength () - 2, "UTF-8", "UTF-16BE", nullptr, nullptr, nullptr); } else { - date_string = g_strndup (date->getCString (), date->getLength ()); + date_string = g_strndup (date->c_str (), date->getLength ()); } retval = poppler_date_parse (date_string, gdate); diff --git a/glib/poppler-media.cc b/glib/poppler-media.cc index b7afa9ab..ab5f4c0e 100644 --- a/glib/poppler-media.cc +++ b/glib/poppler-media.cc @@ -98,9 +98,9 @@ _poppler_media_new (const MediaRendition *poppler_media) media->stream = poppler_media->getEmbbededStreamObject()->copy(); mime_type = poppler_media->getContentType(); if (mime_type) - media->mime_type = g_strdup (mime_type->getCString()); + media->mime_type = g_strdup (mime_type->c_str()); } else { - media->filename = g_strdup (poppler_media->getFileName()->getCString()); + media->filename = g_strdup (poppler_media->getFileName()->c_str()); } return media; diff --git a/glib/poppler-movie.cc b/glib/poppler-movie.cc index 3bbc2298..999d1c40 100644 --- a/glib/poppler-movie.cc +++ b/glib/poppler-movie.cc @@ -82,7 +82,7 @@ _poppler_movie_new (const Movie *poppler_movie) movie = POPPLER_MOVIE (g_object_new (POPPLER_TYPE_MOVIE, nullptr)); - movie->filename = g_strdup (poppler_movie->getFileName()->getCString()); + movie->filename = g_strdup (poppler_movie->getFileName()->c_str()); if (poppler_movie->getShowPoster()) { Object tmp = poppler_movie->getPoster(); movie->need_poster = (!tmp.isRef() && !tmp.isStream()); diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc index 6a592fbc..34a1c77d 100644 --- a/glib/poppler-page.cc +++ b/glib/poppler-page.cc @@ -818,7 +818,7 @@ poppler_page_get_selected_text (PopplerPage *page, text = poppler_page_get_text_page (page); sel_text = text->getSelectionText (&pdf_selection, selection_style); - result = g_strdup (sel_text->getCString ()); + result = g_strdup (sel_text->c_str ()); delete sel_text; return result; @@ -1710,7 +1710,7 @@ get_font_name_from_word (TextWord *word, gint word_i) } } subset = i > 0 && i < font_name->getLength () && font_name->getChar (i) == '+'; - name = font_name->getCString (); + name = font_name->c_str (); if (subset) name += i + 1; diff --git a/goo/GooString.cc b/goo/GooString.cc index 1c8d08c2..e1fff699 100644 --- a/goo/GooString.cc +++ b/goo/GooString.cc @@ -454,7 +454,7 @@ GooString *GooString::appendfv(const char *fmt, va_list argList) { reverseAlign = !reverseAlign; break; case fmtGooString: - str = arg.gs->getCString(); + str = arg.gs->c_str(); len = arg.gs->getLength(); reverseAlign = !reverseAlign; break; diff --git a/goo/GooString.h b/goo/GooString.h index b5160cf7..e7cc9ce7 100644 --- a/goo/GooString.h +++ b/goo/GooString.h @@ -128,7 +128,7 @@ public: int getLength() const { return size(); } // Get C string. - const char *getCString() const { return c_str(); } + using std::string::c_str; // Get <i>th character. char getChar(int i) const { return (*this)[i]; } diff --git a/goo/gfile.cc b/goo/gfile.cc index 125cbed2..819559c0 100644 --- a/goo/gfile.cc +++ b/goo/gfile.cc @@ -112,7 +112,7 @@ GooString *appendToPath(GooString *path, const char *fileName) { char *p0, *p1, *p2; char *q1; - p0 = path->getCString(); + p0 = path->c_str(); p1 = p0 + path->getLength() - 1; if (!strcmp(fileName, "-")) { if (*p1 == ']') { @@ -154,7 +154,7 @@ GooString *appendToPath(GooString *path, const char *fileName) { tmp = new GooString(path); tmp->append('/'); tmp->append(fileName); - GetFullPathNameA(tmp->getCString(), sizeof(buf), buf, &fp); + GetFullPathNameA(tmp->c_str(), sizeof(buf), buf, &fp); delete tmp; path->clear(); path->append(buf); @@ -168,7 +168,7 @@ GooString *appendToPath(GooString *path, const char *fileName) { path->append("."); i = path->getLength(); path->append(fileName); - for (p = path->getCString() + i; *p; ++p) { + for (p = path->c_str() + i; *p; ++p) { if (*p == '/') { *p = '.'; } else if (*p == '.') { @@ -185,7 +185,7 @@ GooString *appendToPath(GooString *path, const char *fileName) { path->append(":"); i = path->getLength(); path->append(fileName); - for (p = path->getCString() + i; *p; ++p) { + for (p = path->c_str() + i; *p; ++p) { if (*p == '/') { *p = ':'; } else if (*p == '.') { @@ -434,7 +434,7 @@ Goffset GooFile::size() const { } GooFile* GooFile::open(const GooString *fileName) { - HANDLE handle = CreateFileA(fileName->getCString(), + HANDLE handle = CreateFileA(fileName->c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, @@ -483,9 +483,9 @@ Goffset GooFile::size() const { GooFile* GooFile::open(const GooString *fileName) { #ifdef VMS - int fd = ::open(fileName->getCString(), Q_RDONLY, "ctx=stm"); + int fd = ::open(fileName->c_str(), Q_RDONLY, "ctx=stm"); #else - int fd = ::open(fileName->getCString(), O_RDONLY); + int fd = ::open(fileName->c_str(), O_RDONLY); #endif return fd < 0 ? nullptr : new GooFile(fd); @@ -535,10 +535,10 @@ GDirEntry::GDirEntry(const char *dirPath, const char *nameA, bool doStat) { #elif defined(ACORN) #else #ifdef _WIN32 - fa = GetFileAttributesA(fullPath->getCString()); + fa = GetFileAttributesA(fullPath->c_str()); dir = (fa != 0xFFFFFFFF && (fa & FILE_ATTRIBUTE_DIRECTORY)); #else - if (stat(fullPath->getCString(), &st) == 0) + if (stat(fullPath->c_str(), &st) == 0) dir = S_ISDIR(st.st_mode); #endif #endif @@ -558,7 +558,7 @@ GDir::GDir(const char *name, bool doStatA) { tmp = path->copy(); tmp->append("/*.*"); - hnd = FindFirstFileA(tmp->getCString(), &ffd); + hnd = FindFirstFileA(tmp->c_str(), &ffd); delete tmp; #elif defined(ACORN) #elif defined(MACOS) @@ -590,7 +590,7 @@ GDirEntry *GDir::getNextEntry() { #if defined(_WIN32) if (hnd != INVALID_HANDLE_VALUE) { - e = new GDirEntry(path->getCString(), ffd.cFileName, doStat); + e = new GDirEntry(path->c_str(), ffd.cFileName, doStat); if (!FindNextFileA(hnd, &ffd)) { FindClose(hnd); hnd = INVALID_HANDLE_VALUE; @@ -602,13 +602,13 @@ GDirEntry *GDir::getNextEntry() { struct dirent *ent; if (dir) { if (needParent) { - e = new GDirEntry(path->getCString(), "-", doStat); + e = new GDirEntry(path->c_str(), "-", doStat); needParent = false; return e; } ent = readdir(dir); if (ent) { - e = new GDirEntry(path->getCString(), ent->d_name, doStat); + e = new GDirEntry(path->c_str(), ent->d_name, doStat); } } #else @@ -619,7 +619,7 @@ GDirEntry *GDir::getNextEntry() { } while (ent && (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, ".."))); if (ent) { - e = new GDirEntry(path->getCString(), ent->d_name, doStat); + e = new GDirEntry(path->c_str(), ent->d_name, doStat); } } #endif @@ -635,7 +635,7 @@ void GDir::rewind() { FindClose(hnd); tmp = path->copy(); tmp->append("/*.*"); - hnd = FindFirstFileA(tmp->getCString(), &ffd); + hnd = FindFirstFileA(tmp->c_str(), &ffd); delete tmp; #elif defined(ACORN) #elif defined(MACOS) @@ -643,7 +643,7 @@ void GDir::rewind() { if (dir) rewinddir(dir); #ifdef VMS - needParent = strchr(path->getCString(), '[') != NULL; + needParent = strchr(path->c_str(), '[') != NULL; #endif #endif } diff --git a/poppler/Annot.cc b/poppler/Annot.cc index b6b876ad..301aff29 100644 --- a/poppler/Annot.cc +++ b/poppler/Annot.cc @@ -759,7 +759,7 @@ DefaultAppearance::DefaultAppearance(GooString *da) { int i = FormFieldText::tokenizeDA(da, daToks, "Tf"); if (i >= 1) { - fontPtSize = gatof(( (GooString *)daToks->get(i-1) )->getCString()); + fontPtSize = gatof(( (GooString *)daToks->get(i-1) )->c_str()); } if (i >= 2) { // We are expecting a name, therefore the first letter should be '/'. @@ -772,16 +772,16 @@ DefaultAppearance::DefaultAppearance(GooString *da) { for (i = daToks->getLength()-1; i >= 0; --i) { if (!fontColor) { if (!((GooString *)daToks->get(i))->cmp("g") && i >= 1) { - fontColor = std::make_unique<AnnotColor>(gatof(( (GooString *)daToks->get(i-1) )->getCString())); + fontColor = std::make_unique<AnnotColor>(gatof(( (GooString *)daToks->get(i-1) )->c_str())); } else if (!((GooString *)daToks->get(i))->cmp("rg") && i >= 3) { - fontColor = std::make_unique<AnnotColor>(gatof(( (GooString *)daToks->get(i-3) )->getCString()), - gatof(( (GooString *)daToks->get(i-2) )->getCString()), - gatof(( (GooString *)daToks->get(i-1) )->getCString())); + fontColor = std::make_unique<AnnotColor>(gatof(( (GooString *)daToks->get(i-3) )->c_str()), + gatof(( (GooString *)daToks->get(i-2) )->c_str()), + gatof(( (GooString *)daToks->get(i-1) )->c_str())); } else if (!((GooString *)daToks->get(i))->cmp("k") && i >= 4) { - fontColor = std::make_unique<AnnotColor>(gatof(( (GooString *)daToks->get(i-4) )->getCString()), - gatof(( (GooString *)daToks->get(i-3) )->getCString()), - gatof(( (GooString *)daToks->get(i-2) )->getCString()), - gatof(( (GooString *)daToks->get(i-1) )->getCString())); + fontColor = std::make_unique<AnnotColor>(gatof(( (GooString *)daToks->get(i-4) )->c_str()), + gatof(( (GooString *)daToks->get(i-3) )->c_str()), + gatof(( (GooString *)daToks->get(i-2) )->c_str()), + gatof(( (GooString *)daToks->get(i-1) )->c_str())); } } } @@ -1279,7 +1279,7 @@ void Annot::initialize(PDFDoc *docA, Dict *dict) { //----- get the annotation appearance if (appearStreams) { - appearance = appearStreams->getAppearanceStream(AnnotAppearance::appearNormal, appearState->getCString()); + appearance = appearStreams->getAppearanceStream(AnnotAppearance::appearNormal, appearState->c_str()); } //----- parse the border style @@ -1464,7 +1464,7 @@ void Annot::setAppearanceState(const char *state) { // The appearance state determines the current appearance stream if (appearStreams) { - appearance = appearStreams->getAppearanceStream(AnnotAppearance::appearNormal, appearState->getCString()); + appearance = appearStreams->getAppearanceStream(AnnotAppearance::appearNormal, appearState->c_str()); } else { appearance.setToNull(); } @@ -1762,7 +1762,7 @@ Object Annot::createForm(const GooString *appearBuf, double *bbox, bool transpar if (resDictObject.isDict()) appearDict->set("Resources", std::move(resDictObject)); - Stream *mStream = new AutoFreeMemStream(copyString(appearBuf->getCString()), 0, + Stream *mStream = new AutoFreeMemStream(copyString(appearBuf->c_str()), 0, appearBuf->getLength(), Object(appearDict)); return Object(mStream); } @@ -2162,7 +2162,7 @@ void AnnotText::setIcon(GooString *new_icon) { icon = std::make_unique<GooString>("Note"); } - update("Name", Object(objName, icon->getCString())); + update("Name", Object(objName, icon->c_str())); invalidateAppearance(); } @@ -3922,7 +3922,7 @@ void Annot::layoutText(const GooString *text, GooString *outBuf, int *i, // Compute width of character just output if (outBuf->getLength() > last_o2) { dx = 0.0; - font->getNextChar(outBuf->getCString() + last_o2, + font->getNextChar(outBuf->c_str() + last_o2, outBuf->getLength() - last_o2, &c, &uAux, &uLen, &dx, &dy, &ox, &oy); w += dx; @@ -3977,7 +3977,7 @@ void Annot::layoutText(const GooString *text, GooString *outBuf, int *i, // Compute the actual width and character count of the final string, based on // breakpoint, if this information is requested by the caller. if (width != nullptr || charCount != nullptr) { - const char *s = outBuf->getCString(); + const char *s = outBuf->c_str(); int len = outBuf->getLength(); if (width != nullptr) @@ -4098,7 +4098,7 @@ bool AnnotAppearanceBuilder::drawText(const GooString *text, const GooString *da if (tfPos >= 0) { tok = (GooString *)daToks->get(tfPos); if (tok->getLength() >= 1 && tok->getChar(0) == '/') { - if (!resources || !(font = resources->lookupFont(tok->getCString() + 1))) { + if (!resources || !(font = resources->lookupFont(tok->c_str() + 1))) { if (forceZapfDingbats) { // We are forcing ZaDb but the font does not exist // so create a fake one @@ -4118,7 +4118,7 @@ bool AnnotAppearanceBuilder::drawText(const GooString *text, const GooString *da error(errSyntaxError, -1, "Invalid font name in 'Tf' operator in field's DA string"); } tok = (GooString *)daToks->get(tfPos + 1); - fontSize = gatof(tok->getCString()); + fontSize = gatof(tok->c_str()); } else { error(errSyntaxError, -1, "Missing 'Tf' operator in field's DA string"); } @@ -4331,7 +4331,7 @@ bool AnnotAppearanceBuilder::drawText(const GooString *text, const GooString *da } // write the text string - const char *s = convertedText.getCString(); + const char *s = convertedText.c_str(); int len = convertedText.getLength(); i = 0; xPrev = w; // so that first character is placed properly @@ -4492,14 +4492,14 @@ bool AnnotAppearanceBuilder::drawListBox(const FormFieldChoice *fieldChoice, con if (tfPos >= 0) { tok = (GooString *)daToks->get(tfPos); if (tok->getLength() >= 1 && tok->getChar(0) == '/') { - if (!resources || !(font = resources->lookupFont(tok->getCString() + 1))) { + if (!resources || !(font = resources->lookupFont(tok->c_str() + 1))) { error(errSyntaxError, -1, "Unknown font in field's DA string"); } } else { error(errSyntaxError, -1, "Invalid font name in 'Tf' operator in field's DA string"); } tok = (GooString *)daToks->get(tfPos + 1); - fontSize = gatof(tok->getCString()); + fontSize = gatof(tok->c_str()); } else { error(errSyntaxError, -1, "Missing 'Tf' operator in field's DA string"); } @@ -4761,7 +4761,7 @@ bool AnnotAppearanceBuilder::drawFormFieldButton(const FormFieldButton *field, c case formButtonRadio: { //~ Acrobat doesn't draw a caption if there is no AP dict (?) if (appearState && appearState->cmp("Off") != 0 && - field->getState(appearState->getCString())) { + field->getState(appearState->c_str())) { if (caption) { return drawText(caption, da, resources, border, appearCharacs, rect, false, 0, fieldQuadCenter, false, true, xref, addedDingbatsResource, false); } else if (appearCharacs) { @@ -4886,7 +4886,7 @@ void AnnotWidget::generateFieldAppearance(bool *addedDingbatsResource) { } // build the appearance stream - Stream *appearStream = new AutoFreeMemStream(copyString(appearBuf->getCString()), 0, + Stream *appearStream = new AutoFreeMemStream(copyString(appearBuf->c_str()), 0, appearBuf->getLength(), Object(appearDict)); appearance = Object(appearStream); } @@ -5063,7 +5063,7 @@ void AnnotMovie::draw(Gfx *gfx, bool printing) { formDict->set("Matrix", Object(matrix)); formDict->set("Resources", Object(resDict)); - Stream *mStream = new AutoFreeMemStream(copyString(appearBuf->getCString()), 0, + Stream *mStream = new AutoFreeMemStream(copyString(appearBuf->c_str()), 0, appearBuf->getLength(), Object(formDict)); Dict *dict = new Dict(gfx->getXRef()); @@ -5184,7 +5184,7 @@ void AnnotStamp::setIcon(GooString *new_icon) { icon = std::make_unique<GooString>(); } - update("Name", Object(objName, icon->getCString())); + update("Name", Object(objName, icon->c_str())); invalidateAppearance(); } diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc index 4114fa7b..ad3c39e9 100644 --- a/poppler/CairoFontEngine.cc +++ b/poppler/CairoFontEngine.cc @@ -417,7 +417,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, if (!(fontLoc = gfxFont->locateFont(xref, nullptr))) { error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'", - gfxFont->getName() ? gfxFont->getName()->getCString() + gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); goto err2; } @@ -436,7 +436,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, } if (fileName != nullptr) { - fileNameC = fileName->getCString(); + fileNameC = fileName->c_str(); } switch (fontType) { diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index 0eb09525..4fc9882c 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -654,7 +654,7 @@ void CairoOutputDev::updateFont(GfxState *state) { cairo_font_face_t *font_face; cairo_matrix_t matrix, invert_matrix; - LOG(printf ("updateFont() font=%s\n", state->getFont()->getName()->getCString())); + LOG(printf ("updateFont() font=%s\n", state->getFont()->getName()->c_str())); needFontUpdate = false; @@ -2884,7 +2884,7 @@ static cairo_status_t setMimeIdFromRef(cairo_surface_t *surface, mime_id->appendf("{0:d}-{1:d}", ref.gen, ref.num); - idBuffer = copyString(mime_id->getCString()); + idBuffer = copyString(mime_id->c_str()); status = cairo_surface_set_mime_data (surface, mime_type, (const unsigned char *)idBuffer, mime_id->getLength(), @@ -2945,7 +2945,7 @@ bool CairoOutputDev::setMimeDataForCCITTParams(Stream *str, params.appendf(" BlackIs1={0:d}", ccittStr->getBlackIs1() ? 1 : 0); params.appendf(" DamagedRowsBeforeError={0:d}", ccittStr->getDamagedRowsBeforeError()); - char *p = strdup(params.getCString()); + char *p = strdup(params.c_str()); if (cairo_surface_set_mime_data (image, CAIRO_MIME_TYPE_CCITT_FAX_PARAMS, (const unsigned char*)p, params.getLength(), diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc index 6048cc42..25f0c366 100644 --- a/poppler/Catalog.cc +++ b/poppler/Catalog.cc @@ -341,7 +341,7 @@ int Catalog::findPage(int num, int gen) { LinkDest *Catalog::findDest(const GooString *name) { // try named destination dictionary then name tree if (getDests()->isDict()) { - Object obj1 = getDests()->dictLookup(name->getCString()); + Object obj1 = getDests()->dictLookup(name->c_str()); return createLinkDest(&obj1); } @@ -649,7 +649,7 @@ Object NameTree::lookup(const GooString *name) if (entry != nullptr) { return (*entry)->value.fetch(xref); } else { - error(errSyntaxError, -1, "failed to look up ({0:s})", name->getCString()); + error(errSyntaxError, -1, "failed to look up ({0:s})", name->c_str()); return Object(objNull); } } @@ -681,7 +681,7 @@ bool Catalog::labelToIndex(GooString *label, int *index) if (!pli->labelToIndex(label, index)) return false; } else { - *index = strtol(label->getCString(), &end, 10) - 1; + *index = strtol(label->c_str(), &end, 10) - 1; if (*end != '\0') return false; } diff --git a/poppler/CharCodeToUnicode.cc b/poppler/CharCodeToUnicode.cc index 237f8103..f1eacda5 100644 --- a/poppler/CharCodeToUnicode.cc +++ b/poppler/CharCodeToUnicode.cc @@ -179,7 +179,7 @@ CharCodeToUnicode *CharCodeToUnicode::parseUnicodeToUnicode( int line, n, i; char *tokptr; - if (!(f = openFile(fileName->getCString(), "r"))) { + if (!(f = openFile(fileName->c_str(), "r"))) { gfree(uBuf); error(errIO, -1, "Couldn't open unicodeToUnicode file '{0:t}'", fileName); @@ -267,7 +267,7 @@ CharCodeToUnicode *CharCodeToUnicode::parseCMap(GooString *buf, int nBits) { CharCodeToUnicode *ctu; ctu = new CharCodeToUnicode(nullptr); - const char *p = buf->getCString(); + const char *p = buf->c_str(); ctu->parseCMap1(&getCharFromString, &p, nBits); return ctu; } @@ -289,7 +289,7 @@ CharCodeToUnicode *CharCodeToUnicode::parseCMapFromFile(GooString *fileName, } void CharCodeToUnicode::mergeCMap(GooString *buf, int nBits) { - const char *p = buf->getCString(); + const char *p = buf->c_str(); parseCMap1(&getCharFromString, &p, nBits); } diff --git a/poppler/CurlCachedFile.cc b/poppler/CurlCachedFile.cc index 907baafe..a112ca23 100644 --- a/poppler/CurlCachedFile.cc +++ b/poppler/CurlCachedFile.cc @@ -46,7 +46,7 @@ CurlCachedFileLoader::init(GooString *urlA, CachedFile *cachedFileA) cachedFile = cachedFileA; curl = curl_easy_init(); - curl_easy_setopt(curl, CURLOPT_URL, url->getCString()); + curl_easy_setopt(curl, CURLOPT_URL, url->c_str()); curl_easy_setopt(curl, CURLOPT_HEADER, 1); curl_easy_setopt(curl, CURLOPT_NOBODY, 1); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &noop_cb); @@ -81,10 +81,10 @@ int CurlCachedFileLoader::load(const std::vector<ByteRange> &ranges, CachedFileW toByte = fromByte + ranges[i].length - 1; GooString *range = GooString::format("{0:ud}-{1:ud}", fromByte, toByte); - curl_easy_setopt(curl, CURLOPT_URL, url->getCString()); + curl_easy_setopt(curl, CURLOPT_URL, url->c_str()); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, load_cb); curl_easy_setopt(curl, CURLOPT_WRITEDATA, writer); - curl_easy_setopt(curl, CURLOPT_RANGE, range->getCString()); + curl_easy_setopt(curl, CURLOPT_RANGE, range->c_str()); r = curl_easy_perform(curl); curl_easy_reset(curl); diff --git a/poppler/DateInfo.cc b/poppler/DateInfo.cc index d0988f24..67be91cf 100644 --- a/poppler/DateInfo.cc +++ b/poppler/DateInfo.cc @@ -123,7 +123,7 @@ time_t dateStringToTime(const GooString *dateString) { struct tm tm; time_t time; - if (!parseDateString (dateString->getCString(), &year, &mon, &day, &hour, &min, &sec, &tz, &tz_hour, &tz_minute)) + if (!parseDateString (dateString->c_str(), &year, &mon, &day, &hour, &min, &sec, &tz, &tz_hour, &tz_minute)) return -1; tm.tm_year = year - 1900; diff --git a/poppler/Decrypt.cc b/poppler/Decrypt.cc index 8c1196b0..22882ebc 100644 --- a/poppler/Decrypt.cc +++ b/poppler/Decrypt.cc @@ -93,32 +93,32 @@ bool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength, if (len > 127) { len = 127; } - memcpy(test, ownerPassword->getCString(), len); - memcpy(test + len, ownerKey->getCString() + 32, 8); - memcpy(test + len + 8, userKey->getCString(), 48); + memcpy(test, ownerPassword->c_str(), len); + memcpy(test + len, ownerKey->c_str() + 32, 8); + memcpy(test + len + 8, userKey->c_str(), 48); sha256(test, len + 56, test); if (encRevision == 6) { //test contains the initial SHA-256 hash as input K. - revision6Hash(ownerPassword, test, userKey->getCString()); + revision6Hash(ownerPassword, test, userKey->c_str()); } - if (!memcmp(test, ownerKey->getCString(), 32)) { + if (!memcmp(test, ownerKey->c_str(), 32)) { // compute the file key from the owner password - memcpy(test, ownerPassword->getCString(), len); - memcpy(test + len, ownerKey->getCString() + 40, 8); - memcpy(test + len + 8, userKey->getCString(), 48); + memcpy(test, ownerPassword->c_str(), len); + memcpy(test + len, ownerKey->c_str() + 40, 8); + memcpy(test + len + 8, userKey->c_str(), 48); sha256(test, len + 56, test); if (encRevision == 6) { //test contains the initial SHA-256 hash input K. - revision6Hash(ownerPassword, test, userKey->getCString()); + revision6Hash(ownerPassword, test, userKey->c_str()); } aes256KeyExpansion(&state, test, 32, true); for (i = 0; i < 16; ++i) { state.cbc[i] = 0; } - aes256DecryptBlock(&state, (Guchar *)ownerEnc->getCString(), false); + aes256DecryptBlock(&state, (Guchar *)ownerEnc->c_str(), false); memcpy(fileKey, state.buf, 16); - aes256DecryptBlock(&state, (Guchar *)ownerEnc->getCString() + 16, + aes256DecryptBlock(&state, (Guchar *)ownerEnc->c_str() + 16, false); memcpy(fileKey + 16, state.buf, 16); @@ -134,19 +134,19 @@ bool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength, if (len > 127) { len = 127; } - memcpy(test, userPassword->getCString(), len); - memcpy(test + len, userKey->getCString() + 32, 8); + memcpy(test, userPassword->c_str(), len); + memcpy(test + len, userKey->c_str() + 32, 8); sha256(test, len + 8, test); if(encRevision == 6) { // test contains the initial SHA-256 hash input K. // user key is not used in checking user password. revision6Hash(userPassword, test, nullptr); } - if (!memcmp(test, userKey->getCString(), 32)) { + if (!memcmp(test, userKey->c_str(), 32)) { // compute the file key from the user password - memcpy(test, userPassword->getCString(), len); - memcpy(test + len, userKey->getCString() + 40, 8); + memcpy(test, userPassword->c_str(), len); + memcpy(test + len, userKey->c_str() + 40, 8); sha256(test, len + 8, test); if(encRevision == 6) { //test contains the initial SHA-256 hash input K. @@ -157,9 +157,9 @@ bool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength, for (i = 0; i < 16; ++i) { state.cbc[i] = 0; } - aes256DecryptBlock(&state, (Guchar *)userEnc->getCString(), false); + aes256DecryptBlock(&state, (Guchar *)userEnc->c_str(), false); memcpy(fileKey, state.buf, 16); - aes256DecryptBlock(&state, (Guchar *)userEnc->getCString() + 16, + aes256DecryptBlock(&state, (Guchar *)userEnc->c_str() + 16, false); memcpy(fileKey + 16, state.buf, 16); @@ -174,10 +174,10 @@ bool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength, if (ownerPassword) { len = ownerPassword->getLength(); if (len < 32) { - memcpy(test, ownerPassword->getCString(), len); + memcpy(test, ownerPassword->c_str(), len); memcpy(test + len, passwordPad, 32 - len); } else { - memcpy(test, ownerPassword->getCString(), 32); + memcpy(test, ownerPassword->c_str(), 32); } md5(test, 32, test); if (encRevision == 3) { @@ -192,7 +192,7 @@ bool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength, test2[i] = rc4DecryptByte(fState, &fx, &fy, ownerKey->getChar(i)); } } else { - memcpy(test2, ownerKey->getCString(), 32); + memcpy(test2, ownerKey->c_str(), 32); for (i = 19; i >= 0; --i) { for (j = 0; j < keyLength; ++j) { tmpKey[j] = test[j] ^ i; @@ -240,20 +240,20 @@ bool Decrypt::makeFileKey2(int encVersion, int encRevision, int keyLength, if (userPassword) { len = userPassword->getLength(); if (len < 32) { - memcpy(buf, userPassword->getCString(), len); + memcpy(buf, userPassword->c_str(), len); memcpy(buf + len, passwordPad, 32 - len); } else { - memcpy(buf, userPassword->getCString(), 32); + memcpy(buf, userPassword->c_str(), 32); } } else { memcpy(buf, passwordPad, 32); } - memcpy(buf + 32, ownerKey->getCString(), 32); + memcpy(buf + 32, ownerKey->c_str(), 32); buf[64] = permissions & 0xff; buf[65] = (permissions >> 8) & 0xff; buf[66] = (permissions >> 16) & 0xff; buf[67] = (permissions >> 24) & 0xff; - memcpy(buf + 68, fileID->getCString(), fileID->getLength()); + memcpy(buf + 68, fileID->c_str(), fileID->getLength()); len = 68 + fileID->getLength(); if (!encryptMetadata) { buf[len++] = 0xff; @@ -277,7 +277,7 @@ bool Decrypt::makeFileKey2(int encVersion, int encRevision, int keyLength, } ok = memcmp(test, passwordPad, 32) == 0; } else if (encRevision == 3) { - memcpy(test, userKey->getCString(), 32); + memcpy(test, userKey->c_str(), 32); for (i = 19; i >= 0; --i) { for (j = 0; j < keyLength; ++j) { tmpKey[j] = fileKey[j] ^ i; @@ -289,7 +289,7 @@ bool Decrypt::makeFileKey2(int encVersion, int encRevision, int keyLength, } } memcpy(buf, passwordPad, 32); - memcpy(buf + 32, fileID->getCString(), fileID->getLength()); + memcpy(buf + 32, fileID->c_str(), fileID->getLength()); md5(buf, 32 + fileID->getLength(), buf); ok = memcmp(test, buf, 16) == 0; } else { diff --git a/poppler/Error.cc b/poppler/Error.cc index 8c47d854..f3e1ce0a 100644 --- a/poppler/Error.cc +++ b/poppler/Error.cc @@ -79,14 +79,14 @@ void CDECL error(ErrorCategory category, Goffset pos, const char *msg, ...) { } if (errorCbk) { - (*errorCbk)(errorCbkData, category, pos, sanitized->getCString()); + (*errorCbk)(errorCbkData, category, pos, sanitized->c_str()); } else { if (pos >= 0) { fprintf(stderr, "%s (%lld): %s\n", - errorCategoryNames[category], (long long)pos, sanitized->getCString()); + errorCategoryNames[category], (long long)pos, sanitized->c_str()); } else { fprintf(stderr, "%s: %s\n", - errorCategoryNames[category], sanitized->getCString()); + errorCategoryNames[category], sanitized->c_str()); } fflush(stderr); } diff --git a/poppler/Form.cc b/poppler/Form.cc index 5f2dfdb1..e0e89006 100644 --- a/poppler/Form.cc +++ b/poppler/Form.cc @@ -61,7 +61,7 @@ char* pdfDocEncodingToUTF16 (const GooString* orig, int* length) //double size, a unicode char takes 2 char, add 2 for the unicode marker *length = 2+2*orig->getLength(); char *result = new char[(*length)]; - const char *cstring = orig->getCString(); + const char *cstring = orig->c_str(); //unicode marker result[0] = (char)0xfe; result[1] = (char)0xff; @@ -201,7 +201,7 @@ FormWidgetButton::FormWidgetButton (PDFDoc *docA, Object *aobj, unsigned num, Re const char *FormWidgetButton::getOnStr() const { if (onStr) - return onStr->getCString(); + return onStr->c_str(); // 12.7.4.2.3 Check Boxes // Yes should be used as the name for the on state @@ -863,7 +863,7 @@ GooString* FormField::getFullyQualifiedName() { if (unicode_encoded) { full_name->insert(0, "\0.", 2); // 2-byte unicode period if (parent_name->hasUnicodeMarker()) { - full_name->insert(0, parent_name->getCString() + 2, parent_name->getLength() - 2); // Remove the unicode BOM + full_name->insert(0, parent_name->c_str() + 2, parent_name->getLength() - 2); // Remove the unicode BOM } else { int tmp_length; char* tmp_str = pdfDocEncodingToUTF16(parent_name, &tmp_length); @@ -875,7 +875,7 @@ GooString* FormField::getFullyQualifiedName() { if (parent_name->hasUnicodeMarker()) { unicode_encoded = true; full_name = convertToUtf16(full_name); - full_name->insert(0, parent_name->getCString() + 2, parent_name->getLength() - 2); // Remove the unicode BOM + full_name->insert(0, parent_name->c_str() + 2, parent_name->getLength() - 2); // Remove the unicode BOM } else { full_name->insert(0, parent_name); } @@ -887,7 +887,7 @@ GooString* FormField::getFullyQualifiedName() { if (partialName) { if (unicode_encoded) { if (partialName->hasUnicodeMarker()) { - full_name->append(partialName->getCString() + 2, partialName->getLength() - 2); // Remove the unicode BOM + full_name->append(partialName->c_str() + 2, partialName->getLength() - 2); // Remove the unicode BOM } else { int tmp_length; char* tmp_str = pdfDocEncodingToUTF16(partialName, &tmp_length); @@ -898,7 +898,7 @@ GooString* FormField::getFullyQualifiedName() { if (partialName->hasUnicodeMarker()) { unicode_encoded = true; full_name = convertToUtf16(full_name); - full_name->append(partialName->getCString() + 2, partialName->getLength() - 2); // Remove the unicode BOM + full_name->append(partialName->c_str() + 2, partialName->getLength() - 2); // Remove the unicode BOM } else { full_name->append(partialName); } @@ -1218,7 +1218,7 @@ double FormFieldText::getTextFontSize() double fontSize = -1; if (idx >= 0) { char* p = nullptr; - fontSize = strtod(static_cast<GooString*>(daToks->get(idx))->getCString(), &p); + fontSize = strtod(static_cast<GooString*>(daToks->get(idx))->c_str(), &p); if (!p || *p) fontSize = -1; } @@ -1625,12 +1625,12 @@ void FormFieldSignature::parseInfo() const Object location_obj = sig_dict.dictLookup("Location"); if (location_obj.isString()) { - signature_info->setLocation(location_obj.getString()->getCString()); + signature_info->setLocation(location_obj.getString()->c_str()); } const Object reason_obj = sig_dict.dictLookup("Reason"); if (reason_obj.isString()) { - signature_info->setReason(reason_obj.getString()->getCString()); + signature_info->setReason(reason_obj.getString()->c_str()); } // retrieve SigningTime @@ -1719,7 +1719,7 @@ SignatureInfo *FormFieldSignature::validateSignature(bool doVerifyCert, bool for SECErrorCodes cert_val_state; const int signature_len = signature->getLength(); unsigned char *signatureuchar = (unsigned char *)gmalloc(signature_len); - memcpy(signatureuchar, signature->getCString(), signature_len); + memcpy(signatureuchar, signature->c_str(), signature_len); SignatureHandler signature_handler(signatureuchar, signature_len); Goffset fileLength = doc->getBaseStream()->getLength(); diff --git a/poppler/Function.cc b/poppler/Function.cc index c70c32d2..b0faffb6 100644 --- a/poppler/Function.cc +++ b/poppler/Function.cc @@ -1268,7 +1268,7 @@ bool PostScriptFunction::parseCode(Stream *str, int *codePtr) { error(errSyntaxError, -1, "Unexpected end of PostScript function stream"); return false; } - const char *p = tok->getCString(); + const char *p = tok->c_str(); if (isdigit(*p) || *p == '.' || *p == '-') { isReal = false; for (; *p; ++p) { @@ -1280,10 +1280,10 @@ bool PostScriptFunction::parseCode(Stream *str, int *codePtr) { resizeCode(*codePtr); if (isReal) { code[*codePtr].type = psReal; - code[*codePtr].real = gatof(tok->getCString()); + code[*codePtr].real = gatof(tok->c_str()); } else { code[*codePtr].type = psInt; - code[*codePtr].intg = atoi(tok->getCString()); + code[*codePtr].intg = atoi(tok->c_str()); } ++*codePtr; delete tok; diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc index 3dfc08e8..9a117569 100644 --- a/poppler/Gfx.cc +++ b/poppler/Gfx.cc @@ -3672,8 +3672,8 @@ void Gfx::opSetFont(Object args[], int numArgs) { } if (printCommands) { printf(" font: tag=%s name='%s' %g\n", - font->getTag()->getCString(), - font->getName() ? font->getName()->getCString() : "???", + font->getTag()->c_str(), + font->getName() ? font->getName()->c_str() : "???", args[1].getNum()); fflush(stdout); } @@ -3941,7 +3941,7 @@ void Gfx::doShowText(const GooString *s) { curX = state->getCurX(); curY = state->getCurY(); oldParser = parser; - p = s->getCString(); + p = s->c_str(); len = s->getLength(); while (len > 0) { n = font->getNextChar(p, len, &code, @@ -4010,7 +4010,7 @@ void Gfx::doShowText(const GooString *s) { parser = oldParser; } else if (out->useDrawChar()) { - p = s->getCString(); + p = s->c_str(); len = s->getLength(); while (len > 0) { n = font->getNextChar(p, len, &code, @@ -4043,7 +4043,7 @@ void Gfx::doShowText(const GooString *s) { } } else { dx = dy = 0; - p = s->getCString(); + p = s->c_str(); len = s->getLength(); nChars = nSpaces = 0; while (len > 0) { diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc index dc60318a..862077bf 100644 --- a/poppler/GfxFont.cc +++ b/poppler/GfxFont.cc @@ -729,7 +729,7 @@ GfxFontLoc *GfxFont::locateFont(XRef *xref, PSOutputDev *ps) { substName = new GooString(base14SubstFonts[substIdx]); if (ps) { error(errSyntaxWarning, -1, "Substituting font '{0:s}' for '{1:s}'", - base14SubstFonts[substIdx], name ? name->getCString() : "null"); + base14SubstFonts[substIdx], name ? name->c_str() : "null"); fontLoc = new GfxFontLoc(); fontLoc->locType = gfxFontLocResident; fontLoc->fontType = fontType1; @@ -742,7 +742,7 @@ GfxFontLoc *GfxFont::locateFont(XRef *xref, PSOutputDev *ps) { if (path) { if ((fontLoc = getExternalFont(path, false))) { error(errSyntaxWarning, -1, "Substituting font '{0:s}' for '{1:s}'", - base14SubstFonts[substIdx], name ? name->getCString() : ""); + base14SubstFonts[substIdx], name ? name->c_str() : ""); name = new GooString(base14SubstFonts[substIdx]); fontLoc->substIdx = substIdx; return fontLoc; @@ -773,7 +773,7 @@ GfxFontLoc *GfxFont::getExternalFont(GooString *path, bool cid) { GfxFontType fontType; GfxFontLoc *fontLoc; - fft = FoFiIdentifier::identifyFile(path->getCString()); + fft = FoFiIdentifier::identifyFile(path->c_str()); switch (fft) { case fofiIdType1PFA: case fofiIdType1PFB: @@ -1820,7 +1820,7 @@ GfxCIDFont::GfxCIDFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA, return; } if (cMap->getCMapName()) { - encodingName->Set(cMap->getCMapName()->getCString()); + encodingName->Set(cMap->getCMapName()->c_str()); } else { encodingName->Set("Custom"); } @@ -2228,7 +2228,7 @@ int *GfxCIDFont::getCodeToGIDMap(FoFiTrueType *ff, int *mapsizep) { wmode = getWMode(); for (lp = CMapList;lp->collection != nullptr;lp++) { - if (strcmp(lp->collection,getCollection()->getCString()) == 0) { + if (strcmp(lp->collection,getCollection()->c_str()) == 0) { break; } } @@ -2504,7 +2504,7 @@ void GfxFontDict::hashFontObject1(Object *obj, FNVHash *h) { case objString: h->hash('s'); s = obj->getString(); - h->hash(s->getCString(), s->getLength()); + h->hash(s->c_str(), s->getLength()); break; case objName: h->hash('n'); diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc index b8f93429..4e978233 100644 --- a/poppler/GfxState.cc +++ b/poppler/GfxState.cc @@ -462,9 +462,9 @@ cmsHPROFILE loadColorProfile(const char *fileName) GooString *path = new GooString(GLOBAL_COLOR_PROFILE_DIR); path->append(fileName); // check if open the file - if ((fp = fopen(path->getCString(),"r")) != nullptr) { + if ((fp = fopen(path->c_str(),"r")) != nullptr) { fclose(fp); - hp = cmsOpenProfileFromFile(path->getCString(),"r"); + hp = cmsOpenProfileFromFile(path->c_str(),"r"); } delete path; return hp; @@ -493,7 +493,7 @@ int GfxColorSpace::setupColorProfiles() if (displayProfileName == nullptr) { displayProfile = loadColorProfile("display.icc"); } else if (displayProfileName->getLength() > 0) { - displayProfile = loadColorProfile(displayProfileName->getCString()); + displayProfile = loadColorProfile(displayProfileName->c_str()); } } // load RGB profile @@ -2495,7 +2495,7 @@ GfxColorSpace *GfxIndexedColorSpace::parse(GfxResources *res, Array *arr, Output error(errSyntaxWarning, -1, "Bad Indexed color space (lookup table string too short)"); goto err3; } - s = obj1.getString()->getCString(); + s = obj1.getString()->c_str(); for (i = 0; i <= indexHighA; ++i) { for (j = 0; j < n; ++j) { cs->lookup[i*n + j] = (Guchar)*s++; diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc index b0d5e5df..9a670ce3 100644 --- a/poppler/GlobalParams.cc +++ b/poppler/GlobalParams.cc @@ -205,17 +205,17 @@ SysFontInfo::~SysFontInfo() { } bool SysFontInfo::match(SysFontInfo *fi) { - return !strcasecmp(name->getCString(), fi->name->getCString()) && + return !strcasecmp(name->c_str(), fi->name->c_str()) && bold == fi->bold && italic == fi->italic && oblique == fi->oblique && fixedWidth == fi->fixedWidth; } bool SysFontInfo::match(GooString *nameA, bool boldA, bool italicA, bool obliqueA, bool fixedWidthA) { - return !strcasecmp(name->getCString(), nameA->getCString()) && + return !strcasecmp(name->c_str(), nameA->c_str()) && bold == boldA && italic == italicA && oblique == obliqueA && fixedWidth == fixedWidthA; } bool SysFontInfo::match(GooString *nameA, bool boldA, bool italicA) { - return !strcasecmp(name->getCString(), nameA->getCString()) && + return !strcasecmp(name->c_str(), nameA->c_str()) && bold == boldA && italic == italicA; } @@ -278,19 +278,19 @@ SysFontInfo *SysFontList::find(const GooString *name, bool fixedWidth, bool exac n = name2->getLength(); // remove trailing "MT" (Foo-MT, Foo-BoldMT, etc.) - if (n > 2 && !strcmp(name2->getCString() + n - 2, "MT")) { + if (n > 2 && !strcmp(name2->c_str() + n - 2, "MT")) { name2->del(n - 2, 2); n -= 2; } // look for "Regular" - if (n > 7 && !strcmp(name2->getCString() + n - 7, "Regular")) { + if (n > 7 && !strcmp(name2->c_str() + n - 7, "Regular")) { name2->del(n - 7, 7); n -= 7; } // look for "Italic" - if (n > 6 && !strcmp(name2->getCString() + n - 6, "Italic")) { + if (n > 6 && !strcmp(name2->c_str() + n - 6, "Italic")) { name2->del(n - 6, 6); italic = true; n -= 6; @@ -299,7 +299,7 @@ SysFontInfo *SysFontList::find(const GooString *name, bool fixedWidth, bool exac } // look for "Oblique" - if (n > 6 && !strcmp(name2->getCString() + n - 7, "Oblique")) { + if (n > 6 && !strcmp(name2->c_str() + n - 7, "Oblique")) { name2->del(n - 7, 7); oblique = true; n -= 6; @@ -308,7 +308,7 @@ SysFontInfo *SysFontList::find(const GooString *name, bool fixedWidth, bool exac } // look for "Bold" - if (n > 4 && !strcmp(name2->getCString() + n - 4, "Bold")) { + if (n > 4 && !strcmp(name2->c_str() + n - 4, "Bold")) { name2->del(n - 4, 4); bold = true; n -= 4; @@ -317,19 +317,19 @@ SysFontInfo *SysFontList::find(const GooString *name, bool fixedWidth, bool exac } // remove trailing "MT" (FooMT-Bold, etc.) - if (n > 2 && !strcmp(name2->getCString() + n - 2, "MT")) { + if (n > 2 && !strcmp(name2->c_str() + n - 2, "MT")) { name2->del(n - 2, 2); n -= 2; } // remove trailing "PS" - if (n > 2 && !strcmp(name2->getCString() + n - 2, "PS")) { + if (n > 2 && !strcmp(name2->c_str() + n - 2, "PS")) { name2->del(n - 2, 2); n -= 2; } // remove trailing "IdentityH" - if (n > 9 && !strcmp(name2->getCString() + n - 9, "IdentityH")) { + if (n > 9 && !strcmp(name2->c_str() + n - 9, "IdentityH")) { name2->del(n - 9, 9); n -= 9; } @@ -503,7 +503,7 @@ void GlobalParams::parseNameToUnicode(const GooString *name) { Unicode u; char *tokptr; - if (!(f = openFile(name->getCString(), "r"))) { + if (!(f = openFile(name->c_str(), "r"))) { error(errIO, -1, "Couldn't open 'nameToUnicode' file '{0:t}'", name); return; @@ -618,8 +618,8 @@ FILE *GlobalParams::findCMapFile(const GooString *collection, const GooString *c const auto cMapDirs = this->cMapDirs.equal_range(collection->toStr()); for (auto cMapDir = cMapDirs.first; cMapDir != cMapDirs.second; ++cMapDir) { auto* const path = new GooString(cMapDir->second); - appendToPath(path, cMapName->getCString()); - file = openFile(path->getCString(), "r"); + appendToPath(path, cMapName->c_str()); + file = openFile(path->c_str(), "r"); delete path; if (file) { break; @@ -637,8 +637,8 @@ FILE *GlobalParams::findToUnicodeFile(const GooString *name) { globalParamsLocker(); for (i = 0; i < toUnicodeDirs->getLength(); ++i) { dir = (GooString *)toUnicodeDirs->get(i); - fileName = appendToPath(dir->copy(), name->getCString()); - f = openFile(fileName->getCString(), "r"); + fileName = appendToPath(dir->copy(), name->c_str()); + f = openFile(fileName->c_str(), "r"); delete fileName; if (f) { return f; @@ -676,19 +676,19 @@ static const char *getFontLang(GfxFont *font) const GooString *collection = ((GfxCIDFont *)font)->getCollection(); if (collection) { - if (strcmp(collection->getCString(), "Adobe-GB1") == 0) + if (strcmp(collection->c_str(), "Adobe-GB1") == 0) lang = "zh-cn"; // Simplified Chinese - else if (strcmp(collection->getCString(), "Adobe-CNS1") == 0) + else if (strcmp(collection->c_str(), "Adobe-CNS1") == 0) lang = "zh-tw"; // Traditional Chinese - else if (strcmp(collection->getCString(), "Adobe-Japan1") == 0) + else if (strcmp(collection->c_str(), "Adobe-Japan1") == 0) lang = "ja"; // Japanese - else if (strcmp(collection->getCString(), "Adobe-Japan2") == 0) + else if (strcmp(collection->c_str(), "Adobe-Japan2") == 0) lang = "ja"; // Japanese - else if (strcmp(collection->getCString(), "Adobe-Korea1") == 0) + else if (strcmp(collection->c_str(), "Adobe-Korea1") == 0) lang = "ko"; // Korean - else if (strcmp(collection->getCString(), "Adobe-UCS") == 0) + else if (strcmp(collection->c_str(), "Adobe-UCS") == 0) lang = "xx"; - else if (strcmp(collection->getCString(), "Adobe-Identity") == 0) + else if (strcmp(collection->c_str(), "Adobe-Identity") == 0) lang = "xx"; else { @@ -713,7 +713,7 @@ static FcPattern *buildFcPattern(GfxFont *font, const GooString *base14Name) FcPattern *p; // this is all heuristics will be overwritten if font had proper info - char *fontName = strdup(((base14Name == nullptr) ? font->getName() : base14Name)->getCString()); + char *fontName = strdup(((base14Name == nullptr) ? font->getName() : base14Name)->c_str()); const char *modifiers = strchr (fontName, ','); if (modifiers == nullptr) @@ -766,7 +766,7 @@ static FcPattern *buildFcPattern(GfxFont *font, const GooString *base14Name) // if the FontDescriptor specified a family name use it if (font->getFamily()) { free((char*)family); - family = font->getFamily()->getCString(); + family = font->getFamily()->c_str(); freeFamily = false; } @@ -861,7 +861,7 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font, path = fi->path->copy(); *type = fi->type; *fontNum = fi->fontNum; - substituteName.Set(fi->substituteName->getCString()); + substituteName.Set(fi->substituteName->c_str()); } else { FcChar8* s; char * ext; @@ -999,7 +999,7 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font, *fontNum = fi->fontNum; } if (substituteFontName) { - substituteFontName->Set(substituteName.getCString()); + substituteFontName->Set(substituteName.c_str()); } fin: if (p) @@ -1064,7 +1064,7 @@ void GlobalParams::setupBaseFonts(char *dir) { fileName = nullptr; if (dir) { fileName = appendToPath(new GooString(dir), displayFontTab[i].t1FileName); - if ((f = fopen(fileName->getCString(), "rb"))) { + if ((f = fopen(fileName->c_str(), "rb"))) { fclose(f); } else { delete fileName; @@ -1074,7 +1074,7 @@ void GlobalParams::setupBaseFonts(char *dir) { for (j = 0; !fileName && displayFontDirs[j]; ++j) { fileName = appendToPath(new GooString(displayFontDirs[j]), displayFontTab[i].t1FileName); - if ((f = fopen(fileName->getCString(), "rb"))) { + if ((f = fopen(fileName->c_str(), "rb"))) { fclose(f); } else { delete fileName; diff --git a/poppler/GlobalParamsWin.cc b/poppler/GlobalParamsWin.cc index 2df46aef..83ece3c5 100644 --- a/poppler/GlobalParamsWin.cc +++ b/poppler/GlobalParamsWin.cc @@ -278,7 +278,7 @@ void SysFontList::scanWindowsFonts(GooString *winFontDir) { p1 = p0 + strlen(p0); } fonts->push_back(makeWindowsFont(p0, fontNum, - fontPath->getCString())); + fontPath->c_str())); p0 = p1; ++fontNum; } @@ -378,9 +378,9 @@ static GooString* replaceSuffix(GooString *path, int baseLenA = path->getLength() - suffLenA; int baseLenB = path->getLength() - suffLenB; - if (!strcasecmp(path->getCString()+baseLenA, suffixA)) { + if (!strcasecmp(path->c_str()+baseLenA, suffixA)) { path->del(baseLenA,suffLenA)->append(suffixB); - } else if (!strcasecmp(path->getCString()+baseLenB, suffixB)) { + } else if (!strcasecmp(path->c_str()+baseLenB, suffixB)) { path->del(baseLenB,suffLenB)->append(suffixA); } @@ -409,8 +409,8 @@ void GlobalParams::setupBaseFonts(char * dir) if (dir) { GooString *fontPath = appendToPath(new GooString(dir), displayFontTab[i].t1FileName); - if (FileExists(fontPath->getCString()) || - FileExists(replaceSuffix(fontPath, ".pfb", ".pfa")->getCString())) { + if (FileExists(fontPath->c_str()) || + FileExists(replaceSuffix(fontPath, ".pfb", ".pfa")->c_str())) { addFontFile(fontName, fontPath); continue; } @@ -419,8 +419,8 @@ void GlobalParams::setupBaseFonts(char * dir) if (winFontDir[0] && displayFontTab[i].ttFileName) { GooString *fontPath = appendToPath(new GooString(winFontDir), displayFontTab[i].ttFileName); - if (FileExists(fontPath->getCString()) || - FileExists(replaceSuffix(fontPath, ".ttc", ".ttf")->getCString())) { + if (FileExists(fontPath->c_str()) || + FileExists(replaceSuffix(fontPath, ".ttc", ".ttf")->c_str())) { addFontFile(fontName, fontPath); continue; } @@ -486,16 +486,16 @@ static const char *findSubstituteName(GfxFont *font, const std::unordered_map<st GooString *name2 = new GooString(origName); int n = strlen(origName); // remove trailing "-Identity-H" - if (n > 11 && !strcmp(name2->getCString() + n - 11, "-Identity-H")) { + if (n > 11 && !strcmp(name2->c_str() + n - 11, "-Identity-H")) { name2->del(n - 11, 11); n -= 11; } // remove trailing "-Identity-V" - if (n > 11 && !strcmp(name2->getCString() + n - 11, "-Identity-V")) { + if (n > 11 && !strcmp(name2->c_str() + n - 11, "-Identity-V")) { name2->del(n - 11, 11); n -= 11; } - const auto substFile = substFiles.find(name2->getCString()); + const auto substFile = substFiles.find(name2->c_str()); if (substFile != substFiles.end()) { delete name2; return substFile->second.c_str(); @@ -548,18 +548,18 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font, *type = fi->type; *fontNum = fi->fontNum; if (substituteFontName) - substituteFontName->Set(fi->substituteName->getCString()); + substituteFontName->Set(fi->substituteName->c_str()); } else { GooString *substFontName = new GooString(findSubstituteName(font, fontFiles, substFiles, - fontName->getCString())); + fontName->c_str())); error(errSyntaxError, -1, "Couldn't find a font for '{0:t}', subst is '{1:t}'", fontName, substFontName); const auto fontFile = fontFiles.find(substFontName->toStr()); if (fontFile != fontFiles.end()) { path = new GooString(fontFile->second.c_str()); if (substituteFontName) - substituteFontName->Set(path->getCString()); - if (!strcasecmp(path->getCString() + path->getLength() - 4, ".ttc")) { + substituteFontName->Set(path->c_str()); + if (!strcasecmp(path->c_str() + path->getLength() - 4, ".ttc")) { *type = sysFontTTC; } else { *type = sysFontTTF; diff --git a/poppler/Lexer.cc b/poppler/Lexer.cc index a6433bb6..de95e6dd 100644 --- a/poppler/Lexer.cc +++ b/poppler/Lexer.cc @@ -452,7 +452,7 @@ Object Lexer::getObj(int objNum) { *p = '\0'; return Object(objName, tokBuf); } else { - Object obj(objName, s->getCString()); + Object obj(objName, s->c_str()); delete s; return obj; } diff --git a/poppler/Link.cc b/poppler/Link.cc index 07949fc2..33bcb82c 100644 --- a/poppler/Link.cc +++ b/poppler/Link.cc @@ -80,7 +80,7 @@ LinkAction *LinkAction::parseAction(const Object *obj, const GooString *baseURI, if (!obj->isDict()) { error(errSyntaxWarning, -1, "parseAction: Bad annotation action for URI '{0:s}'", - baseURI ? baseURI->getCString() : "NULL"); + baseURI ? baseURI->c_str() : "NULL"); return nullptr; } @@ -143,7 +143,7 @@ LinkAction *LinkAction::parseAction(const Object *obj, const GooString *baseURI, // action is missing or wrong type } else { error(errSyntaxWarning, -1, "parseAction: Unknown annotation action object: URI = '{0:s}'", - baseURI ? baseURI->getCString() : "NULL"); + baseURI ? baseURI->c_str() : "NULL"); action = nullptr; } @@ -575,7 +575,7 @@ LinkURI::LinkURI(const Object *uriObj, const GooString *baseURI) { uri = nullptr; if (uriObj->isString()) { uri2 = uriObj->getString(); - n = (int)strcspn(uri2->getCString(), "/:"); + n = (int)strcspn(uri2->c_str(), "/:"); if (n < uri2->getLength() && uri2->getChar(n) == ':') { // "http:..." etc. uri = uri2->copy(); @@ -594,7 +594,7 @@ LinkURI::LinkURI(const Object *uriObj, const GooString *baseURI) { } } if (uri2->getChar(0) == '/') { - uri->append(uri2->getCString() + 1, uri2->getLength() - 1); + uri->append(uri2->c_str() + 1, uri2->getLength() - 1); } else { uri->append(uri2); } diff --git a/poppler/LocalPDFDocBuilder.cc b/poppler/LocalPDFDocBuilder.cc index bdecc657..b0ce6c4e 100644 --- a/poppler/LocalPDFDocBuilder.cc +++ b/poppler/LocalPDFDocBuilder.cc @@ -36,7 +36,7 @@ bool LocalPDFDocBuilder::supports(const GooString &uri) { if (uri.cmpN("file://", 7) == 0) { return true; - } else if (!strstr(uri.getCString(), "://")) { + } else if (!strstr(uri.c_str(), "://")) { return true; } else { return false; diff --git a/poppler/Object.cc b/poppler/Object.cc index abb0b5b3..3ccf8f42 100644 --- a/poppler/Object.cc +++ b/poppler/Object.cc @@ -142,7 +142,7 @@ void Object::print(FILE *f) const { break; case objString: fprintf(f, "("); - fwrite(string->getCString(), 1, string->getLength(), f); + fwrite(string->c_str(), 1, string->getLength(), f); fprintf(f, ")"); break; case objName: diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index 0d164e25..4f094905 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -148,7 +148,7 @@ PDFDoc::PDFDoc(const GooString *fileNameA, const GooString *ownerPassword, // try to open file #ifdef _WIN32 - wchar_t *wFileName = (wchar_t*)utf8ToUtf16(fileName->getCString()); + wchar_t *wFileName = (wchar_t*)utf8ToUtf16(fileName->c_str()); file = GooFile::open(wFileName); gfree(wFileName); #else @@ -799,7 +799,7 @@ GooString *PDFDoc::getDocInfoStringEntry(const char *key) { static bool get_id (const GooString *encodedidstring, GooString *id) { - const char *encodedid = encodedidstring->getCString(); + const char *encodedid = encodedidstring->c_str(); char pdfid[pdfIdLength + 1]; int n; @@ -897,7 +897,7 @@ int PDFDoc::savePageAs(GooString *name, int pageNo) Ref *refPage = getCatalog()->getPageRef(pageNo); Object page = getXRef()->fetch(refPage->num, refPage->gen); - if (!(f = fopen(name->getCString(), "wb"))) { + if (!(f = fopen(name->c_str(), "wb"))) { error(errIO, -1, "Couldn't open file '{0:t}'", name); return errOpenFile; } @@ -1012,7 +1012,7 @@ int PDFDoc::savePageAs(GooString *name, int pageNo) ref.num = rootNum; ref.gen = 0; Object trailerDict = createTrailerDict(rootNum + 3, false, 0, &ref, getXRef(), - name->getCString(), uxrefOffset); + name->c_str(), uxrefOffset); writeXRefTableTrailer(std::move(trailerDict), yRef, false /* do not write unnecessary entries */, uxrefOffset, outStr, getXRef()); @@ -1030,7 +1030,7 @@ int PDFDoc::saveAs(GooString *name, PDFWriteMode mode) { OutStream *outStr; int res; - if (!(f = fopen(name->getCString(), "wb"))) { + if (!(f = fopen(name->c_str(), "wb"))) { error(errIO, -1, "Couldn't open file '{0:t}'", name); return errOpenFile; } @@ -1062,7 +1062,7 @@ int PDFDoc::saveWithoutChangesAs(GooString *name) { OutStream *outStr; int res; - if (!(f = fopen(name->getCString(), "wb"))) { + if (!(f = fopen(name->c_str(), "wb"))) { error(errIO, -1, "Couldn't open file '{0:t}'", name); return errOpenFile; } @@ -1144,7 +1144,7 @@ void PDFDoc::saveIncrementalUpdate (OutStream* outStr) Goffset uxrefOffset = outStr->getPos(); int numobjects = xref->getNumObjects(); - const char *fileNameA = fileName ? fileName->getCString() : nullptr; + const char *fileNameA = fileName ? fileName->c_str() : nullptr; Ref rootRef, uxrefStreamRef; rootRef.num = getXRef()->getRootNum(); rootRef.gen = getXRef()->getRootGen(); @@ -1250,7 +1250,7 @@ void PDFDoc::writeDictionnary (Dict* dict, OutStream* outStr, XRef *xRef, Guint for (int i=0; i<dict->getLength(); i++) { GooString keyName(dict->getKey(i)); GooString *keyNameToPrint = keyName.sanitizedName(false /* non ps mode */); - outStr->printf("/%s ", keyNameToPrint->getCString()); + outStr->printf("/%s ", keyNameToPrint->c_str()); delete keyNameToPrint; Object obj1 = dict->getValNF(i); writeObject(&obj1, outStr, xRef, numOffset, fileKey, encAlgorithm, keyLength, objNum, objGen, alreadyWrittenDicts); @@ -1306,7 +1306,7 @@ void PDFDoc::writeString (const GooString* s, OutStream* outStr, const Guchar *f // Encrypt string if encryption is enabled GooString *sEnc = nullptr; if (fileKey) { - EncryptStream *enc = new EncryptStream(new MemStream(s->getCString(), 0, s->getLength(), Object(objNull)), + EncryptStream *enc = new EncryptStream(new MemStream(s->c_str(), 0, s->getLength(), Object(objNull)), fileKey, encAlgorithm, keyLength, objNum, objGen); sEnc = new GooString(); int c; @@ -1322,7 +1322,7 @@ void PDFDoc::writeString (const GooString* s, OutStream* outStr, const Guchar *f // Write data if (s->hasUnicodeMarker()) { //unicode string don't necessary end with \0 - const char* c = s->getCString(); + const char* c = s->c_str(); outStr->printf("("); for(int i=0; i<s->getLength(); i++) { char unescaped = *(c+i)&0x000000ff; @@ -1333,7 +1333,7 @@ void PDFDoc::writeString (const GooString* s, OutStream* outStr, const Guchar *f } outStr->printf(") "); } else { - const char* c = s->getCString(); + const char* c = s->c_str(); outStr->printf("("); for(int i=0; i<s->getLength(); i++) { char unescaped = *(c+i)&0x000000ff; @@ -1381,7 +1381,7 @@ void PDFDoc::writeObject (Object* obj, OutStream* outStr, XRef *xRef, Guint numO { GooString s; s.appendf("{0:.10g}", obj->getReal()); - outStr->printf("%s ", s.getCString()); + outStr->printf("%s ", s.c_str()); break; } case objString: @@ -1391,7 +1391,7 @@ void PDFDoc::writeObject (Object* obj, OutStream* outStr, XRef *xRef, Guint numO { GooString name(obj->getName()); GooString *nameToPrint = name.sanitizedName(false /* non ps mode */); - outStr->printf("/%s ", nameToPrint->getCString()); + outStr->printf("/%s ", nameToPrint->c_str()); delete nameToPrint; break; } @@ -1558,7 +1558,7 @@ Object PDFDoc::createTrailerDict(int uxrefSize, bool incrUpdate, Goffset startxR //calculate md5 digest Guchar digest[16]; - md5((Guchar*)message.getCString(), message.getLength(), digest); + md5((Guchar*)message.c_str(), message.getLength(), digest); //create ID array // In case of encrypted files, the ID must not be changed because it's used to calculate the key @@ -1616,7 +1616,7 @@ void PDFDoc::writeXRefStreamTrailer (Object &&trailerDict, XRef *uxref, Ref *uxr uxref->writeStreamToBuffer(&stmData, trailerDict.getDict(), xRef); // Create XRef stream object and write it - MemStream *mStream = new MemStream( stmData.getCString(), 0, stmData.getLength(), std::move(trailerDict) ); + MemStream *mStream = new MemStream( stmData.c_str(), 0, stmData.getLength(), std::move(trailerDict) ); writeObjectHeader(uxrefStreamRef, outStr); Object obj1(static_cast<Stream*>(mStream)); writeObject(&obj1, outStr, xRef, 0, nullptr, cryptRC4, 0, 0, 0); @@ -1630,7 +1630,7 @@ void PDFDoc::writeXRefStreamTrailer (Object &&trailerDict, XRef *uxref, Ref *uxr void PDFDoc::writeXRefTableTrailer(Goffset uxrefOffset, XRef *uxref, bool writeAllEntries, int uxrefSize, OutStream* outStr, bool incrUpdate) { - const char *fileNameA = fileName ? fileName->getCString() : nullptr; + const char *fileNameA = fileName ? fileName->c_str() : nullptr; // file size (doesn't include the trailer) unsigned int fileSize = 0; int c; diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc index 3f3082f8..83d73a54 100644 --- a/poppler/PSOutputDev.cc +++ b/poppler/PSOutputDev.cc @@ -1730,7 +1730,7 @@ void PSOutputDev::writeDocSetup(PDFDoc *doc, Catalog *catalog, if (customCodeCbk) { if ((s = (*customCodeCbk)(this, psOutCustomDocSetup, 0, customCodeCbkData))) { - writePS(s->getCString()); + writePS(s->c_str()); delete s; } } @@ -1750,7 +1750,7 @@ void PSOutputDev::writeTrailer() { } else { writePS("end\n"); writePS("%%DocumentSuppliedResources:\n"); - writePS(embFontList->getCString()); + writePS(embFontList->c_str()); if (level == psLevel1Sep || level == psLevel2Sep || level == psLevel3Sep) { writePS("%%DocumentProcessColors:"); @@ -1996,10 +1996,10 @@ void PSOutputDev::setupFont(GfxFont *font, Dict *parentResDict) { if (font->isCIDFont()) { error(errSyntaxError, -1, "Couldn't find a font to substitute for '{0:s}' ('{1:s}' character collection)", - font->getName() ? font->getName()->getCString() + font->getName() ? font->getName()->c_str() : "(unnamed)", ((GfxCIDFont *)font)->getCollection() - ? ((GfxCIDFont *)font)->getCollection()->getCString() + ? ((GfxCIDFont *)font)->getCollection()->c_str() : "(unknown)"); if (font16EncLen >= font16EncSize) { font16EncSize += 16; @@ -2013,7 +2013,7 @@ void PSOutputDev::setupFont(GfxFont *font, Dict *parentResDict) { } else { error(errSyntaxError, -1, "Couldn't find a font to substitute for '{0:s}'", - font->getName() ? font->getName()->getCString() + font->getName() ? font->getName()->c_str() : "(unnamed)"); } delete fontLoc; @@ -2152,7 +2152,7 @@ void PSOutputDev::setupEmbeddedType1Font(Ref *id, GooString *psName) { // beginning comment writePSFmt("%%BeginResource: font {0:t}\n", psName); embFontList->append("%%+ font "); - embFontList->append(psName->getCString()); + embFontList->append(psName->c_str()); embFontList->append("\n"); strObj.streamReset(); @@ -2305,11 +2305,11 @@ void PSOutputDev::setupExternalType1Font(GooString *fileName, GooString *psName) // beginning comment writePSFmt("%%BeginResource: font {0:t}\n", psName); embFontList->append("%%+ font "); - embFontList->append(psName->getCString()); + embFontList->append(psName->c_str()); embFontList->append("\n"); // copy the font file - if (!(fontFile = fopen(fileName->getCString(), "rb"))) { + if (!(fontFile = fopen(fileName->c_str(), "rb"))) { error(errIO, -1, "Couldn't open external font file"); return; } @@ -2391,13 +2391,13 @@ void PSOutputDev::setupEmbeddedType1CFont(GfxFont *font, Ref *id, // beginning comment writePSFmt("%%BeginResource: font {0:t}\n", psName); embFontList->append("%%+ font "); - embFontList->append(psName->getCString()); + embFontList->append(psName->c_str()); embFontList->append("\n"); // convert it to a Type 1 font if ((fontBuf = font->readEmbFontFile(xref, &fontLen))) { if ((ffT1C = FoFiType1C::make(fontBuf, fontLen))) { - ffT1C->convertToType1(psName->getCString(), nullptr, true, + ffT1C->convertToType1(psName->c_str(), nullptr, true, outputFunc, outputStream); delete ffT1C; } @@ -2436,14 +2436,14 @@ void PSOutputDev::setupEmbeddedOpenTypeT1CFont(GfxFont *font, Ref *id, // beginning comment writePSFmt("%%BeginResource: font {0:t}\n", psName); embFontList->append("%%+ font "); - embFontList->append(psName->getCString()); + embFontList->append(psName->c_str()); embFontList->append("\n"); // convert it to a Type 1 font if ((fontBuf = font->readEmbFontFile(xref, &fontLen))) { if ((ffTT = FoFiTrueType::make(fontBuf, fontLen))) { if (ffTT->isOpenTypeCFF()) { - ffTT->convertToType1(psName->getCString(), nullptr, true, + ffTT->convertToType1(psName->c_str(), nullptr, true, outputFunc, outputStream); } delete ffTT; @@ -2465,14 +2465,14 @@ void PSOutputDev::setupEmbeddedTrueTypeFont(GfxFont *font, Ref *id, // beginning comment writePSFmt("%%BeginResource: font {0:t}\n", psName); embFontList->append("%%+ font "); - embFontList->append(psName->getCString()); + embFontList->append(psName->c_str()); embFontList->append("\n"); // convert it to a Type 42 font if ((fontBuf = font->readEmbFontFile(xref, &fontLen))) { if ((ffTT = FoFiTrueType::make(fontBuf, fontLen))) { codeToGID = ((Gfx8BitFont *)font)->getCodeToGIDMap(ffTT); - ffTT->convertToType42(psName->getCString(), + ffTT->convertToType42(psName->c_str(), ((Gfx8BitFont *)font)->getHasEncoding() ? ((Gfx8BitFont *)font)->getEncoding() : nullptr, @@ -2505,13 +2505,13 @@ void PSOutputDev::setupExternalTrueTypeFont(GfxFont *font, GooString *fileName, // beginning comment writePSFmt("%%BeginResource: font {0:t}\n", psName); embFontList->append("%%+ font "); - embFontList->append(psName->getCString()); + embFontList->append(psName->c_str()); embFontList->append("\n"); // convert it to a Type 42 font - if ((ffTT = FoFiTrueType::load(fileName->getCString()))) { + if ((ffTT = FoFiTrueType::load(fileName->c_str()))) { codeToGID = ((Gfx8BitFont *)font)->getCodeToGIDMap(ffTT); - ffTT->convertToType42(psName->getCString(), + ffTT->convertToType42(psName->c_str(), ((Gfx8BitFont *)font)->getHasEncoding() ? ((Gfx8BitFont *)font)->getEncoding() : nullptr, @@ -2554,12 +2554,12 @@ void PSOutputDev::setupExternalCIDTrueTypeFont(GfxFont *font, // beginning comment writePSFmt("%%BeginResource: font {0:t}\n", psName); embFontList->append("%%+ font "); - embFontList->append(psName->getCString()); + embFontList->append(psName->c_str()); embFontList->append("\n"); // convert it to a Type 0 font //~ this should use fontNum to load the correct font - if ((ffTT = FoFiTrueType::load(fileName->getCString()))) { + if ((ffTT = FoFiTrueType::load(fileName->c_str()))) { // check for embedding permission if (ffTT->getEmbeddingRights() >= 1) { @@ -2576,19 +2576,19 @@ void PSOutputDev::setupExternalCIDTrueTypeFont(GfxFont *font, codeToGID = ((GfxCIDFont *)font)->getCodeToGIDMap(ffTT, &codeToGIDLen); } if (ffTT->isOpenTypeCFF()) { - ffTT->convertToCIDType0(psName->getCString(), + ffTT->convertToCIDType0(psName->c_str(), codeToGID, codeToGIDLen, outputFunc, outputStream); } else if (globalParams->getPSLevel() >= psLevel3) { // Level 3: use a CID font - ffTT->convertToCIDType2(psName->getCString(), + ffTT->convertToCIDType2(psName->c_str(), codeToGID, codeToGIDLen, needVerticalMetrics, outputFunc, outputStream); } else { // otherwise: use a non-CID composite font int maxValidGlyph = -1; - ffTT->convertToType0(psName->getCString(), + ffTT->convertToType0(psName->c_str(), codeToGID, codeToGIDLen, needVerticalMetrics, &maxValidGlyph, @@ -2599,7 +2599,7 @@ void PSOutputDev::setupExternalCIDTrueTypeFont(GfxFont *font, } else { error(errSyntaxError, -1, "TrueType font '{0:s}' does not allow embedding", - font->getName() ? font->getName()->getCString() : "(unnamed)"); + font->getName() ? font->getName()->c_str() : "(unnamed)"); } delete ffTT; @@ -2637,7 +2637,7 @@ void PSOutputDev::setupEmbeddedCIDType0Font(GfxFont *font, Ref *id, // beginning comment writePSFmt("%%BeginResource: font {0:t}\n", psName); embFontList->append("%%+ font "); - embFontList->append(psName->getCString()); + embFontList->append(psName->c_str()); embFontList->append("\n"); // convert it to a Type 0 font @@ -2645,11 +2645,11 @@ void PSOutputDev::setupEmbeddedCIDType0Font(GfxFont *font, Ref *id, if ((ffT1C = FoFiType1C::make(fontBuf, fontLen))) { if (globalParams->getPSLevel() >= psLevel3) { // Level 3: use a CID font - ffT1C->convertToCIDType0(psName->getCString(), nullptr, 0, + ffT1C->convertToCIDType0(psName->c_str(), nullptr, 0, outputFunc, outputStream); } else { // otherwise: use a non-CID composite font - ffT1C->convertToType0(psName->getCString(), nullptr, 0, + ffT1C->convertToType0(psName->c_str(), nullptr, 0, outputFunc, outputStream); } delete ffT1C; @@ -2671,7 +2671,7 @@ void PSOutputDev::setupEmbeddedCIDTrueTypeFont(GfxFont *font, Ref *id, // beginning comment writePSFmt("%%BeginResource: font {0:t}\n", psName); embFontList->append("%%+ font "); - embFontList->append(psName->getCString()); + embFontList->append(psName->c_str()); embFontList->append("\n"); // convert it to a Type 0 font @@ -2679,7 +2679,7 @@ void PSOutputDev::setupEmbeddedCIDTrueTypeFont(GfxFont *font, Ref *id, if ((ffTT = FoFiTrueType::make(fontBuf, fontLen))) { if (globalParams->getPSLevel() >= psLevel3) { // Level 3: use a CID font - ffTT->convertToCIDType2(psName->getCString(), + ffTT->convertToCIDType2(psName->c_str(), ((GfxCIDFont *)font)->getCIDToGID(), ((GfxCIDFont *)font)->getCIDToGIDLen(), needVerticalMetrics, @@ -2687,7 +2687,7 @@ void PSOutputDev::setupEmbeddedCIDTrueTypeFont(GfxFont *font, Ref *id, } else { // otherwise: use a non-CID composite font int maxValidGlyph = -1; - ffTT->convertToType0(psName->getCString(), + ffTT->convertToType0(psName->c_str(), ((GfxCIDFont *)font)->getCIDToGID(), ((GfxCIDFont *)font)->getCIDToGIDLen(), needVerticalMetrics, @@ -2732,7 +2732,7 @@ void PSOutputDev::setupEmbeddedOpenTypeCFFFont(GfxFont *font, Ref *id, // beginning comment writePSFmt("%%BeginResource: font {0:t}\n", psName); embFontList->append("%%+ font "); - embFontList->append(psName->getCString()); + embFontList->append(psName->c_str()); embFontList->append("\n"); // convert it to a Type 0 font @@ -2741,13 +2741,13 @@ void PSOutputDev::setupEmbeddedOpenTypeCFFFont(GfxFont *font, Ref *id, if (ffTT->isOpenTypeCFF()) { if (globalParams->getPSLevel() >= psLevel3) { // Level 3: use a CID font - ffTT->convertToCIDType0(psName->getCString(), + ffTT->convertToCIDType0(psName->c_str(), ((GfxCIDFont *)font)->getCIDToGID(), ((GfxCIDFont *)font)->getCIDToGIDLen(), outputFunc, outputStream); } else { // otherwise: use a non-CID composite font - ffTT->convertToType0(psName->getCString(), + ffTT->convertToType0(psName->c_str(), ((GfxCIDFont *)font)->getCIDToGID(), ((GfxCIDFont *)font)->getCIDToGIDLen(), outputFunc, outputStream); @@ -2784,7 +2784,7 @@ void PSOutputDev::setupType3Font(GfxFont *font, GooString *psName, // beginning comment writePSFmt("%%BeginResource: font {0:t}\n", psName); embFontList->append("%%+ font "); - embFontList->append(psName->getCString()); + embFontList->append(psName->c_str()); embFontList->append("\n"); // font dictionary @@ -2832,9 +2832,9 @@ void PSOutputDev::setupType3Font(GfxFont *font, GooString *psName, } else { buf = GooString::format("{0:.6g} {1:.6g} setcharwidth\n", t3WX, t3WY); } - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; - (*outputFunc)(outputStream, t3String->getCString(), + (*outputFunc)(outputStream, t3String->c_str(), t3String->getLength()); delete t3String; t3String = nullptr; @@ -3945,7 +3945,7 @@ void PSOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA) { if (customCodeCbk) { if ((s = (*customCodeCbk)(this, psOutCustomPageSetup, pageNum, customCodeCbkData))) { - writePS(s->getCString()); + writePS(s->c_str()); delete s; } } @@ -5114,7 +5114,7 @@ void PSOutputDev::drawString(GfxState *state, const GooString *s) { // compute the positioning (dx, dy) for each char in the string nChars = 0; - p = s->getCString(); + p = s->c_str(); len = s->getLength(); s2 = new GooString(); dxdySize = font->isCIDFont() ? 8 : s->getLength(); @@ -6067,7 +6067,7 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap, writePS(" /RunLengthDecode filter\n"); } if (useCompressed) { - writePS(s->getCString()); + writePS(s->c_str()); } if (s) { delete s; @@ -6255,7 +6255,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap, ref->getRefNum(), ref->getRefGen()); } else { writePS("currentfile\n"); - writePS(maskFilters->getCString()); + writePS(maskFilters->c_str()); writePS("pdfMask\n"); // add FlateEncode/LZWEncode/RunLengthEncode and ASCIIHex/85 encode filters @@ -6485,7 +6485,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap, writePS(" /RunLengthDecode filter\n"); } if (useCompressed) { - writePS(s->getCString()); + writePS(s->c_str()); } if (s) { delete s; @@ -6510,7 +6510,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap, // mask data source if (mode == psModeForm || inType3Char || preloadImagesForms) { writePS(" /DataSource {pdfMaskSrc}\n"); - writePS(maskFilters->getCString()); + writePS(maskFilters->c_str()); } else { writePS(" /DataSource maskStream\n"); } @@ -7414,7 +7414,7 @@ void PSOutputDev::cvtFunction(const Function *func, bool invertPSFunction) { break; } } - writePS(codeString->getCString()); + writePS(codeString->c_str()); writePS("\n"); delete codeString; n = func4->getOutputSize(); @@ -7424,7 +7424,7 @@ void PSOutputDev::cvtFunction(const Function *func, bool invertPSFunction) { } writePS("}\n"); } else { - writePS(func4->getCodeString()->getCString()); + writePS(func4->getCodeString()->c_str()); writePS("\n"); } break; @@ -7466,7 +7466,7 @@ void PSOutputDev::writePSFmt(const char *fmt, ...) { t3String->appendfv((char *)fmt, args); } else { buf = GooString::formatv((char *)fmt, args); - (*outputFunc)(outputStream, buf->getCString(), buf->getLength()); + (*outputFunc)(outputStream, buf->c_str(), buf->getLength()); delete buf; } va_end(args); @@ -7479,7 +7479,7 @@ void PSOutputDev::writePSString(const GooString *s) { writePSChar('('); line = 1; - for (p = (Guchar *)s->getCString(), n = s->getLength(); n; ++p, --n) { + for (p = (Guchar *)s->c_str(), n = s->getLength(); n; ++p, --n) { if (line >= 64) { writePSChar('\\'); writePSChar('\n'); diff --git a/poppler/PageLabelInfo.cc b/poppler/PageLabelInfo.cc index 389c1b0f..1928d5f8 100644 --- a/poppler/PageLabelInfo.cc +++ b/poppler/PageLabelInfo.cc @@ -44,7 +44,7 @@ PageLabelInfo::Interval::Interval(Object *dict, int baseA) { obj = dict->dictLookup("P"); if (obj.isString()) { const auto str = obj.getString(); - prefix.assign(str->getCString(), str->getLength()); + prefix.assign(str->c_str(), str->getLength()); } obj = dict->dictLookup("St"); @@ -100,7 +100,7 @@ void PageLabelInfo::parse(Object *tree) { bool PageLabelInfo::labelToIndex(GooString *label, int *index) const { - const char *const str = label->getCString(); + const char *const str = label->c_str(); const std::size_t strLen = label->getLength(); const bool strUnicode = label->hasUnicodeMarker(); int number; diff --git a/poppler/Parser.cc b/poppler/Parser.cc index 311f2203..ce3866e6 100644 --- a/poppler/Parser.cc +++ b/poppler/Parser.cc @@ -164,7 +164,7 @@ Object Parser::getObj(bool simpleOnly, } else if (buf1.isString() && fileKey) { s = buf1.getString(); s2 = new GooString(); - decrypt = new DecryptStream(new MemStream(s->getCString(), 0, s->getLength(), Object(objNull)), + decrypt = new DecryptStream(new MemStream(s->c_str(), 0, s->getLength(), Object(objNull)), fileKey, encAlgorithm, keyLength, objNum, objGen); decrypt->reset(); diff --git a/poppler/SignatureHandler.cc b/poppler/SignatureHandler.cc index a98e3f79..aedccf7a 100644 --- a/poppler/SignatureHandler.cc +++ b/poppler/SignatureHandler.cc @@ -88,7 +88,7 @@ GooString *SignatureHandler::getDefaultFirefoxCertDB_Linux() GooString * homePath = new GooString(getenv("HOME")); homePath = homePath->append("/.mozilla/firefox/"); - if ((toSearchIn = opendir(homePath->getCString())) == nullptr) { + if ((toSearchIn = opendir(homePath->c_str())) == nullptr) { error(errInternal, 0, "couldn't find default Firefox Folder"); delete homePath; return nullptr; @@ -117,7 +117,7 @@ void SignatureHandler::init_nss() if (certDBPath == nullptr) { NSS_Init("sql:/etc/pki/nssdb"); } else { - NSS_Init(certDBPath->getCString()); + NSS_Init(certDBPath->c_str()); } //Make sure NSS root certificates module is loaded SECMOD_AddNewModule("Root Certs", "libnssckbi.so", 0, 0); diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 90e51205..e4318758 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -2049,7 +2049,7 @@ reload: if (!(fontLoc = gfxFont->locateFont((xref) ? xref : doc->getXRef(), nullptr))) { error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'", - gfxFont->getName() ? gfxFont->getName()->getCString() + gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); goto err2; } @@ -2082,7 +2082,7 @@ reload: fontsrc, (const char **)((Gfx8BitFont *)gfxFont)->getEncoding()))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", - gfxFont->getName() ? gfxFont->getName()->getCString() + gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); if (gfxFont->invalidateEmbeddedFont()) goto reload; goto err2; @@ -2094,7 +2094,7 @@ reload: fontsrc, (const char **)((Gfx8BitFont *)gfxFont)->getEncoding()))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", - gfxFont->getName() ? gfxFont->getName()->getCString() + gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); if (gfxFont->invalidateEmbeddedFont()) goto reload; goto err2; @@ -2106,7 +2106,7 @@ reload: fontsrc, (const char **)((Gfx8BitFont *)gfxFont)->getEncoding()))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", - gfxFont->getName() ? gfxFont->getName()->getCString() + gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); if (gfxFont->invalidateEmbeddedFont()) goto reload; goto err2; @@ -2115,7 +2115,7 @@ reload: case fontTrueType: case fontTrueTypeOT: if (fileName) - ff = FoFiTrueType::load(fileName->getCString()); + ff = FoFiTrueType::load(fileName->c_str()); else ff = FoFiTrueType::make(tmpBuf, tmpBufLen); if (ff) { @@ -2142,7 +2142,7 @@ reload: fontsrc, codeToGID, n))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", - gfxFont->getName() ? gfxFont->getName()->getCString() + gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); if (gfxFont->invalidateEmbeddedFont()) goto reload; goto err2; @@ -2154,7 +2154,7 @@ reload: id, fontsrc))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", - gfxFont->getName() ? gfxFont->getName()->getCString() + gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); if (gfxFont->invalidateEmbeddedFont()) goto reload; goto err2; @@ -2175,7 +2175,7 @@ reload: fontsrc, codeToGID, n))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", - gfxFont->getName() ? gfxFont->getName()->getCString() + gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); if (gfxFont->invalidateEmbeddedFont()) goto reload; goto err2; @@ -2194,13 +2194,13 @@ reload: } } else { if (fileName) - ff = FoFiTrueType::load(fileName->getCString()); + ff = FoFiTrueType::load(fileName->c_str()); else ff = FoFiTrueType::make(tmpBuf, tmpBufLen); if (! ff) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", - gfxFont->getName() ? gfxFont->getName()->getCString() + gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); goto err2; } @@ -2212,7 +2212,7 @@ reload: fontsrc, codeToGID, n, faceIndex))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", - gfxFont->getName() ? gfxFont->getName()->getCString() + gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); if (gfxFont->invalidateEmbeddedFont()) goto reload; goto err2; diff --git a/poppler/StructElement.cc b/poppler/StructElement.cc index d94de2a3..62e5b2a9 100644 --- a/poppler/StructElement.cc +++ b/poppler/StructElement.cc @@ -698,7 +698,7 @@ Attribute::~Attribute() const char *Attribute::getTypeName() const { if (type == UserProperty) - return name.getCString(); + return name.c_str(); const AttributeMapEntry *entry = getAttributeMapEntry(attributeMapAll, type); if (entry) @@ -791,7 +791,7 @@ Attribute *Attribute::parseUserProperty(Dict *property) Attribute *attribute = new Attribute(std::move(name), &value); obj = property->lookup("F"); if (obj.isString()) { - attribute->setFormattedValue(obj.getString()->getCString()); + attribute->setFormattedValue(obj.getString()->c_str()); } else if (!obj.isNull()) { error(errSyntaxWarning, -1, "F object is wrong type ({0:s})", obj.getTypeName()); } diff --git a/poppler/StructElement.h b/poppler/StructElement.h index f15bedb5..5db317bc 100644 --- a/poppler/StructElement.h +++ b/poppler/StructElement.h @@ -98,7 +98,7 @@ public: // The formatted value may be in the PDF, or be left undefined (nullptr). // In the later case the user agent should provide a default representation. - const char *getFormattedValue() const { return formatted ? formatted->getCString() : nullptr; } + const char *getFormattedValue() const { return formatted ? formatted->c_str() : nullptr; } void setFormattedValue(const char *formattedA); ~Attribute(); diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc index 14b6028e..e0f0c1e7 100644 --- a/poppler/TextOutputDev.cc +++ b/poppler/TextOutputDev.cc @@ -5223,7 +5223,7 @@ void TextPage::dump(void *outputStream, TextOutputFunc outputFunc, for (word = rawWords; word; word = word->next) { s = new GooString(); dumpFragment(word->text, word->len, uMap, s); - (*outputFunc)(outputStream, s->getCString(), s->getLength()); + (*outputFunc)(outputStream, s->c_str(), s->getLength()); delete s; if (word->next && fabs(word->next->base - word->base) < @@ -5297,7 +5297,7 @@ void TextPage::dump(void *outputStream, TextOutputFunc outputFunc, // print the line s = new GooString(); col += dumpFragment(frag->line->text + frag->start, frag->len, uMap, s); - (*outputFunc)(outputStream, s->getCString(), s->getLength()); + (*outputFunc)(outputStream, s->c_str(), s->getLength()); delete s; // print one or more returns if necessary @@ -5336,7 +5336,7 @@ void TextPage::dump(void *outputStream, TextOutputFunc outputFunc, } s = new GooString(); dumpFragment(line->text, n, uMap, s); - (*outputFunc)(outputStream, s->getCString(), s->getLength()); + (*outputFunc)(outputStream, s->c_str(), s->getLength()); delete s; // output a newline when a hyphen is not suppressed if (n == line->len) { diff --git a/poppler/UTF.cc b/poppler/UTF.cc index a2003bff..fcb1260d 100644 --- a/poppler/UTF.cc +++ b/poppler/UTF.cc @@ -93,7 +93,7 @@ int TextStringToUCS4(const GooString *textStr, Unicode **ucs4) Unicode *u; len = textStr->getLength(); - s = textStr->getCString(); + s = textStr->c_str(); if (len == 0) { *ucs4 = nullptr; return 0; diff --git a/qt5/src/ArthurOutputDev.cc b/qt5/src/ArthurOutputDev.cc index 3cda4b9f..32540b01 100644 --- a/qt5/src/ArthurOutputDev.cc +++ b/qt5/src/ArthurOutputDev.cc @@ -503,13 +503,13 @@ void ArthurOutputDev::updateFont(GfxState *state) break; } case gfxFontLocExternal:{ // font is in an external font file - QString fontFile(fontLoc->path->getCString()); + QString fontFile(fontLoc->path->c_str()); m_rawFont = new QRawFont(fontFile, fontSize); m_rawFontCache.insert(std::make_pair(fontID,std::unique_ptr<QRawFont>(m_rawFont))); break; } case gfxFontLocResident:{ // font resides in a PS printer - qDebug() << "Font Resident Encoding:" << fontLoc->encoding->getCString() << ", not implemented yet!"; + qDebug() << "Font Resident Encoding:" << fontLoc->encoding->c_str() << ", not implemented yet!"; break; } @@ -571,7 +571,7 @@ void ArthurOutputDev::updateFont(GfxState *state) std::unique_ptr<GfxFontLoc> fontLoc(gfxFont->locateFont(xref, nullptr)); if (!fontLoc) { error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'", - gfxFont->getName() ? gfxFont->getName()->getCString() + gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); goto err2; } @@ -603,7 +603,7 @@ void ArthurOutputDev::updateFont(GfxState *state) fontsrc, (const char **)((Gfx8BitFont *)gfxFont)->getEncoding()))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", - gfxFont->getName() ? gfxFont->getName()->getCString() + gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); goto err2; } @@ -614,7 +614,7 @@ void ArthurOutputDev::updateFont(GfxState *state) fontsrc, (const char **)((Gfx8BitFont *)gfxFont)->getEncoding()))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", - gfxFont->getName() ? gfxFont->getName()->getCString() + gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); goto err2; } @@ -625,7 +625,7 @@ void ArthurOutputDev::updateFont(GfxState *state) fontsrc, (const char **)((Gfx8BitFont *)gfxFont)->getEncoding()))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", - gfxFont->getName() ? gfxFont->getName()->getCString() + gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); goto err2; } @@ -633,7 +633,7 @@ void ArthurOutputDev::updateFont(GfxState *state) case fontTrueType: case fontTrueTypeOT: if (fileName) - ff = FoFiTrueType::load(fileName->getCString()); + ff = FoFiTrueType::load(fileName->c_str()); else ff = FoFiTrueType::make(tmpBuf, tmpBufLen); if (ff) { @@ -649,7 +649,7 @@ void ArthurOutputDev::updateFont(GfxState *state) fontsrc, codeToGID, n))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", - gfxFont->getName() ? gfxFont->getName()->getCString() + gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); goto err2; } @@ -660,7 +660,7 @@ void ArthurOutputDev::updateFont(GfxState *state) id, fontsrc))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", - gfxFont->getName() ? gfxFont->getName()->getCString() + gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); goto err2; } @@ -680,7 +680,7 @@ void ArthurOutputDev::updateFont(GfxState *state) fontsrc, codeToGID, n))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", - gfxFont->getName() ? gfxFont->getName()->getCString() + gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); goto err2; } @@ -698,7 +698,7 @@ void ArthurOutputDev::updateFont(GfxState *state) } } else { if (fileName) - ff = FoFiTrueType::load(fileName->getCString()); + ff = FoFiTrueType::load(fileName->c_str()); else ff = FoFiTrueType::make(tmpBuf, tmpBufLen); if (! ff) @@ -711,7 +711,7 @@ void ArthurOutputDev::updateFont(GfxState *state) fontsrc, codeToGID, n, faceIndex))) { error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", - gfxFont->getName() ? gfxFont->getName()->getCString() + gfxFont->getName() ? gfxFont->getName()->c_str() : "(unnamed)"); goto err2; } diff --git a/qt5/src/poppler-annotation-helper.h b/qt5/src/poppler-annotation-helper.h index a382b2ca..f7d2dece 100644 --- a/qt5/src/poppler-annotation-helper.h +++ b/qt5/src/poppler-annotation-helper.h @@ -70,7 +70,7 @@ void XPDFReader::lookupString( Dict * dict, char * type, QString & dest ) if ( stringObj.isNull() ) return; if ( stringObj.isString() ) - dest = stringObj.getString()->getCString(); + dest = stringObj.getString()->c_str(); else qDebug() << type << " is not String." << endl; } @@ -155,7 +155,7 @@ void XPDFReader::lookupDate( Dict * dict, char * type, QDateTime & dest ) return; if ( dateObj.isString() ) { - dest = convertDate( dateObj.getString()->getCString() ); + dest = convertDate( dateObj.getString()->c_str() ); } else qDebug() << type << " is not Date" << endl; diff --git a/qt5/src/poppler-annotation.cc b/qt5/src/poppler-annotation.cc index 2aa3cdba..2f35425a 100644 --- a/qt5/src/poppler-annotation.cc +++ b/qt5/src/poppler-annotation.cc @@ -508,7 +508,7 @@ QList<Annotation*> AnnotationPrivate::findAnnotations(::Page *pdfPage, DocumentD FileAttachmentAnnotation * f = new FileAttachmentAnnotation(); annotation = f; // -> fileIcon - f->setFileIconName( QString::fromLatin1( attachann->getName()->getCString() ) ); + f->setFileIconName( QString::fromLatin1( attachann->getName()->c_str() ) ); // -> embeddedFile FileSpec *filespec = new FileSpec( attachann->getFile() ); f->setEmbeddedFile( new EmbeddedFile( *new EmbeddedFileData( filespec ) ) ); @@ -523,7 +523,7 @@ QList<Annotation*> AnnotationPrivate::findAnnotations(::Page *pdfPage, DocumentD annotation = s; // -> soundIcon - s->setSoundIconName( QString::fromLatin1( soundann->getName()->getCString() ) ); + s->setSoundIconName( QString::fromLatin1( soundann->getName()->c_str() ) ); // -> sound s->setSound( new SoundObject( soundann->getSound() ) ); break; @@ -542,7 +542,7 @@ QList<Annotation*> AnnotationPrivate::findAnnotations(::Page *pdfPage, DocumentD // -> movieTitle const GooString * movietitle = movieann->getTitle(); if ( movietitle ) - m->setMovieTitle( QString::fromLatin1( movietitle->getCString() ) ); + m->setMovieTitle( QString::fromLatin1( movietitle->c_str() ) ); break; } case Annot::typeScreen: @@ -1416,7 +1416,7 @@ QDateTime Annotation::modificationDate() const return d->modDate; if ( d->pdfAnnot->getModified() ) - return convertDate( d->pdfAnnot->getModified()->getCString() ); + return convertDate( d->pdfAnnot->getModified()->c_str() ); else return QDateTime(); } @@ -1452,7 +1452,7 @@ QDateTime Annotation::creationDate() const const AnnotMarkup *markupann = dynamic_cast<const AnnotMarkup*>(d->pdfAnnot); if (markupann && markupann->getDate()) - return convertDate( markupann->getDate()->getCString() ); + return convertDate( markupann->getDate()->c_str() ); return modificationDate(); } @@ -2062,7 +2062,7 @@ QString TextAnnotation::textIcon() const if (d->pdfAnnot->getType() == Annot::typeText) { const AnnotText * textann = static_cast<const AnnotText*>(d->pdfAnnot); - return QString::fromLatin1( textann->getIcon()->getCString() ); + return QString::fromLatin1( textann->getIcon()->c_str() ); } return QString(); @@ -3451,7 +3451,7 @@ QString StampAnnotation::stampIconName() const return d->stampIconName; const AnnotStamp * stampann = static_cast<const AnnotStamp*>(d->pdfAnnot); - return QString::fromLatin1( stampann->getIcon()->getCString() ); + return QString::fromLatin1( stampann->getIcon()->c_str() ); } void StampAnnotation::setStampIconName( const QString &name ) diff --git a/qt5/src/poppler-document.cc b/qt5/src/poppler-document.cc index c7b90ca9..ea2fd7e6 100644 --- a/qt5/src/poppler-document.cc +++ b/qt5/src/poppler-document.cc @@ -760,9 +760,9 @@ namespace Poppler { return false; if (permanentId) - *permanentId = gooPermanentId.getCString(); + *permanentId = gooPermanentId.c_str(); if (updateId) - *updateId = gooUpdateId.getCString(); + *updateId = gooUpdateId.c_str(); return true; } diff --git a/qt5/src/poppler-embeddedfile.cc b/qt5/src/poppler-embeddedfile.cc index 620b1b1b..76bee2f0 100644 --- a/qt5/src/poppler-embeddedfile.cc +++ b/qt5/src/poppler-embeddedfile.cc @@ -87,25 +87,25 @@ int EmbeddedFile::size() const QDateTime EmbeddedFile::modDate() const { const GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->modDate() : nullptr; - return goo ? convertDate(goo->getCString()) : QDateTime(); + return goo ? convertDate(goo->c_str()) : QDateTime(); } QDateTime EmbeddedFile::createDate() const { const GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->createDate() : nullptr; - return goo ? convertDate(goo->getCString()) : QDateTime(); + return goo ? convertDate(goo->c_str()) : QDateTime(); } QByteArray EmbeddedFile::checksum() const { const GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->checksum() : nullptr; - return goo ? QByteArray::fromRawData(goo->getCString(), goo->getLength()) : QByteArray(); + return goo ? QByteArray::fromRawData(goo->c_str(), goo->getLength()) : QByteArray(); } QString EmbeddedFile::mimeType() const { const GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->mimeType() : nullptr; - return goo ? QString(goo->getCString()) : QString(); + return goo ? QString(goo->c_str()) : QString(); } QByteArray EmbeddedFile::data() diff --git a/qt5/src/poppler-form.cc b/qt5/src/poppler-form.cc index ef5eef93..f3b594b1 100644 --- a/qt5/src/poppler-form.cc +++ b/qt5/src/poppler-form.cc @@ -117,7 +117,7 @@ QString FormField::name() const QString name; if (const GooString *goo = m_formData->fm->getPartialName()) { - name = QString::fromLatin1(goo->getCString()); + name = QString::fromLatin1(goo->c_str()); } return name; } @@ -144,7 +144,7 @@ QString FormField::uiName() const QString name; if (const GooString *goo = m_formData->fm->getAlternateUiName()) { - name = QString::fromLatin1(goo->getCString()); + name = QString::fromLatin1(goo->c_str()); } return name; } @@ -746,7 +746,7 @@ SignatureValidationInfo FormFieldSignature::validate(int opt, const QDateTime& v GooString* checkedSignature = fws->getCheckedSignature(&priv->docLength); if (priv->range_bounds.size() == 4 && checkedSignature) { - priv->signature = QByteArray::fromHex(checkedSignature->getCString()); + priv->signature = QByteArray::fromHex(checkedSignature->c_str()); } delete checkedSignature; diff --git a/qt5/src/poppler-link.cc b/qt5/src/poppler-link.cc index 2cede54e..2ede7f2f 100644 --- a/qt5/src/poppler-link.cc +++ b/qt5/src/poppler-link.cc @@ -239,7 +239,7 @@ class LinkMoviePrivate : public LinkPrivate // in case this destination was named one, and it was not resolved if ( data.namedDest && !ld ) { - d->name = QString::fromLatin1( data.namedDest->getCString() ); + d->name = QString::fromLatin1( data.namedDest->c_str() ); } if (!ld) return; diff --git a/qt5/src/poppler-movie.cc b/qt5/src/poppler-movie.cc index dddb12d1..978fbc19 100644 --- a/qt5/src/poppler-movie.cc +++ b/qt5/src/poppler-movie.cc @@ -77,7 +77,7 @@ MovieObject::~MovieObject() QString MovieObject::url() const { const GooString * goo = m_movieData->m_movieObj->getFileName(); - return goo ? QString( goo->getCString() ) : QString(); + return goo ? QString( goo->c_str() ) : QString(); } QSize MovieObject::size() const diff --git a/qt5/src/poppler-page.cc b/qt5/src/poppler-page.cc index 34f58053..68802bab 100644 --- a/qt5/src/poppler-page.cc +++ b/qt5/src/poppler-page.cc @@ -229,13 +229,13 @@ Link* PageData::convertLinkActionToLink(::LinkAction * a, DocumentData *parentDo { LinkLaunch * e = (LinkLaunch *)a; const GooString * p = e->getParams(); - popplerLink = new LinkExecute( linkArea, e->getFileName()->getCString(), p ? p->getCString() : nullptr ); + popplerLink = new LinkExecute( linkArea, e->getFileName()->c_str(), p ? p->c_str() : nullptr ); } break; case actionNamed: { - const char * name = ((LinkNamed *)a)->getName()->getCString(); + const char * name = ((LinkNamed *)a)->getName()->c_str(); if ( !strcmp( name, "NextPage" ) ) popplerLink = new LinkAction( linkArea, LinkAction::PageNext ); else if ( !strcmp( name, "PrevPage" ) ) @@ -274,7 +274,7 @@ Link* PageData::convertLinkActionToLink(::LinkAction * a, DocumentData *parentDo case actionURI: { - popplerLink = new LinkBrowse( linkArea, ((LinkURI *)a)->getURI()->getCString() ); + popplerLink = new LinkBrowse( linkArea, ((LinkURI *)a)->getURI()->c_str() ); } break; @@ -688,7 +688,7 @@ QString Page::text(const QRectF &r, TextLayout textLayout) const s = output_dev->getText(r.left(), r.top(), r.right(), r.bottom()); } - result = QString::fromUtf8(s->getCString()); + result = QString::fromUtf8(s->c_str()); delete output_dev; delete s; @@ -792,7 +792,7 @@ QList<TextBox*> Page::textList(Rotation rotate, ShouldAbortQueryFunc shouldAbort for (int i = 0; i < word_list->getLength(); i++) { TextWord *word = word_list->get(i); GooString *gooWord = word->getText(); - QString string = QString::fromUtf8(gooWord->getCString()); + QString string = QString::fromUtf8(gooWord->c_str()); delete gooWord; double xMin, yMin, xMax, yMax; word->getBBox(&xMin, &yMin, &xMax, &yMax); diff --git a/qt5/src/poppler-private.cc b/qt5/src/poppler-private.cc index 392f7802..44f2167c 100644 --- a/qt5/src/poppler-private.cc +++ b/qt5/src/poppler-private.cc @@ -96,7 +96,7 @@ namespace Debug { convertedStr.append(buf, n); } - return QString::fromUtf8(convertedStr.getCString(), convertedStr.getLength()); + return QString::fromUtf8(convertedStr.c_str(), convertedStr.getLength()); } QString UnicodeParsedString(const GooString *s1) { @@ -108,7 +108,7 @@ namespace Debug { bool deleteCString; if ( ( s1->getChar(0) & 0xff ) == 0xfe && ( s1->getLength() > 1 && ( s1->getChar(1) & 0xff ) == 0xff ) ) { - cString = s1->getCString(); + cString = s1->c_str(); stringLength = s1->getLength(); deleteCString = false; } @@ -200,7 +200,7 @@ namespace Debug { // so better storing the reference and provide the viewport on demand const GooString *s = g->getNamedDest(); QChar *charArray = new QChar[s->getLength()]; - for (int i = 0; i < s->getLength(); ++i) charArray[i] = QChar(s->getCString()[i]); + for (int i = 0; i < s->getLength(); ++i) charArray[i] = QChar(s->c_str()[i]); QString aux(charArray, s->getLength()); e->setAttribute( QStringLiteral("DestinationName"), aux ); delete[] charArray; @@ -224,7 +224,7 @@ namespace Debug { // so better storing the reference and provide the viewport on demand const GooString *s = g->getNamedDest(); QChar *charArray = new QChar[s->getLength()]; - for (int i = 0; i < s->getLength(); ++i) charArray[i] = QChar(s->getCString()[i]); + for (int i = 0; i < s->getLength(); ++i) charArray[i] = QChar(s->c_str()[i]); QString aux(charArray, s->getLength()); e->setAttribute( QStringLiteral("DestinationName"), aux ); delete[] charArray; @@ -234,13 +234,13 @@ namespace Debug { LinkDestinationData ldd(destination, nullptr, doc, g->getFileName() != nullptr); e->setAttribute( QStringLiteral("Destination"), LinkDestination(ldd).toString() ); } - e->setAttribute( QStringLiteral("ExternalFileName"), g->getFileName()->getCString() ); + e->setAttribute( QStringLiteral("ExternalFileName"), g->getFileName()->c_str() ); break; } case actionURI: { const LinkURI * u = static_cast< const LinkURI * >( a ); - e->setAttribute( QStringLiteral("DestinationURI"), u->getURI()->getCString() ); + e->setAttribute( QStringLiteral("DestinationURI"), u->getURI()->c_str() ); } default: ; } diff --git a/qt5/src/poppler-private.h b/qt5/src/poppler-private.h index a83b49a5..8b2513cf 100644 --- a/qt5/src/poppler-private.h +++ b/qt5/src/poppler-private.h @@ -166,8 +166,8 @@ namespace Poppler { FontInfoData( ::FontInfo* fi ) { - if (fi->getName()) fontName = fi->getName()->getCString(); - if (fi->getFile()) fontFile = fi->getFile()->getCString(); + if (fi->getName()) fontName = fi->getName()->c_str(); + if (fi->getFile()) fontFile = fi->getFile()->c_str(); isEmbedded = fi->getEmbedded(); isSubset = fi->getSubset(); type = (Poppler::FontInfo::Type)fi->getType(); diff --git a/qt5/src/poppler-sound.cc b/qt5/src/poppler-sound.cc index 2abdab22..0728ebb8 100644 --- a/qt5/src/poppler-sound.cc +++ b/qt5/src/poppler-sound.cc @@ -79,7 +79,7 @@ QString SoundObject::url() const return QString(); const GooString * goo = m_soundData->m_soundObj->getFileName(); - return goo ? QString( goo->getCString() ) : QString(); + return goo ? QString( goo->c_str() ) : QString(); } QByteArray SoundObject::data() const diff --git a/qt5/tests/check_annotations.cpp b/qt5/tests/check_annotations.cpp index 0830b424..2ae3613b 100644 --- a/qt5/tests/check_annotations.cpp +++ b/qt5/tests/check_annotations.cpp @@ -27,7 +27,7 @@ void TestAnnotations::checkQColorPrecision() { for (int i = std::numeric_limits<uint16_t>::min(); i <= std::numeric_limits<uint16_t>::max(); i++) { double normalized = static_cast<uint16_t>(i) / static_cast<double>(std::numeric_limits<uint16_t>::max()); GooString* serialized = GooString::format("{0:.5f}", normalized); - double deserialized = gatof( serialized->getCString() ); + double deserialized = gatof( serialized->c_str() ); delete serialized; uint16_t denormalized = std::round(deserialized * std::numeric_limits<uint16_t>::max()); if (static_cast<uint16_t>(i) != denormalized) { diff --git a/qt5/tests/check_goostring.cpp b/qt5/tests/check_goostring.cpp index 82576f5f..ed3ea535 100644 --- a/qt5/tests/check_goostring.cpp +++ b/qt5/tests/check_goostring.cpp @@ -39,9 +39,9 @@ void TestGooString::testInsertData() QFETCH(QByteArray, result); GooString goo(string.constData()); - QCOMPARE(goo.getCString(), string.constData()); + QCOMPARE(goo.c_str(), string.constData()); goo.insert(position, addition.constData()); - QCOMPARE(goo.getCString(), result.constData()); + QCOMPARE(goo.c_str(), result.constData()); } void TestGooString::testInsert() @@ -50,13 +50,13 @@ void TestGooString::testInsert() GooString goo; goo.insert(0, "."); goo.insert(0, "This is a very long long test string"); - QCOMPARE(goo.getCString(), "This is a very long long test string."); + QCOMPARE(goo.c_str(), "This is a very long long test string."); } { GooString goo; goo.insert(0, "second-part-third-part"); goo.insert(0, "first-part-"); - QCOMPARE(goo.getCString(), "first-part-second-part-third-part"); + QCOMPARE(goo.c_str(), "first-part-second-part-third-part"); } } @@ -64,63 +64,63 @@ void TestGooString::testFormat() { { const QScopedPointer<GooString> goo(GooString::format("{0:d},{1:x}", 1, 0xF)); - QCOMPARE(goo->getCString(), "1,f"); + QCOMPARE(goo->c_str(), "1,f"); } { const QScopedPointer<GooString> goo(GooString::format("{0:d},{0:x},{0:X},{0:o},{0:b},{0:w}", 0xA)); - QCOMPARE(goo->getCString(), "10,a,A,12,1010, "); + QCOMPARE(goo->c_str(), "10,a,A,12,1010, "); } { const QScopedPointer<GooString> goo(GooString::format("{0:d},{0:x},{0:X},{0:o},{0:b}", -0xA)); - QCOMPARE(goo->getCString(), "-10,-a,-A,-12,-1010"); + QCOMPARE(goo->c_str(), "-10,-a,-A,-12,-1010"); } { const QScopedPointer<GooString> goo(GooString::format("{0:c}{1:c}{2:c}{3:c}", 'T', (char)'E', (short)'S', (int)'T')); - QCOMPARE(goo->getCString(), "TEST"); + QCOMPARE(goo->c_str(), "TEST"); const QScopedPointer<GooString> goo2(GooString::format("{0:s} {1:t}", "TEST", goo.data())); - QCOMPARE(goo2->getCString(), "TEST TEST"); + QCOMPARE(goo2->c_str(), "TEST TEST"); } { const QScopedPointer<GooString> goo(GooString::format("{0:ud} {1:d} {2:d}", UINT_MAX, INT_MAX, INT_MIN)); const QByteArray expected = QStringLiteral("%1 %2 %3").arg(UINT_MAX).arg(INT_MAX).arg(INT_MIN).toLatin1(); - QCOMPARE(goo->getCString(), expected.constData()); + QCOMPARE(goo->c_str(), expected.constData()); } { const QScopedPointer<GooString> goo(GooString::format("{0:uld} {1:ld} {2:ld}", ULONG_MAX, LONG_MAX, LONG_MIN)); const QByteArray expected = QStringLiteral("%1 %2 %3").arg(ULONG_MAX).arg(LONG_MAX).arg(LONG_MIN).toLatin1(); - QCOMPARE(goo->getCString(), expected.constData()); + QCOMPARE(goo->c_str(), expected.constData()); } { const QScopedPointer<GooString> goo(GooString::format("{0:ulld} {1:lld} {2:lld}", ULLONG_MAX, LLONG_MAX, LLONG_MIN)); const QByteArray expected = QStringLiteral("%1 %2 %3").arg(ULLONG_MAX).arg(LLONG_MAX).arg(LLONG_MIN).toLatin1(); - QCOMPARE(goo->getCString(), expected.constData()); + QCOMPARE(goo->c_str(), expected.constData()); } { const QScopedPointer<GooString> gooD(GooString::format("{0:.1f} {0:.1g} {0:.1gs} | {1:.1f} {1:.1g} {1:.1gs}", 1., .012)); const QScopedPointer<GooString> gooF(GooString::format("{0:.1f} {0:.1g} {0:.1gs} | {1:.1f} {1:.1g} {1:.1gs}", 1.f, .012f)); - QCOMPARE(gooD->getCString(), "1.0 1 1 | 0.0 0 0.01"); - QCOMPARE(gooF->getCString(), "1.0 1 1 | 0.0 0 0.01"); + QCOMPARE(gooD->c_str(), "1.0 1 1 | 0.0 0 0.01"); + QCOMPARE(gooF->c_str(), "1.0 1 1 | 0.0 0 0.01"); } { const QScopedPointer<GooString> goo(GooString::format("{0:.4f} {0:.4g} {0:.4gs}", .012)); - QCOMPARE(goo->getCString(), "0.0120 0.012 0.012"); + QCOMPARE(goo->c_str(), "0.0120 0.012 0.012"); } { const QScopedPointer<GooString> goo(GooString::format("{{ SomeText {0:d} }}", 1)); - QCOMPARE(goo->getCString(), "{ SomeText 1 }"); + QCOMPARE(goo->c_str(), "{ SomeText 1 }"); } { const QScopedPointer<GooString> goo(GooString::format("{{{{ {{ SomeText {0:d}", 2)); - QCOMPARE(goo->getCString(), "{{ { SomeText 2"); + QCOMPARE(goo->c_str(), "{{ { SomeText 2"); } { const QScopedPointer<GooString> goo(GooString::format("SomeText {0:d} }} }}}}", 3)); - QCOMPARE(goo->getCString(), "SomeText 3 } }}"); + QCOMPARE(goo->c_str(), "SomeText 3 } }}"); } } diff --git a/qt5/tests/check_pagelabelinfo.cpp b/qt5/tests/check_pagelabelinfo.cpp index e874cd5e..ee8306e7 100644 --- a/qt5/tests/check_pagelabelinfo.cpp +++ b/qt5/tests/check_pagelabelinfo.cpp @@ -31,7 +31,7 @@ void TestPageLabelInfo::testFromDecimal() void TestPageLabelInfo::testFromDecimalUnicode() { std::unique_ptr<GooString> str(Poppler::QStringToUnicodeGooString(QString::fromLocal8Bit("2342"))); - const auto res = fromDecimal(str->getCString(), str->getCString() + str->getLength(), str->hasUnicodeMarker()); + const auto res = fromDecimal(str->c_str(), str->c_str() + str->getLength(), str->hasUnicodeMarker()); #ifndef HAVE_CODECVT QEXPECT_FAIL("", "unicode text to index fails without codecvt", Continue); #endif @@ -46,26 +46,26 @@ void TestPageLabelInfo::testToRoman() { GooString str; toRoman(177, &str, false); - QCOMPARE (str.getCString(), "clxxvii"); + QCOMPARE (str.c_str(), "clxxvii"); } void TestPageLabelInfo::testFromRoman() { GooString roman("clxxvii"); - QCOMPARE(fromRoman(roman.getCString()), 177); + QCOMPARE(fromRoman(roman.c_str()), 177); } void TestPageLabelInfo::testToLatin() { GooString str; toLatin(54, &str, false); - QCOMPARE(str.getCString(), "bbb"); + QCOMPARE(str.c_str(), "bbb"); } void TestPageLabelInfo::testFromLatin() { GooString latin("ddd"); - QCOMPARE(fromLatin(latin.getCString()), 56); + QCOMPARE(fromLatin(latin.c_str()), 56); } QTEST_GUILESS_MAIN(TestPageLabelInfo) diff --git a/qt5/tests/check_strings.cpp b/qt5/tests/check_strings.cpp index d8e3b8b3..583617aa 100644 --- a/qt5/tests/check_strings.cpp +++ b/qt5/tests/check_strings.cpp @@ -203,7 +203,7 @@ void TestStrings::check_QStringToUnicodeGooString() GooString *goo = Poppler::QStringToUnicodeGooString(string); QVERIFY(goo->hasUnicodeMarker()); QCOMPARE(goo->getLength(), string.length() * 2 + 2); - QCOMPARE(result, QByteArray::fromRawData(goo->getCString() + 2, goo->getLength() - 2)); + QCOMPARE(result, QByteArray::fromRawData(goo->c_str() + 2, goo->getLength() - 2)); delete goo; } @@ -229,7 +229,7 @@ void TestStrings::check_QStringToGooString() QFETCH(GooString*, result); GooString *goo = Poppler::QStringToGooString(string); - QCOMPARE(goo->getCString(), result->getCString()); + QCOMPARE(goo->c_str(), result->c_str()); delete goo; } diff --git a/splash/SplashBitmap.cc b/splash/SplashBitmap.cc index 837d412b..021a612d 100644 --- a/splash/SplashBitmap.cc +++ b/splash/SplashBitmap.cc @@ -412,7 +412,7 @@ SplashError SplashBitmap::writeImgFile(SplashImageFileFormat format, FILE *f, in writer = new TiffWriter(); } if (writer && params) { - ((TiffWriter *)writer)->setCompressionString(params->tiffCompression.getCString()); + ((TiffWriter *)writer)->setCompressionString(params->tiffCompression.c_str()); } break; #endif diff --git a/splash/SplashFTFontEngine.cc b/splash/SplashFTFontEngine.cc index c8f7e559..109e1a0e 100644 --- a/splash/SplashFTFontEngine.cc +++ b/splash/SplashFTFontEngine.cc @@ -106,7 +106,7 @@ SplashFontFile *SplashFTFontEngine::loadCIDFont(SplashFontFileID *idA, nCIDs = 0; } else { if (src->isFile) { - ff = FoFiType1C::load(src->fileName->getCString()); + ff = FoFiType1C::load(src->fileName->c_str()); } else { ff = FoFiType1C::make(src->buf, src->bufLen); } @@ -139,7 +139,7 @@ SplashFontFile *SplashFTFontEngine::loadOpenTypeCFFFont(SplashFontFileID *idA, if (!codeToGID) { if (!useCIDs) { if (src->isFile) { - ff = FoFiTrueType::load(src->fileName->getCString()); + ff = FoFiTrueType::load(src->fileName->c_str()); } else { ff = FoFiTrueType::make(src->buf, src->bufLen); } diff --git a/splash/SplashFTFontFile.cc b/splash/SplashFTFontFile.cc index b1f9ddb5..91c5e864 100644 --- a/splash/SplashFTFontFile.cc +++ b/splash/SplashFTFontFile.cc @@ -44,7 +44,7 @@ SplashFontFile *SplashFTFontFile::loadType1Font(SplashFTFontEngine *engineA, int i; if (src->isFile) { - if (FT_New_Face(engineA->lib, src->fileName->getCString(), 0, &faceA)) + if (FT_New_Face(engineA->lib, src->fileName->c_str(), 0, &faceA)) return nullptr; } else { if (FT_New_Memory_Face(engineA->lib, (const FT_Byte *)src->buf, src->bufLen, 0, &faceA)) @@ -76,7 +76,7 @@ SplashFontFile *SplashFTFontFile::loadCIDFont(SplashFTFontEngine *engineA, FT_Face faceA; if (src->isFile) { - if (FT_New_Face(engineA->lib, src->fileName->getCString(), 0, &faceA)) + if (FT_New_Face(engineA->lib, src->fileName->c_str(), 0, &faceA)) return nullptr; } else { if (FT_New_Memory_Face(engineA->lib, (const FT_Byte *)src->buf, src->bufLen, 0, &faceA)) @@ -96,7 +96,7 @@ SplashFontFile *SplashFTFontFile::loadTrueTypeFont(SplashFTFontEngine *engineA, FT_Face faceA; if (src->isFile) { - if (FT_New_Face(engineA->lib, src->fileName->getCString(), faceIndexA, &faceA)) + if (FT_New_Face(engineA->lib, src->fileName->c_str(), faceIndexA, &faceA)) return nullptr; } else { if (FT_New_Memory_Face(engineA->lib, (const FT_Byte *)src->buf, src->bufLen, faceIndexA, &faceA)) diff --git a/splash/SplashFontFile.cc b/splash/SplashFontFile.cc index b5a1d25f..bf41cbef 100644 --- a/splash/SplashFontFile.cc +++ b/splash/SplashFontFile.cc @@ -77,7 +77,7 @@ SplashFontSrc::~SplashFontSrc() { if (deleteSrc) { if (isFile) { if (fileName) - unlink(fileName->getCString()); + unlink(fileName->c_str()); } else { if (buf) gfree(buf); diff --git a/test/perf-test.cc b/test/perf-test.cc index 7372a79b..07669300 100644 --- a/test/perf-test.cc +++ b/test/perf-test.cc @@ -879,7 +879,7 @@ static void RenderPdfAsText(const char *fileName) timeInMs = msTimer.getElapsed(); if (gfTimings) LogInfo("page %d: %.2f ms\n", curPage, timeInMs); - printf("%s\n", txt->getCString()); + printf("%s\n", txt->c_str()); delete txt; txt = nullptr; } diff --git a/utils/HtmlFonts.cc b/utils/HtmlFonts.cc index a294be19..597c2624 100644 --- a/utils/HtmlFonts.cc +++ b/utils/HtmlFonts.cc @@ -130,17 +130,17 @@ HtmlFont::HtmlFont(GfxFont *font, int _size, GfxRGB rgb){ GooString fontnameLower(fontname); fontnameLower.lowerCase(); - if (!bold && strstr(fontnameLower.getCString(),"bold")) { + if (!bold && strstr(fontnameLower.c_str(),"bold")) { bold=true; } if (!italic && - (strstr(fontnameLower.getCString(),"italic")|| - strstr(fontnameLower.getCString(),"oblique"))) { + (strstr(fontnameLower.c_str(),"italic")|| + strstr(fontnameLower.c_str(),"oblique"))) { italic=true; } - familyName = fontname->getCString(); + familyName = fontname->c_str(); removeStyleSuffix(familyName); } else { FontName = new GooString(defaultFamilyName); diff --git a/utils/HtmlFonts.h b/utils/HtmlFonts.h index 7f7e15d2..33b555d5 100644 --- a/utils/HtmlFonts.h +++ b/utils/HtmlFonts.h @@ -91,7 +91,7 @@ public: static GooString* HtmlFilter(const Unicode* u, int uLen); //char* s); bool isEqual(const HtmlFont& x) const; bool isEqualIgnoreBold(const HtmlFont& x) const; - void print() const {printf("font: %s (%s) %d %s%s\n", FontName->getCString(), familyName.c_str(), size, bold ? "bold " : "", italic ? "italic " : "");}; + void print() const {printf("font: %s (%s) %d %s%s\n", FontName->c_str(), familyName.c_str(), size, bold ? "bold " : "", italic ? "italic " : "");}; }; class HtmlFontAccu{ diff --git a/utils/HtmlLinks.cc b/utils/HtmlLinks.cc index 49533628..e86dbf75 100644 --- a/utils/HtmlLinks.cc +++ b/utils/HtmlLinks.cc @@ -62,7 +62,7 @@ HtmlLink::~HtmlLink(){ } bool HtmlLink::isEqualDest(const HtmlLink& x) const{ - return (!strcmp(dest->getCString(), x.dest->getCString())); + return (!strcmp(dest->c_str(), x.dest->c_str())); } bool HtmlLink::inLink(double xmin,double ymin,double xmax,double ymax) const { diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc index ce5e7735..ab3aff94 100644 --- a/utils/HtmlOutputDev.cc +++ b/utils/HtmlOutputDev.cc @@ -118,7 +118,7 @@ static GooString *gstr_buff0 = nullptr; // a workspace in which I format strings static GooString* basename(GooString* str){ - const char *p=str->getCString(); + const char *p=str->c_str(); int len=str->getLength(); for (int i=len-1;i>=0;i--) if (*(p+i)==SLASH) @@ -129,7 +129,7 @@ static GooString* basename(GooString* str){ #if 0 static GooString* Dirname(GooString* str){ - char *p=str->getCString(); + char *p=str->c_str(); int len=str->getLength(); for (int i=len-1;i>=0;i--) if (*(p+i)==SLASH) @@ -143,7 +143,7 @@ static const char *print_matrix(const double *mat) { gstr_buff0 = GooString::format("[{0:g} {1:g} {2:g} {3:g} {4:g} {5:g}]", *mat, mat[1], mat[2], mat[3], mat[4], mat[5]); - return gstr_buff0->getCString(); + return gstr_buff0->c_str(); } static const char *print_uni_str(const Unicode *u, const unsigned uLen) { @@ -161,7 +161,7 @@ static const char *print_uni_str(const Unicode *u, const unsigned uLen) { } } - return gstr_buff0->getCString(); + return gstr_buff0->c_str(); } //------------------------------------------------------------------------ @@ -469,9 +469,9 @@ static const char *strrstr( const char *s, const char *ss ) static void CloseTags( GooString *htext, bool &finish_a, bool &finish_italic, bool &finish_bold ) { - const char *last_italic = finish_italic && ( finish_bold || finish_a ) ? strrstr( htext->getCString(), "<i>" ) : nullptr; - const char *last_bold = finish_bold && ( finish_italic || finish_a ) ? strrstr( htext->getCString(), "<b>" ) : nullptr; - const char *last_a = finish_a && ( finish_italic || finish_bold ) ? strrstr( htext->getCString(), "<a " ) : nullptr; + const char *last_italic = finish_italic && ( finish_bold || finish_a ) ? strrstr( htext->c_str(), "<i>" ) : nullptr; + const char *last_bold = finish_bold && ( finish_italic || finish_a ) ? strrstr( htext->c_str(), "<b>" ) : nullptr; + const char *last_a = finish_a && ( finish_italic || finish_bold ) ? strrstr( htext->c_str(), "<a " ) : nullptr; if( finish_a && ( finish_italic || finish_bold ) && last_a > ( last_italic > last_bold ? last_italic : last_bold ) ){ htext->append("</a>", 4); finish_a = false; @@ -727,7 +727,7 @@ void HtmlPage::coalesce() { printf("x=%3d..%3d y=%3d..%3d size=%2d ", (int)str1->xMin, (int)str1->xMax, (int)str1->yMin, (int)str1->yMax, (int)(str1->yMax - str1->yMin)); - printf("'%s'\n", str1->htext->getCString()); + printf("'%s'\n", str1->htext->c_str()); } printf("\n------------------------------------------------------------\n\n"); #endif @@ -740,7 +740,7 @@ void HtmlPage::dumpAsXML(FILE* f,int page){ for(int i=fontsPageMarker;i < fonts->size();i++) { GooString *fontCSStyle = fonts->CSStyle(i); - fprintf(f,"\t%s\n",fontCSStyle->getCString()); + fprintf(f,"\t%s\n",fontCSStyle->c_str()); delete fontCSStyle; } @@ -754,7 +754,7 @@ void HtmlPage::dumpAsXML(FILE* f,int page){ fprintf(f, "<image top=\"%f\" left=\"%f\" ", img->yMin, img->xMin); fprintf(f, "width=\"%f\" height=\"%f\" ", img->xMax - img->xMin, img->yMax - img->yMin); } - fprintf(f,"src=\"%s\"/>\n",img->fName->getCString()); + fprintf(f,"src=\"%s\"/>\n",img->fName->c_str()); delete img; } imgList->clear(); @@ -770,7 +770,7 @@ void HtmlPage::dumpAsXML(FILE* f,int page){ fprintf(f, "width=\"%f\" height=\"%f\" ", tmp->xMax - tmp->xMin, tmp->yMax - tmp->yMin); } fprintf(f,"font=\"%d\">", tmp->fontpos); - fputs(tmp->htext->getCString(),f); + fputs(tmp->htext->c_str(),f); fputs("</text>\n",f); } } @@ -822,10 +822,10 @@ int HtmlPage::dumpComplexHeaders(FILE * const file, FILE *& pageFile, int page) tmp = new GooString(DocName); if (!singleHtml){ tmp->append('-')->append(pgNum)->append(".html"); - pageFile = fopen(tmp->getCString(), "w"); + pageFile = fopen(tmp->c_str(), "w"); } else { tmp->append("-html")->append(".html"); - pageFile = fopen(tmp->getCString(), "a"); + pageFile = fopen(tmp->c_str(), "a"); } delete pgNum; if (!pageFile) { @@ -837,15 +837,15 @@ int HtmlPage::dumpComplexHeaders(FILE * const file, FILE *& pageFile, int page) if (!singleHtml) fprintf(pageFile,"%s\n<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"\" xml:lang=\"\">\n<head>\n<title>Page %d</title>\n\n", DOCTYPE, page); else - fprintf(pageFile,"%s\n<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"\" xml:lang=\"\">\n<head>\n<title>%s</title>\n\n", DOCTYPE, tmp->getCString()); + fprintf(pageFile,"%s\n<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"\" xml:lang=\"\">\n<head>\n<title>%s</title>\n\n", DOCTYPE, tmp->c_str()); delete tmp; GooString *htmlEncoding = HtmlOutputDev::mapEncodingToHtml(globalParams->getTextEncodingName()); if (!singleHtml) - fprintf(pageFile, "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\"/>\n", htmlEncoding->getCString()); + fprintf(pageFile, "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\"/>\n", htmlEncoding->c_str()); else - fprintf(pageFile, "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\"/>\n <br/>\n", htmlEncoding->getCString()); + fprintf(pageFile, "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\"/>\n <br/>\n", htmlEncoding->c_str()); delete htmlEncoding; } else @@ -876,7 +876,7 @@ void HtmlPage::dumpComplex(FILE *file, int page){ fontCSStyle = fonts->CSStyle(i); else fontCSStyle = fonts->CSStyle(i,page); - fprintf(pageFile,"\t%s\n",fontCSStyle->getCString()); + fprintf(pageFile,"\t%s\n",fontCSStyle->c_str()); delete fontCSStyle; } @@ -894,8 +894,8 @@ void HtmlPage::dumpComplex(FILE *file, int page){ { fprintf(pageFile, "<img width=\"%d\" height=\"%d\" src=\"%s%03d.%s\" alt=\"background image\"/>\n", - pageWidth, pageHeight, tmp->getCString(), - (page-firstPage+1), imgExt->getCString()); + pageWidth, pageHeight, tmp->c_str(), + (page-firstPage+1), imgExt->c_str()); } delete tmp; @@ -912,7 +912,7 @@ void HtmlPage::dumpComplex(FILE *file, int page){ fprintf(pageFile, "%d", page); } fprintf(pageFile,"%d\">", tmp1->fontpos); - fputs(tmp1->htext->getCString(), pageFile); + fputs(tmp1->htext->c_str(), pageFile); fputs("</p>\n", pageFile); } } @@ -947,7 +947,7 @@ void HtmlPage::dump(FILE *f, int pageNum) if (img->xMin > img->xMax) style_index += 1; // xFlip if (img->yMin > img->yMax) style_index += 2; // yFlip - fprintf(f,"<img%s src=\"%s\"/><br/>\n",styles[style_index],img->fName->getCString()); + fprintf(f,"<img%s src=\"%s\"/><br/>\n",styles[style_index],img->fName->c_str()); delete img; } imgList->clear(); @@ -956,7 +956,7 @@ void HtmlPage::dump(FILE *f, int pageNum) for(HtmlString *tmp=yxStrings;tmp;tmp=tmp->yxNext){ if (tmp->htext){ str=new GooString(tmp->htext); - fputs(str->getCString(),f); + fputs(str->c_str(),f); delete str; fputs("<br/>\n",f); } @@ -1062,7 +1062,7 @@ void HtmlOutputDev::doFrame(int firstPage){ GooString* htmlEncoding; fName->append(".html"); - if (!(fContentsFrame = fopen(fName->getCString(), "w"))){ + if (!(fContentsFrame = fopen(fName->c_str(), "w"))){ error(errIO, -1, "Couldn't open html file '{0:t}'", fName); delete fName; return; @@ -1074,18 +1074,18 @@ void HtmlOutputDev::doFrame(int firstPage){ fputs(DOCTYPE, fContentsFrame); fputs("\n<html>",fContentsFrame); fputs("\n<head>",fContentsFrame); - fprintf(fContentsFrame,"\n<title>%s</title>",docTitle->getCString()); + fprintf(fContentsFrame,"\n<title>%s</title>",docTitle->c_str()); htmlEncoding = mapEncodingToHtml(globalParams->getTextEncodingName()); - fprintf(fContentsFrame, "\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\"/>\n", htmlEncoding->getCString()); + fprintf(fContentsFrame, "\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\"/>\n", htmlEncoding->c_str()); dumpMetaVars(fContentsFrame); fprintf(fContentsFrame, "</head>\n"); fputs("<frameset cols=\"100,*\">\n",fContentsFrame); - fprintf(fContentsFrame,"<frame name=\"links\" src=\"%s_ind.html\"/>\n",fName->getCString()); + fprintf(fContentsFrame,"<frame name=\"links\" src=\"%s_ind.html\"/>\n",fName->c_str()); fputs("<frame name=\"contents\" src=",fContentsFrame); if (complexMode) - fprintf(fContentsFrame,"\"%s-%d.html\"",fName->getCString(), firstPage); + fprintf(fContentsFrame,"\"%s-%d.html\"",fName->c_str(), firstPage); else - fprintf(fContentsFrame,"\"%ss.html\"",fName->getCString()); + fprintf(fContentsFrame,"\"%ss.html\"",fName->c_str()); fputs("/>\n</frameset>\n</html>\n",fContentsFrame); @@ -1137,7 +1137,7 @@ HtmlOutputDev::HtmlOutputDev(Catalog *catalogA, const char *fileName, const char doFrame(firstPage); - if (!(fContentsFrame = fopen(left->getCString(), "w"))) + if (!(fContentsFrame = fopen(left->c_str(), "w"))) { error(errIO, -1, "Couldn't open html file '{0:t}'", left); delete left; @@ -1150,7 +1150,7 @@ HtmlOutputDev::HtmlOutputDev(Catalog *catalogA, const char *fileName, const char if (doOutline) { GooString *str = basename(Docname); - fprintf(fContentsFrame, "<a href=\"%s%s\" target=\"contents\">Outline</a><br/>", str->getCString(), complexMode ? "-outline.html" : "s.html#outline"); + fprintf(fContentsFrame, "<a href=\"%s%s\" target=\"contents\">Outline</a><br/>", str->c_str(), complexMode ? "-outline.html" : "s.html#outline"); delete str; } } @@ -1160,7 +1160,7 @@ HtmlOutputDev::HtmlOutputDev(Catalog *catalogA, const char *fileName, const char GooString* right=new GooString(fileName); right->append("s.html"); - if (!(page=fopen(right->getCString(),"w"))){ + if (!(page=fopen(right->c_str(),"w"))){ error(errIO, -1, "Couldn't open html file '{0:t}'", right); delete right; return; @@ -1179,7 +1179,7 @@ HtmlOutputDev::HtmlOutputDev(Catalog *catalogA, const char *fileName, const char GooString* right=new GooString(fileName); if (!xml) right->append(".html"); if (xml) right->append(".xml"); - if (!(page=fopen(right->getCString(),"w"))){ + if (!(page=fopen(right->c_str(),"w"))){ error(errIO, -1, "Couldn't open html file '{0:t}'", right); delete right; return; @@ -1190,15 +1190,15 @@ HtmlOutputDev::HtmlOutputDev(Catalog *catalogA, const char *fileName, const char GooString *htmlEncoding = mapEncodingToHtml(globalParams->getTextEncodingName()); if (xml) { - fprintf(page, "<?xml version=\"1.0\" encoding=\"%s\"?>\n", htmlEncoding->getCString()); + fprintf(page, "<?xml version=\"1.0\" encoding=\"%s\"?>\n", htmlEncoding->c_str()); fputs("<!DOCTYPE pdf2xml SYSTEM \"pdf2xml.dtd\">\n\n", page); fprintf(page,"<pdf2xml producer=\"%s\" version=\"%s\">\n", PACKAGE_NAME, PACKAGE_VERSION); } else { - fprintf(page,"%s\n<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"\" xml:lang=\"\">\n<head>\n<title>%s</title>\n", DOCTYPE, docTitle->getCString()); + fprintf(page,"%s\n<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"\" xml:lang=\"\">\n<head>\n<title>%s</title>\n", DOCTYPE, docTitle->c_str()); - fprintf(page, "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\"/>\n", htmlEncoding->getCString()); + fprintf(page, "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%s\"/>\n", htmlEncoding->c_str()); dumpMetaVars(page); printCSS(page); @@ -1242,7 +1242,7 @@ void HtmlOutputDev::startPage(int pageNum, GfxState *state, XRef *xref) { write=false; GooString* fname=Dirname(Docname); fname->append("image.log"); - if((tin=fopen(getFileNameFromPath(fname->getCString(),fname->getLength()),"w"))==NULL){ + if((tin=fopen(getFileNameFromPath(fname->c_str(),fname->getLength()),"w"))==NULL){ printf("Error : can not open %s",fname); exit(1); } @@ -1263,9 +1263,9 @@ void HtmlOutputDev::startPage(int pageNum, GfxState *state, XRef *xref) { if (fContentsFrame) { if (complexMode) - fprintf(fContentsFrame,"<a href=\"%s-%d.html\"",str->getCString(),pageNum); + fprintf(fContentsFrame,"<a href=\"%s-%d.html\"",str->c_str(),pageNum); else - fprintf(fContentsFrame,"<a href=\"%ss.html#%d\"",str->getCString(),pageNum); + fprintf(fContentsFrame,"<a href=\"%ss.html#%d\"",str->c_str(),pageNum); fprintf(fContentsFrame," target=\"contents\" >Page %d</a><br/>\n",pageNum); } } @@ -1329,7 +1329,7 @@ void HtmlOutputDev::drawJpegImage(GfxState *state, Stream *str) // open the image file GooString *fName=createImageFileName("jpg"); - if (!(f1 = fopen(fName->getCString(), "wb"))) { + if (!(f1 = fopen(fName->c_str(), "wb"))) { error(errIO, -1, "Couldn't open image file '{0:t}'", fName); delete fName; return; @@ -1363,7 +1363,7 @@ void HtmlOutputDev::drawPngImage(GfxState *state, Stream *str, int width, int he // open the image file GooString *fName=createImageFileName("png"); - if (!(f1 = fopen(fName->getCString(), "wb"))) { + if (!(f1 = fopen(fName->c_str(), "wb"))) { error(errIO, -1, "Couldn't open image file '{0:t}'", fName); delete fName; return; @@ -1624,7 +1624,7 @@ GooString* HtmlOutputDev::getLinkDest(AnnotLink *link){ GooString *file=new GooString(); if (ha->getFileName()){ delete file; - file=new GooString(ha->getFileName()->getCString()); + file=new GooString(ha->getFileName()->c_str()); } if (ha->getDest()!=nullptr) dest=ha->getDest()->copy(); if (dest&&file){ @@ -1633,7 +1633,7 @@ GooString* HtmlOutputDev::getLinkDest(AnnotLink *link){ if (printCommands) printf(" link to page %d ",page); if (printHtml){ - const char *p=file->getCString()+file->getLength()-4; + const char *p=file->c_str()+file->getLength()-4; if (!strcmp(p, ".pdf") || !strcmp(p, ".PDF")){ file->del(file->getLength()-4,4); file->append(".html"); @@ -1644,26 +1644,26 @@ GooString* HtmlOutputDev::getLinkDest(AnnotLink *link){ delete pgNum; } } - if (printCommands && file) printf("filename %s\n",file->getCString()); + if (printCommands && file) printf("filename %s\n",file->c_str()); return file; } case actionURI: { LinkURI *ha=(LinkURI *) link->getAction(); - GooString* file=new GooString(ha->getURI()->getCString()); - // printf("uri : %s\n",file->getCString()); + GooString* file=new GooString(ha->getURI()->c_str()); + // printf("uri : %s\n",file->c_str()); return file; } case actionLaunch: if (printHtml) { LinkLaunch *ha=(LinkLaunch *) link->getAction(); - GooString* file=new GooString(ha->getFileName()->getCString()); - const char *p=file->getCString()+file->getLength()-4; + GooString* file=new GooString(ha->getFileName()->c_str()); + const char *p=file->c_str()+file->getLength()-4; if (!strcmp(p, ".pdf") || !strcmp(p, ".PDF")){ file->del(file->getLength()-4,4); file->append(".html"); } - if (printCommands) printf("filename %s",file->getCString()); + if (printCommands) printf("filename %s",file->c_str()); return file; @@ -1682,7 +1682,7 @@ void HtmlOutputDev::dumpMetaVars(FILE *file) { HtmlMetaVar *t = (HtmlMetaVar*)glMetaVars->get(i); var = t->toString(); - fprintf(file, "%s\n", var->getCString()); + fprintf(file, "%s\n", var->c_str()); delete var; } } @@ -1718,7 +1718,7 @@ bool HtmlOutputDev::dumpDocOutline(PDFDoc* doc) { GooString *str = Docname->copy(); str->append("-outline.html"); - output = fopen(str->getCString(), "w"); + output = fopen(str->c_str(), "w"); delete str; if (output == nullptr) return false; @@ -1733,7 +1733,7 @@ bool HtmlOutputDev::dumpDocOutline(PDFDoc* doc) "<title>Document Outline</title>\n" \ "<meta http-equiv=\"Content-Type\" content=\"text/html; " \ "charset=%s\"/>\n" \ - "</head>\n<body>\n", htmlEncoding->getCString()); + "</head>\n<body>\n", htmlEncoding->c_str()); delete htmlEncoding; } } @@ -1801,8 +1801,8 @@ bool HtmlOutputDev::newHtmlOutlineLevel(FILE *output, const GooList *outlines, i fputs("<li>",output); if (linkName) - fprintf(output,"<a href=\"%s\">", linkName->getCString()); - fputs(titleStr->getCString(),output); + fprintf(output,"<a href=\"%s\">", linkName->c_str()); + fputs(titleStr->c_str(),output); if (linkName) { fputs("</a>",output); delete linkName; @@ -1837,11 +1837,11 @@ void HtmlOutputDev::newXmlOutlineLevel(FILE *output, const GooList *outlines) if (page > 0) { fprintf(output, "<item page=\"%d\">%s</item>\n", - page, titleStr->getCString()); + page, titleStr->c_str()); } else { - fprintf(output, "<item>%s</item>\n", titleStr->getCString()); + fprintf(output, "<item>%s</item>\n", titleStr->c_str()); } delete titleStr; diff --git a/utils/HtmlOutputDev.h b/utils/HtmlOutputDev.h index 0a39baba..0bdc8bdb 100644 --- a/utils/HtmlOutputDev.h +++ b/utils/HtmlOutputDev.h @@ -319,7 +319,7 @@ public: bool dumpDocOutline(PDFDoc* doc); private: - // convert encoding into a HTML standard, or encoding->getCString if not + // convert encoding into a HTML standard, or encoding->c_str if not // recognized. Will delete encoding for you and return a new one // that you have to delete static GooString* mapEncodingToHtml(GooString* encoding); diff --git a/utils/JSInfo.cc b/utils/JSInfo.cc index 4488de46..f465b7e3 100644 --- a/utils/JSInfo.cc +++ b/utils/JSInfo.cc @@ -40,7 +40,7 @@ void JSInfo::printJS(const GooString *js) { char buf[8]; int i, n, len; - if (!js || !js->getCString()) + if (!js || !js->c_str()) return; len = TextStringToUCS4(js, &u); @@ -60,7 +60,7 @@ void JSInfo::scanLinkAction(LinkAction *link, const char *action, bool deleteLin if (print) { LinkJavaScript *linkjs = static_cast<LinkJavaScript *>(link); const GooString *s = linkjs->getScript(); - if (s && s->getCString()) { + if (s && s->c_str()) { fprintf(file, "%s:\n", action); printJS(s); fputs("\n\n", file); @@ -74,7 +74,7 @@ void JSInfo::scanLinkAction(LinkAction *link, const char *action, bool deleteLin hasJS = true; if (print) { const GooString *s = linkr->getScript(); - if (s && s->getCString()) { + if (s && s->c_str()) { fprintf(file, "%s (Rendition):\n", action); printJS(s); fputs("\n\n", file); @@ -112,7 +112,7 @@ void JSInfo::scan(int nPages) { hasJS = true; if (print) { for (int i = 0; i < numNames; i++) { - fprintf(file, "Name Dictionary \"%s\":\n", doc->getCatalog()->getJSName(i)->getCString()); + fprintf(file, "Name Dictionary \"%s\":\n", doc->getCatalog()->getJSName(i)->c_str()); GooString *js = doc->getCatalog()->getJS(i); printJS(js); delete js; diff --git a/utils/pdffonts.cc b/utils/pdffonts.cc index 6c949aa3..ecb94a01 100644 --- a/utils/pdffonts.cc +++ b/utils/pdffonts.cc @@ -175,7 +175,7 @@ int main(int argc, char *argv[]) { FontInfo *font = (FontInfo *)fonts->get(i); if (font->getFile()) { printf("%-36s", - font->getName() ? font->getName()->getCString() : "[none]"); + font->getName() ? font->getName()->c_str() : "[none]"); const Ref fontRef = font->getRef(); if (fontRef.gen >= 100000) { printf(" [none]"); @@ -183,8 +183,8 @@ int main(int argc, char *argv[]) { printf(" %6d %2d", fontRef.num, fontRef.gen); } printf(" %-36s %s\n", - font->getSubstituteName() ? font->getSubstituteName()->getCString() : "[none]", - font->getFile()->getCString()); + font->getSubstituteName() ? font->getSubstituteName()->c_str() : "[none]", + font->getFile()->c_str()); } delete font; } @@ -198,9 +198,9 @@ int main(int argc, char *argv[]) { for (int i = 0; i < fonts->getLength(); ++i) { FontInfo *font = (FontInfo *)fonts->get(i); printf("%-36s %-17s %-16s %-3s %-3s %-3s", - font->getName() ? font->getName()->getCString() : "[none]", + font->getName() ? font->getName()->c_str() : "[none]", fontTypeNames[font->getType()], - font->getEncoding()->getCString(), + font->getEncoding()->c_str(), font->getEmbedded() ? "yes" : "no", font->getSubset() ? "yes" : "no", font->getToUnicode() ? "yes" : "no"); diff --git a/utils/pdfinfo.cc b/utils/pdfinfo.cc index fd7b9f34..b913d7f4 100644 --- a/utils/pdfinfo.cc +++ b/utils/pdfinfo.cc @@ -158,7 +158,7 @@ static void printInfoDate(Dict *infoDict, const char *key, const char *text) { Object obj = infoDict->lookup(key); if (obj.isString()) { fputs(text, stdout); - s = obj.getString()->getCString(); + s = obj.getString()->c_str(); // TODO do something with the timezone info if ( parseDateString( s, &year, &mon, &day, &hour, &min, &sec, &tz, &tz_hour, &tz_minute ) ) { tmStruct.tm_year = year - 1900; @@ -199,7 +199,7 @@ static void printISODate(Dict *infoDict, const char *key, const char *text) Object obj = infoDict->lookup(key); if (obj.isString()) { fputs(text, stdout); - s = obj.getString()->getCString(); + s = obj.getString()->c_str(); if ( parseDateString( s, &year, &mon, &day, &hour, &min, &sec, &tz, &tz_hour, &tz_minute ) ) { fprintf(stdout, "%04d-%02d-%02dT%02d:%02d:%02d", year, mon, day, hour, min, sec); if (tz_hour == 0 && tz_minute == 0) { @@ -234,7 +234,7 @@ static void printAttribute(const Attribute *attribute, unsigned indent) printf(" /%s ", attribute->getTypeName()); if (attribute->getType() == Attribute::UserProperty) { GooString *name = attribute->getName(); - printf("(%s) ", name->getCString()); + printf("(%s) ", name->c_str()); delete name; } attribute->getValue()->print(stdout); @@ -257,7 +257,7 @@ static void printStruct(const StructElement *element, unsigned indent) { GooString *text = element->getText(false); printIndent(indent); if (text) { - printf("\"%s\"\n", text->getCString()); + printf("\"%s\"\n", text->c_str()); } else { printf("(No content?)\n"); } @@ -268,10 +268,10 @@ static void printStruct(const StructElement *element, unsigned indent) { printIndent(indent); printf("%s", element->getTypeName()); if (element->getID()) { - printf(" <%s>", element->getID()->getCString()); + printf(" <%s>", element->getID()->c_str()); } if (element->getTitle()) { - printf(" \"%s\"", element->getTitle()->getCString()); + printf(" \"%s\"", element->getTitle()->c_str()); } if (element->getRevision() > 0) { printf(" r%u", element->getRevision()); @@ -368,7 +368,7 @@ static void printLinkDest(LinkDest *dest) { s.append(" "); s.setChar(26, ']'); s.setChar(27, '\0'); - printf("%s", s.getCString()); + printf("%s", s.c_str()); } static void printDestinations(PDFDoc *doc, UnicodeMap *uMap) { @@ -648,15 +648,15 @@ static void printPdfSubtype(PDFDoc *doc, UnicodeMap *uMap) { break; } - printf(" Title: %s\n",typeExp->getCString()); - printf(" Abbreviation: %s\n", abbr->getCString()); + printf(" Title: %s\n",typeExp->c_str()); + printf(" Abbreviation: %s\n", abbr->c_str()); if (part.get()) - printf(" Subtitle: Part %d: %s\n", subpart, part->getCString()); + printf(" Subtitle: Part %d: %s\n", subpart, part->c_str()); else printf(" Subtitle: Part %d\n", subpart); printf(" Standard: %s-%d\n", typeExp->toStr().substr(0,9).c_str(), subpart); if (confExp.get()) - printf(" Conformance: %s\n", confExp->getCString()); + printf(" Conformance: %s\n", confExp->c_str()); } } @@ -942,7 +942,7 @@ int main(int argc, char *argv[]) { // print the metadata const GooString *metadata = doc->readMetadata(); if (metadata) { - fputs(metadata->getCString(), stdout); + fputs(metadata->c_str(), stdout); fputc('\n', stdout); delete metadata; } @@ -965,9 +965,9 @@ int main(int argc, char *argv[]) { long long filesize = 0; #ifdef VMS - f = fopen(fileName->getCString(), "rb", "ctx=stm"); + f = fopen(fileName->c_str(), "rb", "ctx=stm"); #else - f = fopen(fileName->getCString(), "rb"); + f = fopen(fileName->c_str(), "rb"); #endif if (f) { Gfseek(f, 0, SEEK_END); diff --git a/utils/pdfsig.cc b/utils/pdfsig.cc index b0e40e78..091ffdcb 100644 --- a/utils/pdfsig.cc +++ b/utils/pdfsig.cc @@ -106,11 +106,11 @@ static void dumpSignature(int sig_num, int sigCount, FormWidgetSignature *sig_wi // we don't want it to be replaced GooString *format = GooString::format("{{0:s}}.sig{{1:{0:d}d}}", sigCountLength); char *filenameCopy = strdup(filename); - GooString *path = GooString::format(format->getCString(), basename(filenameCopy), sig_num); + GooString *path = GooString::format(format->c_str(), basename(filenameCopy), sig_num); free(filenameCopy); - printf("Signature #%d (%u bytes) => %s\n", sig_num, signature->getLength(), path->getCString()); - std::ofstream outfile(path->getCString(), std::ofstream::binary); - outfile.write(signature->getCString(), signature->getLength()); + printf("Signature #%d (%u bytes) => %s\n", sig_num, signature->getLength(), path->c_str()); + std::ofstream outfile(path->c_str(), std::ofstream::binary); + outfile.write(signature->c_str(), signature->getLength()); outfile.close(); delete format; delete path; @@ -184,14 +184,14 @@ int main(int argc, char *argv[]) if (dumpSignatures) { printf("Dumping Signatures: %u\n", sigCount); for (unsigned int i = 0; i < sigCount; i++) { - dumpSignature(i, sigCount, sig_widgets.at(i), fileName->getCString()); + dumpSignature(i, sigCount, sig_widgets.at(i), fileName->c_str()); } goto end; } else { - printf("Digital Signature Info of: %s\n", fileName->getCString()); + printf("Digital Signature Info of: %s\n", fileName->c_str()); } } else { - printf("File '%s' does not contain any signatures\n", fileName->getCString()); + printf("File '%s' does not contain any signatures\n", fileName->c_str()); exitCode = 2; goto end; } diff --git a/utils/pdftocairo-win32.cc b/utils/pdftocairo-win32.cc index b5e1e4f7..8918daff 100644 --- a/utils/pdftocairo-win32.cc +++ b/utils/pdftocairo-win32.cc @@ -67,7 +67,7 @@ static void parseSource(GooString *source) } option++; } - fprintf(stderr, "Warning: Unknown paper source \"%s\"\n", source->getCString()); + fprintf(stderr, "Warning: Unknown paper source \"%s\"\n", source->c_str()); } static const Win32Option win32DuplexMode[] = @@ -89,7 +89,7 @@ static void parseDuplex(GooString *mode) } option++; } - fprintf(stderr, "Warning: Unknown duplex mode \"%s\"\n", mode->getCString()); + fprintf(stderr, "Warning: Unknown duplex mode \"%s\"\n", mode->c_str()); } static void fillCommonPrinterOptions(bool duplex) @@ -121,7 +121,7 @@ static void fillPagePrinterOptions(double w, double h) static void fillPrinterOptions(bool duplex, GooString *printOpt) { //printOpt format is: <opt1>=<val1>,<opt2>=<val2>,... - const char *nextOpt = printOpt->getCString(); + const char *nextOpt = printOpt->c_str(); while (nextOpt && *nextOpt) { const char *comma = strchr(nextOpt, ','); @@ -134,12 +134,12 @@ static void fillPrinterOptions(bool duplex, GooString *printOpt) nextOpt = NULL; } //here opt is "<optN>=<valN> " - const char *equal = strchr(opt.getCString(), '='); + const char *equal = strchr(opt.c_str(), '='); if (!equal) { - fprintf(stderr, "Warning: unknown printer option \"%s\"\n", opt.getCString()); + fprintf(stderr, "Warning: unknown printer option \"%s\"\n", opt.c_str()); continue; } - int iequal = equal - opt.getCString(); + int iequal = equal - opt.c_str(); GooString value(&opt, iequal + 1, opt.getLength() - iequal - 1); opt.del(iequal, opt.getLength() - iequal); //here opt is "<optN>" and value is "<valN>" @@ -152,7 +152,7 @@ static void fillPrinterOptions(bool duplex, GooString *printOpt) else parseDuplex( &value); } else { - fprintf(stderr, "Warning: unknown printer option \"%s\"\n", opt.getCString()); + fprintf(stderr, "Warning: unknown printer option \"%s\"\n", opt.c_str()); } } } @@ -366,13 +366,13 @@ static UINT_PTR CALLBACK printDialogHookProc(HWND hdlg, UINT uiMsg, WPARAM wPara void win32SetupPrinter(GooString *printer, GooString *printOpt, bool duplex, bool setupdlg) { - if (printer->getCString()[0] == 0) { + if (printer->c_str()[0] == 0) { DWORD size = 0; GetDefaultPrinterA(nullptr, &size); printerName = (char*)gmalloc(size); GetDefaultPrinterA(printerName, &size); } else { - printerName = copyString(printer->getCString(), printer->getLength()); + printerName = copyString(printer->c_str(), printer->getLength()); } //Query the size of the DEVMODE struct @@ -487,9 +487,9 @@ cairo_surface_t *win32BeginDocument(GooString *inputFileName, GooString *outputF if (inputFileName->cmp("fd://0") == 0) docinfo.lpszDocName = "pdftocairo <stdin>"; else - docinfo.lpszDocName = inputFileName->getCString(); + docinfo.lpszDocName = inputFileName->c_str(); if (outputFileName) - docinfo.lpszOutput = outputFileName->getCString(); + docinfo.lpszOutput = outputFileName->c_str(); if (StartDocA(hdc, &docinfo) <=0) { fprintf(stderr, "Error: StartDoc failed\n"); exit(99); diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc index be9ff54a..ac7f162d 100644 --- a/utils/pdftocairo.cc +++ b/utils/pdftocairo.cc @@ -318,7 +318,7 @@ static bool parseAntialiasOption() option++; } - fprintf(stderr, "Error: Invalid antialias option \"%s\"\n", antialias.getCString()); + fprintf(stderr, "Error: Invalid antialias option \"%s\"\n", antialias.c_str()); fprintf(stderr, "Valid options are:\n"); option = antialiasOptions; while (option->name) { @@ -331,7 +331,7 @@ static bool parseAntialiasOption() static bool parseJpegOptions() { //jpegOpt format is: <opt1>=<val1>,<opt2>=<val2>,... - const char *nextOpt = jpegOpt.getCString(); + const char *nextOpt = jpegOpt.c_str(); while (nextOpt && *nextOpt) { const char *comma = strchr(nextOpt, ','); @@ -344,22 +344,22 @@ static bool parseJpegOptions() nextOpt = nullptr; } //here opt is "<optN>=<valN> " - const char *equal = strchr(opt.getCString(), '='); + const char *equal = strchr(opt.c_str(), '='); if (!equal) { - fprintf(stderr, "Unknown jpeg option \"%s\"\n", opt.getCString()); + fprintf(stderr, "Unknown jpeg option \"%s\"\n", opt.c_str()); return false; } - int iequal = equal - opt.getCString(); + int iequal = equal - opt.c_str(); GooString value(&opt, iequal + 1, opt.getLength() - iequal - 1); opt.del(iequal, opt.getLength() - iequal); //here opt is "<optN>" and value is "<valN>" if (opt.cmp("quality") == 0) { - if (!isInt(value.getCString())) { + if (!isInt(value.c_str())) { fprintf(stderr, "Invalid jpeg quality\n"); return false; } - jpegQuality = atoi(value.getCString()); + jpegQuality = atoi(value.c_str()); if (jpegQuality < 0 || jpegQuality > 100) { fprintf(stderr, "jpeg quality must be between 0 and 100\n"); return false; @@ -381,7 +381,7 @@ static bool parseJpegOptions() return false; } } else { - fprintf(stderr, "Unknown jpeg option \"%s\"\n", opt.getCString()); + fprintf(stderr, "Unknown jpeg option \"%s\"\n", opt.c_str()); return false; } } @@ -450,10 +450,10 @@ static void writePageImage(GooString *filename) if (filename->cmp("fd://0") == 0) file = stdout; else - file = fopen(filename->getCString(), "wb"); + file = fopen(filename->c_str(), "wb"); if (!file) { - fprintf(stderr, "Error opening output file %s\n", filename->getCString()); + fprintf(stderr, "Error opening output file %s\n", filename->c_str()); exit(2); } @@ -464,7 +464,7 @@ static void writePageImage(GooString *filename) data = cairo_image_surface_get_data(surface); if (!writer->init(file, width, height, x_resolution, y_resolution)) { - fprintf(stderr, "Error writing %s\n", filename->getCString()); + fprintf(stderr, "Error writing %s\n", filename->c_str()); exit(2); } unsigned char *row = (unsigned char *) gmallocn(width, 4); @@ -621,9 +621,9 @@ static void beginDocument(GooString *inputFileName, GooString *outputFileName, d output_file = stdout; else { - output_file = fopen(outputFileName->getCString(), "wb"); + output_file = fopen(outputFileName->c_str(), "wb"); if (!output_file) { - fprintf(stderr, "Error opening output file %s\n", outputFileName->getCString()); + fprintf(stderr, "Error opening output file %s\n", outputFileName->c_str()); exit(2); } } @@ -869,7 +869,7 @@ static GooString *getOutputFileName(GooString *fileName, GooString *outputName) } // strip everything up to last '/' - const char *s = fileName->getCString(); + const char *s = fileName->c_str(); const char *p = strrchr(s, '/'); if (p) { p++; @@ -883,9 +883,9 @@ static GooString *getOutputFileName(GooString *fileName, GooString *outputName) } // remove .pdf extension - p = strrchr(name->getCString(), '.'); + p = strrchr(name->c_str(), '.'); if (p && strcasecmp(p, ".pdf") == 0) { - GooString *name2 = new GooString(name->getCString(), name->getLength() - 4); + GooString *name2 = new GooString(name->c_str(), name->getLength() - 4); delete name; name = name2; } @@ -983,7 +983,7 @@ int main(int argc, char *argv[]) { checkInvalidPrintOption(mono, "-mono"); checkInvalidPrintOption(gray, "-gray"); checkInvalidPrintOption(transp, "-transp"); - checkInvalidPrintOption(icc.getCString()[0], "-icc"); + checkInvalidPrintOption(icc.c_str()[0], "-icc"); checkInvalidPrintOption(singleFile, "-singlefile"); checkInvalidPrintOption(useCropBox, "-cropbox"); checkInvalidPrintOption(scaleTo != 0, "-scale-to"); @@ -1006,7 +1006,7 @@ int main(int argc, char *argv[]) { if (printing) useCropBox = !noCrop; - if (icc.getCString()[0] && !png) { + if (icc.c_str()[0] && !png) { fprintf(stderr, "Error: -icc may only be used with png output.\n"); exit(99); } @@ -1111,10 +1111,10 @@ int main(int argc, char *argv[]) { #ifdef USE_CMS icc_data = nullptr; - if (icc.getCString()[0]) { - FILE *file = fopen(icc.getCString(), "rb"); + if (icc.c_str()[0]) { + FILE *file = fopen(icc.c_str(), "rb"); if (!file) { - fprintf(stderr, "Error: unable to open icc profile %s\n", icc.getCString()); + fprintf(stderr, "Error: unable to open icc profile %s\n", icc.c_str()); exit(4); } fseek (file, 0, SEEK_END); @@ -1122,7 +1122,7 @@ int main(int argc, char *argv[]) { fseek (file, 0, SEEK_SET); icc_data = (unsigned char*)gmalloc(icc_data_size); if (fread(icc_data, icc_data_size, 1, file) != 1) { - fprintf(stderr, "Error: unable to read icc profile %s\n", icc.getCString()); + fprintf(stderr, "Error: unable to read icc profile %s\n", icc.c_str()); exit(4); } fclose(file); diff --git a/utils/pdftohtml.cc b/utils/pdftohtml.cc index ba30b7d1..aa804e8a 100644 --- a/utils/pdftohtml.cc +++ b/utils/pdftohtml.cc @@ -277,16 +277,16 @@ int main(int argc, char *argv[]) { GooString* tmp = new GooString(argv[2]); if (!xml) { if (tmp->getLength() >= 5) { - const char *p = tmp->getCString() + tmp->getLength() - 5; + const char *p = tmp->c_str() + tmp->getLength() - 5; if (!strcmp(p, ".html") || !strcmp(p, ".HTML")) { - htmlFileName = new GooString(tmp->getCString(), tmp->getLength() - 5); + htmlFileName = new GooString(tmp->c_str(), tmp->getLength() - 5); } } } else { if (tmp->getLength() >= 4) { - const char *p = tmp->getCString() + tmp->getLength() - 4; + const char *p = tmp->c_str() + tmp->getLength() - 4; if (!strcmp(p, ".xml") || !strcmp(p, ".XML")) { - htmlFileName = new GooString(tmp->getCString(), tmp->getLength() - 4); + htmlFileName = new GooString(tmp->c_str(), tmp->getLength() - 4); } } } @@ -298,9 +298,9 @@ int main(int argc, char *argv[]) { error(errCommandLine, -1, "You have to provide an output filename when reading form stdin."); goto error; } else { - const char *p = fileName->getCString() + fileName->getLength() - 4; + const char *p = fileName->c_str() + fileName->getLength() - 4; if (!strcmp(p, ".pdf") || !strcmp(p, ".PDF")) - htmlFileName = new GooString(fileName->getCString(), + htmlFileName = new GooString(fileName->c_str(), fileName->getLength() - 4); else htmlFileName = fileName->copy(); @@ -360,12 +360,12 @@ int main(int argc, char *argv[]) { doOutline = doc->getOutline()->getItems() != nullptr; // write text file - htmlOut = new HtmlOutputDev(doc->getCatalog(), htmlFileName->getCString(), - docTitle->getCString(), - author ? author->getCString() : nullptr, - keywords ? keywords->getCString() : nullptr, - subject ? subject->getCString() : nullptr, - date ? date->getCString() : nullptr, + htmlOut = new HtmlOutputDev(doc->getCatalog(), htmlFileName->c_str(), + docTitle->c_str(), + author ? author->c_str() : nullptr, + keywords ? keywords->c_str() : nullptr, + subject ? subject->c_str() : nullptr, + date ? date->c_str() : nullptr, extension, rawOrder, firstPage, @@ -415,9 +415,9 @@ int main(int argc, char *argv[]) { SplashBitmap *bitmap = splashOut->getBitmap(); imgFileName = GooString::format("{0:s}{1:03d}.{2:s}", - htmlFileName->getCString(), pg, extension); + htmlFileName->c_str(), pg, extension); - bitmap->writeImgFile(format, imgFileName->getCString(), + bitmap->writeImgFile(format, imgFileName->c_str(), 72 * scale, 72 * scale); delete imgFileName; @@ -504,7 +504,7 @@ static GooString* getInfoDate(Dict *infoDict, const char *key) { obj = infoDict->lookup(key); if (obj.isString()) { - s = obj.getString()->getCString(); + s = obj.getString()->c_str(); // TODO do something with the timezone info if ( parseDateString( s, &year, &mon, &day, &hour, &min, &sec, &tz, &tz_hour, &tz_minute ) ) { tmStruct.tm_year = year - 1900; diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc index 7c85a241..7d72c8d2 100644 --- a/utils/pdftoppm.cc +++ b/utils/pdftoppm.cc @@ -218,7 +218,7 @@ static const ArgDesc argDesc[] = { static bool parseJpegOptions() { //jpegOpt format is: <opt1>=<val1>,<opt2>=<val2>,... - const char *nextOpt = jpegOpt.getCString(); + const char *nextOpt = jpegOpt.c_str(); while (nextOpt && *nextOpt) { const char *comma = strchr(nextOpt, ','); @@ -231,22 +231,22 @@ static bool parseJpegOptions() nextOpt = nullptr; } //here opt is "<optN>=<valN> " - const char *equal = strchr(opt.getCString(), '='); + const char *equal = strchr(opt.c_str(), '='); if (!equal) { - fprintf(stderr, "Unknown jpeg option \"%s\"\n", opt.getCString()); + fprintf(stderr, "Unknown jpeg option \"%s\"\n", opt.c_str()); return false; } - int iequal = equal - opt.getCString(); + int iequal = equal - opt.c_str(); GooString value(&opt, iequal + 1, opt.getLength() - iequal - 1); opt.del(iequal, opt.getLength() - iequal); //here opt is "<optN>" and value is "<valN>" if (opt.cmp("quality") == 0) { - if (!isInt(value.getCString())) { + if (!isInt(value.c_str())) { fprintf(stderr, "Invalid jpeg quality\n"); return false; } - jpegQuality = atoi(value.getCString()); + jpegQuality = atoi(value.c_str()); if (jpegQuality < 0 || jpegQuality > 100) { fprintf(stderr, "jpeg quality must be between 0 and 100\n"); return false; @@ -268,7 +268,7 @@ static bool parseJpegOptions() return false; } } else { - fprintf(stderr, "Unknown jpeg option \"%s\"\n", opt.getCString()); + fprintf(stderr, "Unknown jpeg option \"%s\"\n", opt.c_str()); return false; } } diff --git a/utils/pdftops.cc b/utils/pdftops.cc index e377b8a6..6c4974e2 100644 --- a/utils/pdftops.cc +++ b/utils/pdftops.cc @@ -351,9 +351,9 @@ int main(int argc, char *argv[]) { error(errCommandLine, -1, "You have to provide an output filename when reading form stdin."); goto err1; } else { - const char *p = fileName->getCString() + fileName->getLength() - 4; + const char *p = fileName->c_str() + fileName->getLength() - 4; if (!strcmp(p, ".pdf") || !strcmp(p, ".PDF")) { - psFileName = new GooString(fileName->getCString(), + psFileName = new GooString(fileName->c_str(), fileName->getLength() - 4); } else { psFileName = fileName->copy(); @@ -386,7 +386,7 @@ int main(int argc, char *argv[]) { } // write PostScript file - psOut = new PSOutputDev(psFileName->getCString(), doc, + psOut = new PSOutputDev(psFileName->c_str(), doc, nullptr, pages, mode, paperWidth, paperHeight, diff --git a/utils/pdftotext.cc b/utils/pdftotext.cc index 6b4d3066..7d79cb94 100644 --- a/utils/pdftotext.cc +++ b/utils/pdftotext.cc @@ -290,9 +290,9 @@ int main(int argc, char *argv[]) { error(errCommandLine, -1, "You have to provide an output filename when reading form stdin."); goto err2; } else { - const char *p = fileName->getCString() + fileName->getLength() - 4; + const char *p = fileName->c_str() + fileName->getLength() - 4; if (!strcmp(p, ".pdf") || !strcmp(p, ".PDF")) { - textFileName = new GooString(fileName->getCString(), + textFileName = new GooString(fileName->c_str(), fileName->getLength() - 4); } else { textFileName = fileName->copy(); @@ -319,7 +319,7 @@ int main(int argc, char *argv[]) { if (!textFileName->cmp("-")) { f = stdout; } else { - if (!(f = fopen(textFileName->getCString(), "wb"))) { + if (!(f = fopen(textFileName->c_str(), "wb"))) { error(errIO, -1, "Couldn't open text file '{0:t}'", textFileName); exitCode = 2; goto err3; @@ -377,7 +377,7 @@ int main(int argc, char *argv[]) { fclose(f); } } else { - textOut = new TextOutputDev(textFileName->getCString(), + textOut = new TextOutputDev(textFileName->c_str(), physLayout, fixedPitch, rawOrder, htmlMeta); if (textOut->isOk()) { if ((w==0) && (h==0) && (x==0) && (y==0)) { @@ -405,7 +405,7 @@ int main(int argc, char *argv[]) { if (!textFileName->cmp("-")) { f = stdout; } else { - if (!(f = fopen(textFileName->getCString(), "ab"))) { + if (!(f = fopen(textFileName->c_str(), "ab"))) { error(errIO, -1, "Couldn't open text file '{0:t}'", textFileName); exitCode = 2; goto err3; @@ -476,7 +476,7 @@ static void printInfoString(FILE *f, Dict *infoDict, const char *key, static void printInfoDate(FILE *f, Dict *infoDict, const char *key, const char *fmt) { Object obj = infoDict->lookup(key); if (obj.isString()) { - const char *s = obj.getString()->getCString(); + const char *s = obj.getString()->c_str(); if (s[0] == 'D' && s[1] == ':') { s += 2; } @@ -500,7 +500,7 @@ static void printLine(FILE *f, TextLine *line) { if (lineYMax < yMax) lineYMax = yMax; GooString *wordText = word->getText(); - const std::string myString = myXmlTokenReplace(wordText->getCString()); + const std::string myString = myXmlTokenReplace(wordText->c_str()); wordXML << " <word xMin=\"" << xMin << "\" yMin=\"" << yMin << "\" xMax=\"" << xMax << "\" yMax=\"" << yMax << "\">" << myString << "</word>\n"; delete wordText; @@ -553,7 +553,7 @@ void printWordBBox(FILE *f, PDFDoc *doc, TextOutputDev *textOut, int first, int for (int i = 0; i < word_length; ++i) { word = wordlist->get(i); word->getBBox(&xMinA, &yMinA, &xMaxA, &yMaxA); - const std::string myString = myXmlTokenReplace(word->getText()->getCString()); + const std::string myString = myXmlTokenReplace(word->getText()->c_str()); fprintf(f," <word xMin=\"%f\" yMin=\"%f\" xMax=\"%f\" yMax=\"%f\">%s</word>\n", xMinA, yMinA, xMaxA, yMaxA, myString.c_str()); } fprintf(f, " </page>\n"); diff --git a/utils/pdfunite.cc b/utils/pdfunite.cc index 47fae977..2373b1ff 100644 --- a/utils/pdfunite.cc +++ b/utils/pdfunite.cc @@ -55,7 +55,7 @@ static void doMergeNameTree(PDFDoc *doc, XRef *srcXRef, XRef *countRef, int oldR Object mvalue = mergeNameArray.arrayGetNF(j + 1); if (mkey.isString() && mvalue.isRef()) { if (mkey.getString()->cmp(key.getString()) < 0) { - newNameArray->add(Object(new GooString(mkey.getString()->getCString()))); + newNameArray->add(Object(new GooString(mkey.getString()->c_str()))); newNameArray->add(Object(mvalue.getRef().num + numOffset, mvalue.getRef().gen)); j += 2; } else if (mkey.getString()->cmp(key.getString()) == 0) { @@ -67,7 +67,7 @@ static void doMergeNameTree(PDFDoc *doc, XRef *srcXRef, XRef *countRef, int oldR j += 2; } } - newNameArray->add(Object(new GooString(key.getString()->getCString()))); + newNameArray->add(Object(new GooString(key.getString()->c_str()))); newNameArray->add(Object(value.getRef().num, value.getRef().gen)); } } @@ -75,7 +75,7 @@ static void doMergeNameTree(PDFDoc *doc, XRef *srcXRef, XRef *countRef, int oldR Object mkey = mergeNameArray.arrayGetNF(j); Object mvalue = mergeNameArray.arrayGetNF(j + 1); if (mkey.isString() && mvalue.isRef()) { - newNameArray->add(Object(new GooString(mkey.getString()->getCString()))); + newNameArray->add(Object(new GooString(mkey.getString()->c_str()))); newNameArray->add(Object(mvalue.getRef().num + numOffset, mvalue.getRef().gen)); } j += 2; @@ -88,7 +88,7 @@ static void doMergeNameTree(PDFDoc *doc, XRef *srcXRef, XRef *countRef, int oldR Object key = mergeNameArray.arrayGetNF(i); Object value = mergeNameArray.arrayGetNF(i + 1); if (key.isString() && value.isRef()) { - newNameArray->add(Object(new GooString(key.getString()->getCString()))); + newNameArray->add(Object(new GooString(key.getString()->c_str()))); newNameArray->add(Object(value.getRef().num + numOffset, value.getRef().gen)); } } @@ -246,7 +246,7 @@ int main (int argc, char *argv[]) if (removeIntent) { intents.arrayRemove(j); error(errSyntaxWarning, -1, "Output intent {0:s} missing in pdf {1:s}, removed", - gidf->getCString(), docs[i]->getFileName()->getCString()); + gidf->c_str(), docs[i]->getFileName()->c_str()); } } else { intents.arrayRemove(j); diff --git a/utils/printencodings.cc b/utils/printencodings.cc index d4d25c73..fa8e20d4 100644 --- a/utils/printencodings.cc +++ b/utils/printencodings.cc @@ -35,7 +35,7 @@ void printEncodings() printf("Available encodings are:\n"); for (int i = 0; i < encNames->getLength(); ++i) { GooString *enc = (GooString*)encNames->get(i); - printf("%s\n", enc->getCString()); + printf("%s\n", enc->c_str()); } delete encNames; |