8 Commits

Author SHA1 Message Date
Michael R Sweet
4f28159e6a Fix the unsupported filter error message (Issue #130) 2025-09-30 19:49:09 -04:00
Michael R Sweet
ef8dee325a Fallthrough attribute is Apple-specific at the moment... 2025-09-25 17:47:31 -04:00
Michael R Sweet
dc09418660 More clang warning fixes. 2025-09-25 17:20:20 -04:00
Michael R Sweet
06d680d6cd Clean up compiler warnings, update Xcode project. 2025-09-25 16:54:55 -04:00
Michael R Sweet
0dd2e6fd37 Mirror EOF fix (Issue #136) 2025-09-13 11:34:41 -04:00
Michael R Sweet
2b6f04a5a1 Fix some Clang warnings. 2025-09-04 14:40:18 -04:00
Michael R Sweet
cc695fef2c Current autoconf triggers the obsolete AC_HEADER_STDC checks, so force things before zlib. 2025-08-30 13:37:28 -04:00
Michael R Sweet
410e3b92ea Add underflow detection to TTF cmap code. 2025-08-27 11:21:16 -04:00
18 changed files with 169 additions and 116 deletions

View File

@@ -2,6 +2,15 @@ Changes in PDFio
================ ================
v1.5.5 - YYYY-MM-DD
-------------------
- Fixed unsupported filter error (Issue #130)
- Fixed EOF comment written to the PDF (Issue #136)
- Fixed TTF cmap underflow error.
- Fixed some Clang warnings.
v1.5.4 - 2025-08-26 v1.5.4 - 2025-08-26
------------------- -------------------

133
configure vendored
View File

@@ -1513,6 +1513,39 @@ fi
} # ac_fn_c_try_compile } # ac_fn_c_try_compile
# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists and can be compiled using the include files in
# INCLUDES, setting the cache variable VAR accordingly.
ac_fn_c_check_header_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
printf %s "checking for $2... " >&6; }
if eval test \${$3+y}
then :
printf %s "(cached) " >&6
else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
#include <$2>
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
eval "$3=yes"
else $as_nop
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
eval ac_res=\$$3
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
printf "%s\n" "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_compile
# ac_fn_c_try_link LINENO # ac_fn_c_try_link LINENO
# ----------------------- # -----------------------
# Try to link conftest.$ac_ext, and return whether this succeeded. # Try to link conftest.$ac_ext, and return whether this succeeded.
@@ -1621,39 +1654,6 @@ printf "%s\n" "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_func } # ac_fn_c_check_func
# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
# -------------------------------------------------------
# Tests whether HEADER exists and can be compiled using the include files in
# INCLUDES, setting the cache variable VAR accordingly.
ac_fn_c_check_header_compile ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
printf %s "checking for $2... " >&6; }
if eval test \${$3+y}
then :
printf %s "(cached) " >&6
else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
#include <$2>
_ACEOF
if ac_fn_c_try_compile "$LINENO"
then :
eval "$3=yes"
else $as_nop
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
eval ac_res=\$$3
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
printf "%s\n" "$ac_res" >&6; }
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_compile
ac_configure_args_raw= ac_configure_args_raw=
for ac_arg for ac_arg
do do
@@ -3940,6 +3940,43 @@ printf "%s\n" "using $INSTALL" >&6; }
ac_header= ac_cache=
for ac_item in $ac_header_c_list
do
if test $ac_cache; then
ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default"
if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then
printf "%s\n" "#define $ac_item 1" >> confdefs.h
fi
ac_header= ac_cache=
elif test $ac_header; then
ac_cache=$ac_item
else
ac_header=$ac_item
fi
done
if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes
then :
printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h
fi
ac_fn_c_check_header_compile "$LINENO" "math.h" "ac_cv_header_math_h" "$ac_includes_default"
if test "x$ac_cv_header_math_h" = xyes
then :
fi
ac_fn_c_check_func "$LINENO" "timegm" "ac_cv_func_timegm" ac_fn_c_check_func "$LINENO" "timegm" "ac_cv_func_timegm"
if test "x$ac_cv_func_timegm" = xyes if test "x$ac_cv_func_timegm" = xyes
then : then :
@@ -4110,35 +4147,6 @@ PKGCONFIG_REQUIRES="zlib"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zlib via pkg-config" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for zlib via pkg-config" >&5
printf %s "checking for zlib via pkg-config... " >&6; } printf %s "checking for zlib via pkg-config... " >&6; }
ac_header= ac_cache=
for ac_item in $ac_header_c_list
do
if test $ac_cache; then
ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default"
if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then
printf "%s\n" "#define $ac_item 1" >> confdefs.h
fi
ac_header= ac_cache=
elif test $ac_header; then
ac_cache=$ac_item
else
ac_header=$ac_item
fi
done
if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes
then :
printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h
fi
if $PKGCONFIG --exists zlib if $PKGCONFIG --exists zlib
then : then :
@@ -4213,7 +4221,6 @@ fi
fi fi
# Check whether --enable-libpng was given. # Check whether --enable-libpng was given.
if test ${enable_libpng+y} if test ${enable_libpng+y}
then : then :

View File

