--- texlive-base-20210325/source/configure +++ texlive-base-20210325/source/configure @@ -22090,7 +22090,7 @@ $as_echo_n "checking requested system \` int main () { -GfxFont *gfxFont; gfxFont->decRefCnt(); +GfxFont *gfxFont; gfxFont->getFlags(); ; return 0; } --- texlive-base-20210325/source/texk/web2c/pdftexdir/pdftosrc.cc +++ texlive-base-20210325/source/texk/web2c/pdftexdir/pdftosrc.cc @@ -72,7 +72,7 @@ int main(int argc, char *argv[]) { char *p, buf[1024]; PDFDoc *doc; - GString *fileName; + std::unique_ptr fileName; Stream *s; Object srcStream, srcName, catalogDict; FILE *outfile; @@ -86,9 +86,9 @@ int main(int argc, char *argv[]) "Usage: pdftosrc []\n"); exit(1); } - fileName = new GString(argv[1]); + fileName = std::make_unique(argv[1]); globalParams = std::unique_ptr(new GlobalParams()); - doc = new PDFDoc(fileName); + doc = new PDFDoc(std::move(fileName)); if (!doc->isOk()) { fprintf(stderr, "Invalid PDF file\n"); exit(1); @@ -126,7 +126,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "Not a Stream object\n"); exit(1); } - sprintf(buf, "%s", fileName->c_str()); + sprintf(buf, "%s", argv[1]); if ((p = strrchr(buf, '.')) == 0) p = strchr(buf, 0); if (objgen == 0) @@ -136,7 +136,7 @@ int main(int argc, char *argv[]) outname = buf; } else { // objnum < 0 means we are extracting the XRef table extract_xref_table = true; - sprintf(buf, "%s", fileName->c_str()); + sprintf(buf, "%s", argv[1]); if ((p = strrchr(buf, '.')) == 0) p = strchr(buf, 0); sprintf(p, ".xref"); diff -up texlive-base-20210325/source/texk/web2c/pdftexdir/pdftoepdf.cc.spot texlive-base-20210325/source/texk/web2c/pdftexdir/pdftoepdf.cc --- texlive-base-20210325/source/texk/web2c/pdftexdir/pdftoepdf.cc.spot 2022-08-24 21:21:36.558035301 +0000 +++ texlive-base-20210325/source/texk/web2c/pdftexdir/pdftoepdf.cc 2022-08-24 21:41:04.409172692 +0000 @@ -123,7 +123,7 @@ struct InObj { struct UsedEncoding { int enc_objnum; - GfxFont *font; + std::shared_ptr font; UsedEncoding *next; }; @@ -167,8 +167,8 @@ static PdfDocument *find_add_document(ch p->file_name = xstrdup(file_name); p->xref = xref = 0; p->occurences = 0; - GString *docName = new GString(p->file_name); - p->doc = new PDFDoc(docName); // takes ownership of docName + // GString *docName = new GString(p->file_name); + p->doc = new PDFDoc(std::make_unique(p->file_name)); // takes ownership of docName if (!p->doc->isOk() || !p->doc->okToPrint()) { pdftex_fail("xpdf: reading PDF image failed"); } @@ -204,7 +204,7 @@ static void delete_document(PdfDocument // -------------------------------------------------------------------- -static int addEncoding(GfxFont * gfont) +static int addEncoding(std::shared_ptr gfont) { UsedEncoding *n; n = new UsedEncoding; @@ -395,7 +395,8 @@ static void copyFont(const char *tag, Ob { Object fontdict, subtype, basefont, fontdescRef, fontdesc, charset, stemV; - GfxFont *gfont; + // GfxFont *gfont; + std::shared_ptr gfont; fd_entry *fd; fm_entry *fontmap; // Check whether the font has already been embedded before analysing it. @@ -666,6 +667,7 @@ static void writeEncodings() UsedEncoding *r, *n; char *glyphNames[256], *s; int i; + for (r = encodingList; r != 0; r = r->next) { for (i = 0; i < 256; i++) { if (r->font->isCIDFont()) { @@ -673,7 +675,8 @@ static void writeEncodings() ("PDF inclusion: CID fonts are not supported" " (try to disable font replacement to fix this)"); } - if ((s = (char *) ((Gfx8BitFont *) r->font)->getCharName(i)) != 0) + const GfxFont *const font = r->font.get(); + if ((s = (char *) ((Gfx8BitFont *) font)->getCharName(i)) != 0) glyphNames[i] = s; else glyphNames[i] = notdef; @@ -682,7 +685,7 @@ static void writeEncodings() } for (r = encodingList; r != 0; r = n) { n = r->next; - r->font->decRefCnt(); + // r->font->decRefCnt(); delete r; } }