From 96061155d20dd2eae32d590345f633e7dc6cfb85 Mon Sep 17 00:00:00 2001 From: danblooomberg Date: Tue, 23 Jan 2024 14:39:33 -0800 Subject: [PATCH] Use 4-arg error messages for a few I/O functions * This returns the name of the file that failed to open --- src/gplot.c | 2 +- src/pdfio2.c | 6 ++++-- src/psio2.c | 2 +- version-notes.html | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gplot.c b/src/gplot.c index 3707368d6..d72db9ba3 100644 --- a/src/gplot.c +++ b/src/gplot.c @@ -1250,7 +1250,7 @@ GPLOT *gplot; LEPT_FREE(ylabel); if (!gplot) { fclose(fp); - return (GPLOT *)ERROR_PTR("gplot not made", __func__, NULL); + return (GPLOT *)ERROR_PTR_1("gplot not made", filename, __func__, NULL); } sarrayDestroy(&gplot->cmddata); sarrayDestroy(&gplot->datanames); diff --git a/src/pdfio2.c b/src/pdfio2.c index 32c948310..0a0f2c3f9 100644 --- a/src/pdfio2.c +++ b/src/pdfio2.c @@ -959,7 +959,8 @@ FILE *fp; data85 = encodeAscii85(data, nbytes, &nbytes85); LEPT_FREE(data); if (!data85) - return (L_COMP_DATA *)ERROR_PTR("data85 not made", __func__, NULL); + return (L_COMP_DATA *)ERROR_PTR_1("data85 not made", + fname, __func__, NULL); else data85[nbytes85 - 1] = '\0'; /* remove the newline */ } @@ -1156,7 +1157,8 @@ FILE *fp; data85 = encodeAscii85(datacomp, nbytescomp, &nbytes85); LEPT_FREE(datacomp); if (!data85) - return (L_COMP_DATA *)ERROR_PTR("data85 not made", __func__, NULL); + return (L_COMP_DATA *)ERROR_PTR_1("data85 not made", + fname, __func__, NULL); else data85[nbytes85 - 1] = '\0'; /* remove the newline */ } diff --git a/src/psio2.c b/src/psio2.c index a22313870..65af8000b 100644 --- a/src/psio2.c +++ b/src/psio2.c @@ -1474,7 +1474,7 @@ FILE *fp; for (i = 0; i < npages; i++) { if ((pix = pixReadTiff(filein, i)) == NULL) - return ERROR_INT("pix not made", __func__, 1); + return ERROR_INT_1("pix not made", filein, __func__, 1); pixGetDimensions(pix, &w, &h, NULL); if (w == 1728 && h < w) /* it's a std res fax */ diff --git a/version-notes.html b/version-notes.html index 4a819ad31..7c64683ee 100644 --- a/version-notes.html +++ b/version-notes.html @@ -90,7 +90,7 @@

 
 1.85    not released
-        * Source files changed: gplot.c, partify.c
+        * Source files changed: gplot.c, partify.c, pdfio2.c, psio2.c
 
 1.84.1  Jan 3, 2024
         * Remove support for openjpeg versions < 2.1.