@@ -88,6 +88,10 @@ AC_SUBST([INSTALL])
AC_MSG_RESULT([using $INSTALL]) AC_MSG_RESULT([using $INSTALL])
dnl Standard C stuff...
AC_CHECK_HEADER([math.h])
dnl Check for date/time functionality... dnl Check for date/time functionality...
AC_CHECK_FUNC([timegm], [ AC_CHECK_FUNC([timegm], [
AC_DEFINE([HAVE_TIMEGM], [1], [Do we have the timegm function?]) AC_DEFINE([HAVE_TIMEGM], [1], [Do we have the timegm function?])
@@ -141,7 +145,6 @@ AS_IF([$PKGCONFIG --exists zlib], [
PKGCONFIG_LIBS_PRIVATE="-lz $PKGCONFIG_LIBS_PRIVATE" PKGCONFIG_LIBS_PRIVATE="-lz $PKGCONFIG_LIBS_PRIVATE"
]) ])
dnl libpng... dnl libpng...
AC_ARG_ENABLE([libpng], AS_HELP_STRING([--enable-libpng], [use libpng for pdfioFileCreateImageObjFromFile, default=auto])) AC_ARG_ENABLE([libpng], AS_HELP_STRING([--enable-libpng], [use libpng for pdfioFileCreateImageObjFromFile, default=auto]))

View File

@@ -262,7 +262,7 @@ pdfioArrayCopy(pdfio_file_t *pdf, // I - PDF file
vdst; // Current destination value vdst; // Current destination value
PDFIO_DEBUG("pdfioArrayCopy(pdf=%p, a=%p(%p))\n", pdf, a, a ? a->pdf : NULL); PDFIO_DEBUG("pdfioArrayCopy(pdf=%p, a=%p(%p))\n", (void *)pdf, (void *)a, a ? (void *)a->pdf : NULL);
// Create the new array... // Create the new array...
if ((na = pdfioArrayCreate(pdf)) == NULL) if ((na = pdfioArrayCreate(pdf)) == NULL)
@@ -606,7 +606,7 @@ _pdfioArrayRead(pdfio_file_t *pdf, // I - PDF file
_pdfio_value_t value; // Value _pdfio_value_t value; // Value
PDFIO_DEBUG("_pdfioArrayRead(pdf=%p, tb=%p)\n", pdf, tb); PDFIO_DEBUG("_pdfioArrayRead(pdf=%p, tb=%p)\n", (void *)pdf, (void *)tb);
// Create an array... // Create an array...
if ((array = pdfioArrayCreate(pdf)) == NULL) if ((array = pdfioArrayCreate(pdf)) == NULL)

View File

@@ -27,7 +27,7 @@ bool // O - `true` on sucess, `false` on EOF
_pdfioFileConsume(pdfio_file_t *pdf, // I - PDF file _pdfioFileConsume(pdfio_file_t *pdf, // I - PDF file
size_t bytes) // I - Bytes to consume size_t bytes) // I - Bytes to consume
{ {
PDFIO_DEBUG("_pdfioFileConsume(pdf=%p, bytes=%u)\n", pdf, (unsigned)bytes); PDFIO_DEBUG("_pdfioFileConsume(pdf=%p, bytes=%u)\n", (void *)pdf, (unsigned)bytes);
if ((size_t)(pdf->bufend - pdf->bufptr) > bytes) if ((size_t)(pdf->bufend - pdf->bufptr) > bytes)
pdf->bufptr += bytes; pdf->bufptr += bytes;
@@ -91,7 +91,7 @@ _pdfioFileError(pdfio_file_t *pdf, // I - PDF file
bool // O - `true` on success, `false` on failure bool // O - `true` on success, `false` on failure
_pdfioFileFlush(pdfio_file_t *pdf) // I - PDF file _pdfioFileFlush(pdfio_file_t *pdf) // I - PDF file
{ {
PDFIO_DEBUG("_pdfioFileFlush(pdf=%p)\n", pdf); PDFIO_DEBUG("_pdfioFileFlush(pdf=%p)\n", (void *)pdf);
if (pdf->bufptr > pdf->buffer) if (pdf->bufptr > pdf->buffer)
{ {
@@ -142,7 +142,7 @@ _pdfioFileGets(pdfio_file_t *pdf, // I - PDF file
*bufend = buffer + bufsize - 1; // Pointer to end of buffer *bufend = buffer + bufsize - 1; // Pointer to end of buffer
PDFIO_DEBUG("_pdfioFileGets(pdf=%p, buffer=%p, bufsize=%lu, discard=%s) bufpos=%ld, buffer=%p, bufptr=%p, bufend=%p, offset=%lu\n", pdf, buffer, (unsigned long)bufsize, discard ? "true" : "false", (long)pdf->bufpos, pdf->buffer, pdf->bufptr, pdf->bufend, (unsigned long)(pdf->bufpos + (pdf->bufptr - pdf->buffer))); PDFIO_DEBUG("_pdfioFileGets(pdf=%p, buffer=%p, bufsize=%lu, discard=%s) bufpos=%ld, buffer=%p, bufptr=%p, bufend=%p, offset=%lu\n", (void *)pdf, (void *)buffer, (unsigned long)bufsize, discard ? "true" : "false", (long)pdf->bufpos, (void *)pdf->buffer, (void *)pdf->bufptr, (void *)pdf->bufend, (unsigned long)(pdf->bufpos + (pdf->bufptr - pdf->buffer)));
while (!eol) while (!eol)
{ {
@@ -359,7 +359,7 @@ _pdfioFileSeek(pdfio_file_t *pdf, // I - PDF file
off_t offset, // I - Offset off_t offset, // I - Offset
int whence) // I - Offset base int whence) // I - Offset base
{ {
PDFIO_DEBUG("_pdfioFileSeek(pdf=%p, offset=%ld, whence=%d) pdf->bufpos=%lu\n", pdf, (long)offset, whence, (unsigned long)(pdf ? pdf->bufpos : 0)); PDFIO_DEBUG("_pdfioFileSeek(pdf=%p, offset=%ld, whence=%d) pdf->bufpos=%lu\n", (void *)pdf, (long)offset, whence, (unsigned long)(pdf ? pdf->bufpos : 0));
// Adjust offset for relative seeks... // Adjust offset for relative seeks...
if (whence == SEEK_CUR) if (whence == SEEK_CUR)
@@ -376,7 +376,7 @@ _pdfioFileSeek(pdfio_file_t *pdf, // I - PDF file
// Yes, seek within existing buffer... // Yes, seek within existing buffer...
pdf->bufptr = pdf->buffer + (offset - pdf->bufpos); pdf->bufptr = pdf->buffer + (offset - pdf->bufpos);
PDFIO_DEBUG("_pdfioFileSeek: Seek within buffer, bufpos=%ld.\n", (long)pdf->bufpos); PDFIO_DEBUG("_pdfioFileSeek: Seek within buffer, bufpos=%ld.\n", (long)pdf->bufpos);
PDFIO_DEBUG("_pdfioFileSeek: buffer=%p, bufptr=%p(<%02X%02X...>), bufend=%p\n", pdf->buffer, pdf->bufptr, pdf->bufptr[0] & 255, pdf->bufptr[1] & 255, pdf->bufend); PDFIO_DEBUG("_pdfioFileSeek: buffer=%p, bufptr=%p(<%02X%02X...>), bufend=%p\n", (void *)pdf->buffer, (void *)pdf->bufptr, pdf->bufptr[0] & 255, pdf->bufptr[1] & 255, (void *)pdf->bufend);
return (offset); return (offset);
} }
@@ -411,7 +411,7 @@ _pdfioFileSeek(pdfio_file_t *pdf, // I - PDF file
} }
PDFIO_DEBUG("_pdfioFileSeek: Reset bufpos=%ld, offset=%lu.\n", (long)pdf->bufpos, (unsigned long)offset); PDFIO_DEBUG("_pdfioFileSeek: Reset bufpos=%ld, offset=%lu.\n", (long)pdf->bufpos, (unsigned long)offset);
PDFIO_DEBUG("_pdfioFileSeek: buffer=%p, bufptr=%p, bufend=%p\n", pdf->buffer, pdf->bufptr, pdf->bufend); PDFIO_DEBUG("_pdfioFileSeek: buffer=%p, bufptr=%p, bufend=%p\n", (void *)pdf->buffer, (void *)pdf->bufptr, (void *)pdf->bufend);
pdf->bufpos = offset; pdf->bufpos = offset;

View File

@@ -355,7 +355,7 @@ pdfioArrayCreateColorFromPrimaries(
double matrix[3][3]; // CIE XYZ transform matrix double matrix[3][3]; // CIE XYZ transform matrix
PDFIO_DEBUG("pdfioFileCreateCalibratedColorFromPrimaries(pdf=%p, num_colors=%lu, gamma=%.6f, wx=%.6f, wy=%.6f, rx=%.6f, ry=%.6f, gx=%.6f, gy=%.6f, bx=%.6f, by=%.6f)\n", pdf, (unsigned long)num_colors, gamma, wx, wy, rx, ry, gx, gy, bx, by); PDFIO_DEBUG("pdfioFileCreateCalibratedColorFromPrimaries(pdf=%p, num_colors=%lu, gamma=%.6f, wx=%.6f, wy=%.6f, rx=%.6f, ry=%.6f, gx=%.6f, gy=%.6f, bx=%.6f, by=%.6f)\n", (void *)pdf, (unsigned long)num_colors, gamma, wx, wy, rx, ry, gx, gy, bx, by);
// Range check input... // Range check input...
if (!pdf || (num_colors != 1 && num_colors != 3) || gamma <= 0.0 || ry == 0.0 || gy == 0.0 || by == 0.0) if (!pdf || (num_colors != 1 && num_colors != 3) || gamma <= 0.0 || ry == 0.0 || gy == 0.0 || by == 0.0)
@@ -2580,9 +2580,14 @@ copy_jpeg(pdfio_dict_t *dict, // I - Dictionary
// Expand our ICC buffer... // Expand our ICC buffer...
if ((icc_temp = realloc(icc_data, icc_datalen + length)) == NULL) if ((icc_temp = realloc(icc_data, icc_datalen + length)) == NULL)
{
free(icc_data);
return (NULL); return (NULL);
}
else else
{
icc_data = icc_temp; icc_data = icc_temp;
}
// Read the chunk into the ICC buffer... // Read the chunk into the ICC buffer...
do do

View File

@@ -411,7 +411,7 @@ _pdfioCryptoMakeReader(
uint8_t digest[16]; // MD5 digest value uint8_t digest[16]; // MD5 digest value
PDFIO_DEBUG("_pdfioCryptoMakeReader(pdf=%p, obj=%p(%d), ctx=%p, iv=%p, ivlen=%p(%d))\n", pdf, obj, (int)obj->number, ctx, iv, ivlen, (int)*ivlen); PDFIO_DEBUG("_pdfioCryptoMakeReader(pdf=%p, obj=%p(%d), ctx=%p, iv=%p, ivlen=%p(%d))\n", (void *)pdf, (void *)obj, (int)obj->number, (void *)ctx, (void *)iv, (void *)ivlen, (int)*ivlen);
// Range check input... // Range check input...
if (!pdf) if (!pdf)
@@ -454,6 +454,10 @@ _pdfioCryptoMakeReader(
return (NULL); return (NULL);
} }
#ifdef __APPLE__
__attribute__((fallthrough));
#endif // __APPLE__
case PDFIO_ENCRYPTION_RC4_128 : case PDFIO_ENCRYPTION_RC4_128 :
// Copy the key data for the MD5 hash. // Copy the key data for the MD5 hash.
memcpy(data, pdf->file_key, 16); memcpy(data, pdf->file_key, 16);
@@ -504,7 +508,7 @@ _pdfioCryptoMakeWriter(
uint8_t digest[16]; /* MD5 digest value */ uint8_t digest[16]; /* MD5 digest value */
PDFIO_DEBUG("_pdfioCryptoMakeWriter(pdf=%p, obj=%p(%d), ctx=%p, iv=%p, ivlen=%p(%d))\n", pdf, obj, (int)obj->number, ctx, iv, ivlen, (int)*ivlen); PDFIO_DEBUG("_pdfioCryptoMakeWriter(pdf=%p, obj=%p(%d), ctx=%p, iv=%p, ivlen=%p(%d))\n", (void *)pdf, (void *)obj, (int)obj->number, (void *)ctx, (void *)iv, (void *)ivlen, (int)*ivlen);
// Range check input... // Range check input...
if (!pdf) if (!pdf)

View File

@@ -32,7 +32,7 @@ pdfioDictClear(pdfio_dict_t *dict, // I - Dictionary
pkey; // Search key pkey; // Search key
PDFIO_DEBUG("pdfioDictClear(dict=%p, key=\"%s\")\n", dict, key); PDFIO_DEBUG("pdfioDictClear(dict=%p, key=\"%s\")\n", (void *)dict, key);
if (!dict || !key) if (!dict || !key)
return (false); return (false);
@@ -77,7 +77,7 @@ pdfioDictCopy(pdfio_file_t *pdf, // I - PDF file
_pdfio_value_t v; // Current destination value _pdfio_value_t v; // Current destination value
PDFIO_DEBUG("pdfioDictCopy(pdf=%p, dict=%p(%p))\n", pdf, dict, dict ? dict->pdf : NULL); PDFIO_DEBUG("pdfioDictCopy(pdf=%p, dict=%p(%p))\n", (void *)pdf, (void *)dict, dict ? (void *)dict->pdf : NULL);
// Create the new dictionary... // Create the new dictionary...
if ((ndict = pdfioDictCreate(pdf)) == NULL) if ((ndict = pdfioDictCreate(pdf)) == NULL)
@@ -525,7 +525,7 @@ _pdfioDictGetValue(pdfio_dict_t *dict, // I - Dictionary
*match; // Matching key pair *match; // Matching key pair
PDFIO_DEBUG("_pdfioDictGetValue(dict=%p, key=\"%s\")\n", dict, key); PDFIO_DEBUG("_pdfioDictGetValue(dict=%p, key=\"%s\")\n", (void *)dict, key);
if (!dict || !dict->num_pairs || !key) if (!dict || !dict->num_pairs || !key)
{ {
@@ -610,7 +610,7 @@ _pdfioDictRead(pdfio_file_t *pdf, // I - PDF file
_pdfio_value_t value; // Dictionary value _pdfio_value_t value; // Dictionary value
PDFIO_DEBUG("_pdfioDictRead(pdf=%p, obj=%p, tb=%p, depth=%lu)\n", pdf, obj, tb, (unsigned long)depth); PDFIO_DEBUG("_pdfioDictRead(pdf=%p, obj=%p, tb=%p, depth=%lu)\n", (void *)pdf, (void *)obj, (void *)tb, (unsigned long)depth);
// Create a dictionary and start reading... // Create a dictionary and start reading...
if ((dict = pdfioDictCreate(pdf)) == NULL) if ((dict = pdfioDictCreate(pdf)) == NULL)
@@ -984,7 +984,7 @@ _pdfioDictSetValue(
_pdfio_pair_t *pair; // Current pair _pdfio_pair_t *pair; // Current pair
PDFIO_DEBUG("_pdfioDictSetValue(dict=%p, key=\"%s\", value=%p)\n", dict, key, (void *)value); PDFIO_DEBUG("_pdfioDictSetValue(dict=%p, key=\"%s\", value=%p)\n", (void *)dict, key, (void *)value);
// See if the key is already set... // See if the key is already set...
if (dict->num_pairs > 0) if (dict->num_pairs > 0)

View File

@@ -720,7 +720,7 @@ pdfioFileFindObj(
if (number == pdf->objs[current]->number) if (number == pdf->objs[current]->number)
{ {
// Fast match... // Fast match...
PDFIO_DEBUG("pdfioFileFindObj: Returning %lu (%p)\n", (unsigned long)current, pdf->objs[current]); PDFIO_DEBUG("pdfioFileFindObj: Returning %lu (%p)\n", (unsigned long)current, (void *)pdf->objs[current]);
return (pdf->objs[current]); return (pdf->objs[current]);
} }
else if (number < pdf->objs[current]->number) else if (number < pdf->objs[current]->number)
@@ -748,12 +748,12 @@ pdfioFileFindObj(
if (number == pdf->objs[left]->number) if (number == pdf->objs[left]->number)
{ {
PDFIO_DEBUG("pdfioFileFindObj: Returning %lu (%p)\n", (unsigned long)left, pdf->objs[left]); PDFIO_DEBUG("pdfioFileFindObj: Returning %lu (%p)\n", (unsigned long)left, (void *)pdf->objs[left]);
return (pdf->objs[left]); return (pdf->objs[left]);
} }
else if (number == pdf->objs[right]->number) else if (number == pdf->objs[right]->number)
{ {
PDFIO_DEBUG("pdfioFileFindObj: Returning %lu (%p)\n", (unsigned long)right, pdf->objs[right]); PDFIO_DEBUG("pdfioFileFindObj: Returning %lu (%p)\n", (unsigned long)right, (void *)pdf->objs[right]);
return (pdf->objs[right]); return (pdf->objs[right]);
} }
else else
@@ -1082,7 +1082,7 @@ pdfioFileOpen(
pdf->version = strdup(line + 5); pdf->version = strdup(line + 5);
// Grab the last 1k of the file to find the start of the xref table... // Grab the last 1k of the file to find the start of the xref table...
if (_pdfioFileSeek(pdf, 1 - sizeof(line), SEEK_END) < 0) if (_pdfioFileSeek(pdf, 1 - (int)sizeof(line), SEEK_END) < 0)
{ {
_pdfioFileError(pdf, "Unable to read startxref data."); _pdfioFileError(pdf, "Unable to read startxref data.");
goto error; goto error;
@@ -1115,7 +1115,7 @@ pdfioFileOpen(
} }
else else
{ {
PDFIO_DEBUG("pdfioFileOpen: line=%p,ptr=%p(\"%s\")\n", line, ptr, ptr); PDFIO_DEBUG("pdfioFileOpen: line=%p,ptr=%p(\"%s\")\n", (void *)line, (void *)ptr, ptr);
xref_offset = (off_t)strtol(ptr + 9, NULL, 10); xref_offset = (off_t)strtol(ptr + 9, NULL, 10);
@@ -1326,7 +1326,7 @@ add_obj(pdfio_file_t *pdf, // I - PDF file
obj->generation = generation; obj->generation = generation;
obj->offset = offset; obj->offset = offset;
PDFIO_DEBUG("add_obj: obj=%p, ->pdf=%p, ->number=%lu, ->offset=%lu\n", obj, pdf, (unsigned long)obj->number, (unsigned long)offset); PDFIO_DEBUG("add_obj: obj=%p, ->pdf=%p, ->number=%lu, ->offset=%lu\n", (void *)obj, (void *)pdf, (unsigned long)obj->number, (unsigned long)offset);
// Insert object into array as needed... // Insert object into array as needed...
if (pdf->num_objs == 0 || obj->number > pdf->objs[pdf->num_objs - 1]->number) if (pdf->num_objs == 0 || obj->number > pdf->objs[pdf->num_objs - 1]->number)
@@ -1596,7 +1596,7 @@ get_lconv(void)
if ((loc = localeconv()) != NULL) if ((loc = localeconv()) != NULL)
{ {
PDFIO_DEBUG("get_lconv: loc=%p, loc->decimal_point=\"%s\"\n", loc, loc->decimal_point); PDFIO_DEBUG("get_lconv: loc=%p, loc->decimal_point=\"%s\"\n", (void *)loc, loc->decimal_point);
if (!loc->decimal_point || !strcmp(loc->decimal_point, ".")) if (!loc->decimal_point || !strcmp(loc->decimal_point, "."))
loc = NULL; loc = NULL;
@@ -1633,7 +1633,7 @@ load_obj_stream(pdfio_obj_t *obj) // I - Object to load
int count; // Count of objects int count; // Count of objects
PDFIO_DEBUG("load_obj_stream(obj=%p(%d))\n", obj, (int)obj->number); PDFIO_DEBUG("load_obj_stream(obj=%p(%d))\n", (void *)obj, (int)obj->number);
// Open the object stream... // Open the object stream...
if ((st = pdfioObjOpenStream(obj, true)) == NULL) if ((st = pdfioObjOpenStream(obj, true)) == NULL)
@@ -1900,7 +1900,7 @@ load_xref(
goto repair; goto repair;
} }
PDFIO_DEBUG("load_xref: tb.bufptr=%p, tb.bufend=%p, tb.bufptr[0]=0x%02x, tb.bufptr[0]=0x%02x\n", tb.bufptr, tb.bufend, tb.bufptr[0], tb.bufptr[1]); PDFIO_DEBUG("load_xref: tb.bufptr=%p, tb.bufend=%p, tb.bufptr[0]=0x%02x, tb.bufptr[0]=0x%02x\n", (void *)tb.bufptr, (void *)tb.bufend, tb.bufptr[0], tb.bufptr[1]);
if (tb.bufptr && tb.bufptr < tb.bufend && (tb.bufptr[0] == 0x0d || tb.bufptr[0] == 0x0a)) if (tb.bufptr && tb.bufptr < tb.bufend && (tb.bufptr[0] == 0x0d || tb.bufptr[0] == 0x0a))
tb.bufptr ++; // Skip trailing CR or LF after token tb.bufptr ++; // Skip trailing CR or LF after token
@@ -2093,7 +2093,7 @@ load_xref(
{ {
if ((obj = pdfioFileFindObj(pdf, sobjs[i])) != NULL) if ((obj = pdfioFileFindObj(pdf, sobjs[i])) != NULL)
{ {
PDFIO_DEBUG("load_xref: Loading compressed object stream %lu (pdf=%p, obj->pdf=%p).\n", (unsigned long)sobjs[i], pdf, obj->pdf); PDFIO_DEBUG("load_xref: Loading compressed object stream %lu (pdf=%p, obj->pdf=%p).\n", (unsigned long)sobjs[i], (void *)pdf, (void *)obj->pdf);
if (!load_obj_stream(obj)) if (!load_obj_stream(obj))
return (false); return (false);
@@ -2272,7 +2272,7 @@ load_xref(
goto repair; goto repair;
} }
PDFIO_DEBUG("load_xref: Root=%p(%lu)\n", pdf->root_obj, (unsigned long)pdf->root_obj->number); PDFIO_DEBUG("load_xref: Root=%p(%lu)\n", (void *)pdf->root_obj, (unsigned long)pdf->root_obj->number);
if ((pages_obj = pdfioDictGetObj(pdfioObjGetDict(pdf->root_obj), "Pages")) == NULL) if ((pages_obj = pdfioDictGetObj(pdfioObjGetDict(pdf->root_obj), "Pages")) == NULL)
{ {
@@ -2280,7 +2280,7 @@ load_xref(
goto repair; goto repair;
} }
PDFIO_DEBUG("load_xref: Pages=%p(%lu)\n", pdf->root_obj, (unsigned long)pdf->root_obj->number); PDFIO_DEBUG("load_xref: Pages=%p(%lu)\n", (void *)pages_obj, (unsigned long)pages_obj->number);
return (load_pages(pdf, pages_obj, 0)); return (load_pages(pdf, pages_obj, 0));
@@ -2494,7 +2494,7 @@ repair_xref(
return (false); return (false);
} }
PDFIO_DEBUG("repair_xref: Root=%p(%lu)\n", pdf->root_obj, (unsigned long)pdf->root_obj->number); PDFIO_DEBUG("repair_xref: Root=%p(%lu)\n", (void *)pdf->root_obj, (unsigned long)pdf->root_obj->number);
if ((pages_obj = pdfioDictGetObj(pdfioObjGetDict(pdf->root_obj), "Pages")) == NULL) if ((pages_obj = pdfioDictGetObj(pdfioObjGetDict(pdf->root_obj), "Pages")) == NULL)
{ {
@@ -2502,7 +2502,7 @@ repair_xref(
return (false); return (false);
} }
PDFIO_DEBUG("repair_xref: Pages=%p(%lu)\n", pages_obj, (unsigned long)pages_obj->number); PDFIO_DEBUG("repair_xref: Pages=%p(%lu)\n", (void *)pages_obj, (unsigned long)pages_obj->number);
// Load pages... // Load pages...
return (load_pages(pdf, pages_obj, 0)); return (load_pages(pdf, pages_obj, 0));
@@ -2632,7 +2632,7 @@ write_trailer(pdfio_file_t *pdf) // I - PDF file
// Write the "free" 0 object... // Write the "free" 0 object...
memset(buffer, 0, sizeof(buffer)); memset(buffer, 0, sizeof(buffer));
pdfioStreamWrite(xref_st, buffer, offsize + 2); pdfioStreamWrite(xref_st, buffer, (size_t)offsize + 2);
// Then write the "allocated" objects... // Then write the "allocated" objects...
buffer[0] = 1; buffer[0] = 1;
@@ -2702,7 +2702,7 @@ write_trailer(pdfio_file_t *pdf) // I - PDF file
#endif // !_WIN32 #endif // !_WIN32
} }
if (!pdfioStreamWrite(xref_st, buffer, offsize + 2)) if (!pdfioStreamWrite(xref_st, buffer, (size_t)offsize + 2))
{ {
_pdfioFileError(pdf, "Unable to write cross-reference table."); _pdfioFileError(pdf, "Unable to write cross-reference table.");
ret = false; ret = false;
@@ -2767,7 +2767,7 @@ write_trailer(pdfio_file_t *pdf) // I - PDF file
} }
} }
if (!_pdfioFilePrintf(pdf, "\nstartxref\n%lu\n%%EOF\n", (unsigned long)xref_offset)) if (!_pdfioFilePrintf(pdf, "\nstartxref\n%lu\n%%%%EOF\n", (unsigned long)xref_offset))
{ {
_pdfioFileError(pdf, "Unable to write xref offset."); _pdfioFileError(pdf, "Unable to write xref offset.");
ret = false; ret = false;

View File

@@ -69,7 +69,7 @@ pdfioObjCopy(pdfio_file_t *pdf, // I - PDF file
ssize_t bytes; // Bytes read ssize_t bytes; // Bytes read
PDFIO_DEBUG("pdfioObjCopy(pdf=%p, srcobj=%p(%p))\n", pdf, srcobj, srcobj ? srcobj->pdf : NULL); PDFIO_DEBUG("pdfioObjCopy(pdf=%p, srcobj=%p(%p))\n", (void *)pdf, (void *)srcobj, srcobj ? (void *)srcobj->pdf : NULL);
// Range check input // Range check input
if (!pdf || !srcobj) if (!pdf || !srcobj)
@@ -308,7 +308,7 @@ pdfioObjGetLength(pdfio_obj_t *obj) // I - Object
// Try getting the length, directly or indirectly // Try getting the length, directly or indirectly
if ((length = (size_t)pdfioDictGetNumber(obj->value.value.dict, "Length")) > 0) if ((length = (size_t)pdfioDictGetNumber(obj->value.value.dict, "Length")) > 0)
{ {
PDFIO_DEBUG("pdfioObjGetLength(obj=%p) returning %lu.\n", obj, (unsigned long)length); PDFIO_DEBUG("pdfioObjGetLength(obj=%p) returning %lu.\n", (void *)obj, (unsigned long)length);
return (length); return (length);
} }
@@ -328,7 +328,7 @@ pdfioObjGetLength(pdfio_obj_t *obj) // I - Object
return (0); return (0);
} }
PDFIO_DEBUG("pdfioObjGetLength(obj=%p) returning %lu.\n", obj, (unsigned long)lenobj->value.value.number); PDFIO_DEBUG("pdfioObjGetLength(obj=%p) returning %lu.\n", (void *)obj, (unsigned long)lenobj->value.value.number);
return ((size_t)lenobj->value.value.number); return ((size_t)lenobj->value.value.number);
} }
@@ -440,7 +440,7 @@ _pdfioObjLoad(pdfio_obj_t *obj) // I - Object
_pdfio_token_t tb; // Token buffer/stack _pdfio_token_t tb; // Token buffer/stack
PDFIO_DEBUG("_pdfioObjLoad(obj=%p(%lu)), offset=%lu\n", obj, (unsigned long)obj->number, (unsigned long)obj->offset); PDFIO_DEBUG("_pdfioObjLoad(obj=%p(%lu)), offset=%lu\n", (void *)obj, (unsigned long)obj->number, (unsigned long)obj->offset);
// Seek to the start of the object and read its header... // Seek to the start of the object and read its header...
if (_pdfioFileSeek(obj->pdf, obj->offset, SEEK_SET) != obj->offset) if (_pdfioFileSeek(obj->pdf, obj->offset, SEEK_SET) != obj->offset)
@@ -502,7 +502,7 @@ _pdfioObjLoad(pdfio_obj_t *obj) // I - Object
return (false); return (false);
} }
PDFIO_DEBUG("_pdfioObjLoad: tb.bufptr=%p, tb.bufend=%p, tb.bufptr[0]=0x%02x, tb.bufptr[1]=0x%02x\n", tb.bufptr, tb.bufend, tb.bufptr[0], tb.bufptr[1]); PDFIO_DEBUG("_pdfioObjLoad: tb.bufptr=%p, tb.bufend=%p, tb.bufptr[0]=0x%02x, tb.bufptr[1]=0x%02x\n", (void *)tb.bufptr, (void *)tb.bufend, tb.bufptr[0], tb.bufptr[1]);
_pdfioTokenFlush(&tb); _pdfioTokenFlush(&tb);

View File

@@ -28,7 +28,7 @@ pdfioPageCopy(pdfio_file_t *pdf, // I - PDF file
pdfio_obj_t *dstpage; // Destination page object pdfio_obj_t *dstpage; // Destination page object
PDFIO_DEBUG("pdfioPageCopy(pdf=%p, srcpage=%p(%p))\n", pdf, srcpage, srcpage ? srcpage->pdf : NULL); PDFIO_DEBUG("pdfioPageCopy(pdf=%p, srcpage=%p(%p))\n", (void *)pdf, (void *)srcpage, srcpage ? (void *)srcpage->pdf : NULL);
// Range check input // Range check input
if (!pdf || !srcpage || srcpage->value.type != PDFIO_VALTYPE_DICT) if (!pdf || !srcpage || srcpage->value.type != PDFIO_VALTYPE_DICT)

View File

@@ -427,7 +427,7 @@ _pdfioStreamOpen(pdfio_obj_t *obj, // I - Object
const char *type; // Object type const char *type; // Object type
PDFIO_DEBUG("_pdfioStreamOpen(obj=%p(%u), decode=%s)\n", obj, (unsigned)obj->number, decode ? "true" : "false"); PDFIO_DEBUG("_pdfioStreamOpen(obj=%p(%u), decode=%s)\n", (void *)obj, (unsigned)obj->number, decode ? "true" : "false");
// Allocate a new stream object... // Allocate a new stream object...
if ((st = (pdfio_stream_t *)calloc(1, sizeof(pdfio_stream_t))) == NULL) if ((st = (pdfio_stream_t *)calloc(1, sizeof(pdfio_stream_t))) == NULL)
@@ -623,7 +623,7 @@ _pdfioStreamOpen(pdfio_obj_t *obj, // I - Object
else else
{ {
// Something else we don't support // Something else we don't support
_pdfioFileError(st->pdf, "Unsupported stream filter '%N'.", filter); _pdfioFileError(st->pdf, "Unsupported stream filter '/%s'.", filter);
goto error; goto error;
} }
} }
@@ -848,7 +848,7 @@ pdfioStreamWrite(
*pptr; // Previous raw buffer *pptr; // Previous raw buffer
PDFIO_DEBUG("pdfioStreamWrite(st=%p, buffer=%p, bytes=%lu)\n", st, buffer, (unsigned long)bytes); PDFIO_DEBUG("pdfioStreamWrite(st=%p, buffer=%p, bytes=%lu)\n", (void *)st, (void *)buffer, (unsigned long)bytes);
// Range check input... // Range check input...
if (!st || st->pdf->mode != _PDFIO_MODE_WRITE || !buffer || !bytes) if (!st || st->pdf->mode != _PDFIO_MODE_WRITE || !buffer || !bytes)

View File

@@ -723,7 +723,7 @@ pdfioStringCreate(
int diff; // Different int diff; // Different
PDFIO_DEBUG("pdfioStringCreate(pdf=%p, s=\"%s\")\n", pdf, s); PDFIO_DEBUG("pdfioStringCreate(pdf=%p, s=\"%s\")\n", (void *)pdf, s);
// Range check input... // Range check input...
if (!pdf || !s) if (!pdf || !s)

View File

@@ -54,7 +54,7 @@ static int get_char(_pdfio_token_t *tb);
void void
_pdfioTokenClear(_pdfio_token_t *tb) // I - Token buffer/stack _pdfioTokenClear(_pdfio_token_t *tb) // I - Token buffer/stack
{ {
PDFIO_DEBUG("_pdfioTokenClear(tb=%p)\n", tb); PDFIO_DEBUG("_pdfioTokenClear(tb=%p)\n", (void *)tb);
while (tb->num_tokens > 0) while (tb->num_tokens > 0)
{ {
@@ -132,7 +132,7 @@ _pdfioTokenGet(_pdfio_token_t *tb, // I - Token buffer/stack
if ((len = strlen(tb->tokens[tb->num_tokens])) > (bufsize - 1)) if ((len = strlen(tb->tokens[tb->num_tokens])) > (bufsize - 1))
{ {
// Value too large... // Value too large...
PDFIO_DEBUG("_pdfioTokenGet(tb=%p, buffer=%p, bufsize=%u): Token '%s' from stack too large.\n", tb, buffer, (unsigned)bufsize, tb->tokens[tb->num_tokens]); PDFIO_DEBUG("_pdfioTokenGet(tb=%p, buffer=%p, bufsize=%u): Token '%s' from stack too large.\n", (void *)tb, (void *)buffer, (unsigned)bufsize, tb->tokens[tb->num_tokens]);
*buffer = '\0'; *buffer = '\0';
return (false); return (false);
} }
@@ -140,7 +140,7 @@ _pdfioTokenGet(_pdfio_token_t *tb, // I - Token buffer/stack
memcpy(buffer, tb->tokens[tb->num_tokens], len); memcpy(buffer, tb->tokens[tb->num_tokens], len);
buffer[len] = '\0'; buffer[len] = '\0';
PDFIO_DEBUG("_pdfioTokenGet(tb=%p, buffer=%p, bufsize=%u): Popping '%s' from stack.\n", tb, buffer, (unsigned)bufsize, buffer); PDFIO_DEBUG("_pdfioTokenGet(tb=%p, buffer=%p, bufsize=%u): Popping '%s' from stack.\n", (void *)tb, (void *)buffer, (unsigned)bufsize, buffer);
free(tb->tokens[tb->num_tokens]); free(tb->tokens[tb->num_tokens]);
tb->tokens[tb->num_tokens] = NULL; tb->tokens[tb->num_tokens] = NULL;

View File

@@ -46,7 +46,7 @@ _pdfioValueCopy(pdfio_file_t *pdfdst, // I - Destination PDF file
#endif // DEBUG #endif // DEBUG
PDFIO_DEBUG("_pdfioValueCopy(pdfdst=%p, vdst=%p, pdfsrc=%p, vsrc=%p(%s))\n", pdfdst, vdst, pdfsrc, vsrc, types[vsrc->type]); PDFIO_DEBUG("_pdfioValueCopy(pdfdst=%p, vdst=%p, pdfsrc=%p, vsrc=%p(%s))\n", (void *)pdfdst, (void *)vdst, (void *)pdfsrc, (void *)vsrc, types[vsrc->type]);
if (pdfdst == pdfsrc && vsrc->type != PDFIO_VALTYPE_BINARY) if (pdfdst == pdfsrc && vsrc->type != PDFIO_VALTYPE_BINARY)
{ {
@@ -359,7 +359,7 @@ _pdfioValueRead(pdfio_file_t *pdf, // I - PDF file
#endif // DEBUG #endif // DEBUG
PDFIO_DEBUG("_pdfioValueRead(pdf=%p, obj=%p, v=%p)\n", pdf, obj, v); PDFIO_DEBUG("_pdfioValueRead(pdf=%p, obj=%p, v=%p)\n", (void *)pdf, (void *)obj, (void *)v);
if (!token) if (!token)
goto done; goto done;

View File

@@ -261,7 +261,7 @@
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
BuildIndependentTargetsInParallel = YES; BuildIndependentTargetsInParallel = YES;
LastUpgradeCheck = 1600; LastUpgradeCheck = 2600;
TargetAttributes = { TargetAttributes = {
273440AF263D6FE200FBFD63 = { 273440AF263D6FE200FBFD63 = {
CreatedOnToolsVersion = 12.5; CreatedOnToolsVersion = 12.5;
@@ -409,6 +409,7 @@
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
RUN_CLANG_STATIC_ANALYZER = YES; RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = macosx; SDKROOT = macosx;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };
name = Debug; name = Debug;
@@ -485,6 +486,7 @@
MTL_FAST_MATH = YES; MTL_FAST_MATH = YES;
RUN_CLANG_STATIC_ANALYZER = YES; RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = macosx; SDKROOT = macosx;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };
name = Release; name = Release;
@@ -492,10 +494,15 @@
273440B5263D6FE200FBFD63 /* Debug */ = { 273440B5263D6FE200FBFD63 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_WARN_COMPLETION_HANDLER_MISUSE = YES;
CLANG_WARN_IMPLICIT_FALLTHROUGH = YES;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
DEAD_CODE_STRIPPING = YES; DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = RU58A2256H; DEVELOPMENT_TEAM = RU58A2256H;
EXECUTABLE_PREFIX = lib; EXECUTABLE_PREFIX = lib;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
}; };
@@ -504,10 +511,14 @@
273440B6263D6FE200FBFD63 /* Release */ = { 273440B6263D6FE200FBFD63 /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_WARN_COMPLETION_HANDLER_MISUSE = YES;
CLANG_WARN_IMPLICIT_FALLTHROUGH = YES;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
DEAD_CODE_STRIPPING = YES; DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = RU58A2256H; DEVELOPMENT_TEAM = RU58A2256H;
EXECUTABLE_PREFIX = lib; EXECUTABLE_PREFIX = lib;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
}; };
@@ -516,6 +527,8 @@
273440D5263D72AE00FBFD63 /* Debug */ = { 273440D5263D72AE00FBFD63 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_WARN_COMPLETION_HANDLER_MISUSE = YES;
CLANG_WARN_IMPLICIT_FALLTHROUGH = YES;
CODE_SIGN_IDENTITY = "-"; CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
DEAD_CODE_STRIPPING = YES; DEAD_CODE_STRIPPING = YES;
@@ -523,6 +536,9 @@
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
GCC_DYNAMIC_NO_PIC = NO; GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0; GCC_OPTIMIZATION_LEVEL = 0;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
GCC_WARN_UNKNOWN_PRAGMAS = YES;
MACOSX_DEPLOYMENT_TARGET = 11.0; MACOSX_DEPLOYMENT_TARGET = 11.0;
PRODUCT_BUNDLE_IDENTIFIER = org.msweet.testpdfio; PRODUCT_BUNDLE_IDENTIFIER = org.msweet.testpdfio;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
@@ -533,11 +549,15 @@
273440D6263D72AE00FBFD63 /* Release */ = { 273440D6263D72AE00FBFD63 /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CLANG_WARN_COMPLETION_HANDLER_MISUSE = YES;
CLANG_WARN_IMPLICIT_FALLTHROUGH = YES;
CODE_SIGN_IDENTITY = "-"; CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
DEAD_CODE_STRIPPING = YES; DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = ""; DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
GCC_WARN_UNKNOWN_PRAGMAS = YES;
MACOSX_DEPLOYMENT_TARGET = 11.0; MACOSX_DEPLOYMENT_TARGET = 11.0;
PRODUCT_BUNDLE_IDENTIFIER = org.msweet.testpdfio; PRODUCT_BUNDLE_IDENTIFIER = org.msweet.testpdfio;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";

View File

@@ -485,7 +485,7 @@ do_test_file(const char *filename, // I - PDF filename
{ {
dict = pdfioObjGetDict(obj); dict = pdfioObjGetDict(obj);
printf(" %u %u obj dict=%p(%lu pairs)\n", (unsigned)pdfioObjGetNumber(obj), (unsigned)pdfioObjGetGeneration(obj), dict, dict ? (unsigned long)dict->num_pairs : 0UL); printf(" %u %u obj dict=%p(%lu pairs)\n", (unsigned)pdfioObjGetNumber(obj), (unsigned)pdfioObjGetGeneration(obj), (void *)dict, dict ? (unsigned long)dict->num_pairs : 0UL);
fputs(" ", stdout); fputs(" ", stdout);
_pdfioValueDebug(&obj->value, stdout); _pdfioValueDebug(&obj->value, stdout);
putchar('\n'); putchar('\n');
@@ -3502,9 +3502,14 @@ write_text_test(pdfio_file_t *pdf, // I - PDF file
fputs("pdfioStreamClose: ", stdout); fputs("pdfioStreamClose: ", stdout);
if (pdfioStreamClose(st)) if (pdfioStreamClose(st))
{
puts("PASS"); puts("PASS");
}
else else
{
fclose(fp);
return (1); return (1);
}
} }
fclose(fp); fclose(fp);

4
ttf.c
View File

@@ -338,7 +338,7 @@ ttfCreate(const char *filename, // I - Filename
_ttf_off_post_t post; // PostScript table _ttf_off_post_t post; // PostScript table
TTF_DEBUG("ttfCreate(filename=\"%s\", idx=%u, err_cb=%p, err_data=%p)\n", filename, (unsigned)idx, err_cb, err_data); TTF_DEBUG("ttfCreate(filename=\"%s\", idx=%u, err_cb=%p, err_data=%p)\n", filename, (unsigned)idx, (void *)err_cb, err_data);
// Range check input.. // Range check input..
if (!filename) if (!filename)
@@ -1205,7 +1205,7 @@ read_cmap(ttf_t *font) // I - Font
/* language = */ read_ushort(font); /* language = */ read_ushort(font);
if (length > (256 + 6)) if (length > (256 + 6) || length < 7)
{ {
errorf(font, "Bad cmap table length at offset %u.", coffset); errorf(font, "Bad cmap table length at offset %u.", coffset);
return (false); return (false);