Skip to content

Commit cfe91b4

Browse files
committed
Fix output of special characters in name values (Issue #106)
Fix output of special characters in string values (Issue #107) Fi output of large integers in dictionaries (Issue #108) Bump version to 1.5.1.
1 parent 458f366 commit cfe91b4

13 files changed

+229
-96
lines changed

CHANGES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Changes in PDFio
22
================
33

4+
v1.5.1 - YYYY-MM-DD
5+
-------------------
6+
7+
- Fixed output of special characters in name values (Issue #106)
8+
- Fixed output of special characters in string values (Issue #107)
9+
- Fixed output of large integers in dictionaries (Issue #108)
10+
11+
412
v1.5.0 - 2025-03-06
513
-------------------
614

configure

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.71 for pdfio 1.5.0.
3+
# Generated by GNU Autoconf 2.71 for pdfio 1.5.1.
44
#
55
# Report bugs to <https://github.com/michaelrsweet/pdfio/issues>.
66
#
@@ -610,8 +610,8 @@ MAKEFLAGS=
610610
# Identity of this package.
611611
PACKAGE_NAME='pdfio'
612612
PACKAGE_TARNAME='pdfio'
613-
PACKAGE_VERSION='1.5.0'
614-
PACKAGE_STRING='pdfio 1.5.0'
613+
PACKAGE_VERSION='1.5.1'
614+
PACKAGE_STRING='pdfio 1.5.1'
615615
PACKAGE_BUGREPORT='https://github.com/michaelrsweet/pdfio/issues'
616616
PACKAGE_URL='https://www.msweet.org/pdfio'
617617

@@ -1295,7 +1295,7 @@ if test "$ac_init_help" = "long"; then
12951295
# Omit some internal or obsolete options to make the list less imposing.
12961296
# This message is too long to be a string in the A/UX 3.1 sh.
12971297
cat <<_ACEOF
1298-
\`configure' configures pdfio 1.5.0 to adapt to many kinds of systems.
1298+
\`configure' configures pdfio 1.5.1 to adapt to many kinds of systems.
12991299
13001300
Usage: $0 [OPTION]... [VAR=VALUE]...
13011301
@@ -1361,7 +1361,7 @@ fi
13611361

13621362
if test -n "$ac_init_help"; then
13631363
case $ac_init_help in
1364-
short | recursive ) echo "Configuration of pdfio 1.5.0:";;
1364+
short | recursive ) echo "Configuration of pdfio 1.5.1:";;
13651365
esac
13661366
cat <<\_ACEOF
13671367
@@ -1460,7 +1460,7 @@ fi
14601460
test -n "$ac_init_help" && exit $ac_status
14611461
if $ac_init_version; then
14621462
cat <<\_ACEOF
1463-
pdfio configure 1.5.0
1463+
pdfio configure 1.5.1
14641464
generated by GNU Autoconf 2.71
14651465
14661466
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -1616,7 +1616,7 @@ cat >config.log <<_ACEOF
16161616
This file contains any messages produced by compilers while
16171617
running configure, to aid debugging if configure makes a mistake.
16181618
1619-
It was created by pdfio $as_me 1.5.0, which was
1619+
It was created by pdfio $as_me 1.5.1, which was
16201620
generated by GNU Autoconf 2.71. Invocation command line was
16211621
16221622
$ $0$ac_configure_args_raw
@@ -2372,9 +2372,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
23722372
23732373
23742374
2375-
PDFIO_VERSION="1.5.0"
2376-
PDFIO_VERSION_MAJOR="`echo 1.5.0 | awk -F. '{print $1}'`"
2377-
PDFIO_VERSION_MINOR="`echo 1.5.0 | awk -F. '{printf("%d\n",$2);}'`"
2375+
PDFIO_VERSION="1.5.1"
2376+
PDFIO_VERSION_MAJOR="`echo 1.5.1 | awk -F. '{print $1}'`"
2377+
PDFIO_VERSION_MINOR="`echo 1.5.1 | awk -F. '{printf("%d\n",$2);}'`"
23782378
23792379
23802380
@@ -4988,7 +4988,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
49884988
# report actual input values of CONFIG_FILES etc. instead of their
49894989
# values after options handling.
49904990
ac_log="
4991-
This file was extended by pdfio $as_me 1.5.0, which was
4991+
This file was extended by pdfio $as_me 1.5.1, which was
49924992
generated by GNU Autoconf 2.71. Invocation command line was
49934993
49944994
CONFIG_FILES = $CONFIG_FILES
@@ -5044,7 +5044,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
50445044
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
50455045
ac_cs_config='$ac_cs_config_escaped'
50465046
ac_cs_version="\\
5047-
pdfio config.status 1.5.0
5047+
pdfio config.status 1.5.1
50485048
configured by $0, generated by GNU Autoconf 2.71,
50495049
with options \\"\$ac_cs_config\\"
50505050

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ AC_PREREQ([2.70])
2121

2222

2323
dnl Package name and version...
24-
AC_INIT([pdfio], [1.5.0], [https://github.com/michaelrsweet/pdfio/issues], [pdfio], [https://www.msweet.org/pdfio])
24+
AC_INIT([pdfio], [1.5.1], [https://github.com/michaelrsweet/pdfio/issues], [pdfio], [https://www.msweet.org/pdfio])
2525

2626
PDFIO_VERSION="AC_PACKAGE_VERSION"
2727
PDFIO_VERSION_MAJOR="`echo AC_PACKAGE_VERSION | awk -F. '{print $1}'`"

pdfio-content.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ pdfioContentDrawImage(
476476
double width, // I - Width of image
477477
double height) // I - Height of image
478478
{
479-
return (pdfioStreamPrintf(st, "q %.6f 0 0 %.6f %.6f %.6f cm/%s Do Q\n", width, height, x, y, name));
479+
return (pdfioStreamPrintf(st, "q %.6f 0 0 %.6f %.6f %.6f cm%N Do Q\n", width, height, x, y, name));
480480
}
481481

482482

@@ -811,7 +811,7 @@ pdfioContentSetFillColorSpace(
811811
pdfio_stream_t *st, // I - Stream
812812
const char *name) // I - Color space name
813813
{
814-
return (pdfioStreamPrintf(st, "/%s cs\n", name));
814+
return (pdfioStreamPrintf(st, "%N cs\n", name));
815815
}
816816

817817

@@ -961,7 +961,7 @@ pdfioContentSetStrokeColorSpace(
961961
pdfio_stream_t *st, // I - Stream
962962
const char *name) // I - Color space name
963963
{
964-
return (pdfioStreamPrintf(st, "/%s CS\n", name));
964+
return (pdfioStreamPrintf(st, "%N CS\n", name));
965965
}
966966

967967

@@ -988,7 +988,7 @@ pdfioContentSetTextFont(
988988
const char *name, // I - Font name
989989
double size) // I - Font size
990990
{
991-
return (pdfioStreamPrintf(st, "/%s %.6f Tf\n", name, size));
991+
return (pdfioStreamPrintf(st, "%N %.6f Tf\n", name, size));
992992
}
993993

994994

pdfio-content.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ extern bool pdfioContentTextMoveLine(pdfio_stream_t *st, double tx, double ty)
120120
extern bool pdfioContentTextMoveTo(pdfio_stream_t *st, double tx, double ty) _PDFIO_PUBLIC;
121121
extern bool pdfioContentTextNewLine(pdfio_stream_t *st) _PDFIO_PUBLIC;
122122
extern bool pdfioContentTextNewLineShow(pdfio_stream_t *st, double ws, double cs, bool unicode, const char *s) _PDFIO_PUBLIC;
123-
extern bool pdfioContentTextNewLineShowf(pdfio_stream_t *st, double ws, double cs, bool unicode, const char *format, ...) _PDFIO_PUBLIC _PDFIO_FORMAT(5,6);
123+
extern bool pdfioContentTextNewLineShowf(pdfio_stream_t *st, double ws, double cs, bool unicode, const char *format, ...) _PDFIO_PUBLIC;
124124
extern bool pdfioContentTextNextLine(pdfio_stream_t *st) _PDFIO_PUBLIC;
125125
extern bool pdfioContentTextShow(pdfio_stream_t *st, bool unicode, const char *s) _PDFIO_PUBLIC;
126-
extern bool pdfioContentTextShowf(pdfio_stream_t *st, bool unicode, const char *format, ...) _PDFIO_PUBLIC _PDFIO_FORMAT(3,4);
126+
extern bool pdfioContentTextShowf(pdfio_stream_t *st, bool unicode, const char *format, ...) _PDFIO_PUBLIC;
127127
extern bool pdfioContentTextShowJustified(pdfio_stream_t *st, bool unicode, size_t num_fragments, const double *offsets, const char * const *fragments) _PDFIO_PUBLIC;
128128

129129
// Resource helpers...

pdfio-dict.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// PDF dictionary functions for PDFio.
33
//
4-
// Copyright © 2021-2024 by Michael R Sweet.
4+
// Copyright © 2021-2025 by Michael R Sweet.
55
//
66
// Licensed under Apache License v2.0. See the file "LICENSE" for more
77
// information.
@@ -1168,7 +1168,7 @@ _pdfioDictWrite(pdfio_dict_t *dict, // I - Dictionary
11681168
// Write all of the key/value pairs...
11691169
for (i = dict->num_pairs, pair = dict->pairs; i > 0; i --, pair ++)
11701170
{
1171-
if (!_pdfioFilePrintf(pdf, "/%s", pair->key))
1171+
if (!_pdfioFilePrintf(pdf, "%N", pair->key))
11721172
return (false);
11731173

11741174
if (length && !strcmp(pair->key, "Length") && pair->value.type == PDFIO_VALTYPE_NUMBER && pair->value.value.number <= 0.0)

pdfio-private.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ struct _pdfio_stream_s // Stream
327327
// Functions...
328328
//
329329

330+
extern size_t _pdfio_strlcpy(char *dst, const char *src, size_t dstsize) _PDFIO_INTERNAL;
330331
extern double _pdfio_strtod(pdfio_file_t *pdf, const char *s) _PDFIO_INTERNAL;
331332
extern ssize_t _pdfio_vsnprintf(pdfio_file_t *pdf, char *buffer, size_t bufsize, const char *format, va_list ap) _PDFIO_INTERNAL;
332333

@@ -367,13 +368,13 @@ extern bool _pdfioFileAddPage(pdfio_file_t *pdf, pdfio_obj_t *obj) _PDFIO_INTER
367368
extern bool _pdfioFileConsume(pdfio_file_t *pdf, size_t bytes) _PDFIO_INTERNAL;
368369
extern pdfio_obj_t *_pdfioFileCreateObj(pdfio_file_t *pdf, pdfio_file_t *srcpdf, _pdfio_value_t *value) _PDFIO_INTERNAL;
369370
extern bool _pdfioFileDefaultError(pdfio_file_t *pdf, const char *message, void *data) _PDFIO_INTERNAL;
370-
extern bool _pdfioFileError(pdfio_file_t *pdf, const char *format, ...) _PDFIO_FORMAT(2,3) _PDFIO_INTERNAL;
371+
extern bool _pdfioFileError(pdfio_file_t *pdf, const char *format, ...) _PDFIO_INTERNAL;
371372
extern pdfio_obj_t *_pdfioFileFindMappedObj(pdfio_file_t *pdf, pdfio_file_t *src_pdf, size_t src_number) _PDFIO_INTERNAL;
372373
extern bool _pdfioFileFlush(pdfio_file_t *pdf) _PDFIO_INTERNAL;
373374
extern int _pdfioFileGetChar(pdfio_file_t *pdf) _PDFIO_INTERNAL;
374375
extern bool _pdfioFileGets(pdfio_file_t *pdf, char *buffer, size_t bufsize) _PDFIO_INTERNAL;
375376
extern ssize_t _pdfioFilePeek(pdfio_file_t *pdf, void *buffer, size_t bytes) _PDFIO_INTERNAL;
376-
extern bool _pdfioFilePrintf(pdfio_file_t *pdf, const char *format, ...) _PDFIO_FORMAT(2,3) _PDFIO_INTERNAL;
377+
extern bool _pdfioFilePrintf(pdfio_file_t *pdf, const char *format, ...) _PDFIO_INTERNAL;
377378
extern bool _pdfioFilePuts(pdfio_file_t *pdf, const char *s) _PDFIO_INTERNAL;
378379
extern ssize_t _pdfioFileRead(pdfio_file_t *pdf, void *buffer, size_t bytes) _PDFIO_INTERNAL;
379380
extern off_t _pdfioFileSeek(pdfio_file_t *pdf, off_t offset, int whence) _PDFIO_INTERNAL;

pdfio-stream.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ _pdfioStreamOpen(pdfio_obj_t *obj, // I - Object
616616
else
617617
{
618618
// Something else we don't support
619-
_pdfioFileError(st->pdf, "Unsupported stream filter '/%s'.", filter);
619+
_pdfioFileError(st->pdf, "Unsupported stream filter '%N'.", filter);
620620
goto error;
621621
}
622622
}
@@ -689,6 +689,10 @@ pdfioStreamPeek(pdfio_stream_t *st, // I - Stream
689689
//
690690
// 'pdfioStreamPrintf()' - Write a formatted string to a stream.
691691
//
692+
// This function writes a formatted string to a stream. In addition to the
693+
// standard `printf` format characters, you can use "%N" to format a PDF name
694+
// value ("/Name") and "%S" to format a PDF string ("(String)") value.
695+
//
692696

693697
bool // O - `true` on success, `false` on failure
694698
pdfioStreamPrintf(

0 commit comments

Comments
 (0)