diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2013-04-15 18:35:36 +0100 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2013-05-07 09:15:48 +0100 |
commit | e64ac4c83a4ae07dc15c4cacd7b60cba6294899a (patch) | |
tree | da281911407c5bc8c8fcd77c81bf9815d520bb34 /xps/xpszip.c | |
parent | 07ba8bea8e98084a156edac611a4ae92545edf06 (diff) | |
download | ghostpdl-e64ac4c83a4ae07dc15c4cacd7b60cba6294899a.tar.gz |
Bug 693843: Add a gs_sprintf() function, and supporting code
Same as sprintf() but certain to be unaffected by localization.
Utilizes the "trio" string library, also added here. There is one modification
to trio, in trio.c and labelled with "/* GS Modification */" - by default, trio
is a little aggressive in the point it switches to exponent notation, and the
patch brings is more line with what we need/expect.
trio also includes a sscanf() function which we can utilise if required.
See the gs-sprintf branch for the individual commits - especially those in the
trio source, should a trio update ever be pulled in.
This causes rounding differences in the pdfwrite/ps2write output in a number
of the cluster files. They all appear to be pixel variations.
Diffstat (limited to 'xps/xpszip.c')
-rw-r--r-- | xps/xpszip.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/xps/xpszip.c b/xps/xpszip.c index aeaaa9daf..52b89ad89 100644 --- a/xps/xpszip.c +++ b/xps/xpszip.c @@ -304,11 +304,11 @@ xps_read_zip_part(xps_context_t *ctx, char *partname) size = 0; while (1) { - sprintf(buf, "%s/[%d].piece", name, count); + gs_sprintf(buf, "%s/[%d].piece", name, count); ent = xps_find_zip_entry(ctx, buf); if (!ent) { - sprintf(buf, "%s/[%d].last.piece", name, count); + gs_sprintf(buf, "%s/[%d].last.piece", name, count); ent = xps_find_zip_entry(ctx, buf); } if (!ent) @@ -325,9 +325,9 @@ xps_read_zip_part(xps_context_t *ctx, char *partname) for (i = 0; i < count; i++) { if (i < count - 1) - sprintf(buf, "%s/[%d].piece", name, i); + gs_sprintf(buf, "%s/[%d].piece", name, i); else - sprintf(buf, "%s/[%d].last.piece", name, i); + gs_sprintf(buf, "%s/[%d].last.piece", name, i); ent = xps_find_zip_entry(ctx, buf); xps_read_zip_entry(ctx, ent, part->data + offset); offset += ent->usize; @@ -371,11 +371,11 @@ xps_read_dir_part(xps_context_t *ctx, char *name) size = 0; while (1) { - sprintf(buf, "%s%s/[%d].piece", ctx->directory, name, count); + gs_sprintf(buf, "%s%s/[%d].piece", ctx->directory, name, count); file = gp_fopen(buf, "rb"); if (!file) { - sprintf(buf, "%s%s/[%d].last.piece", ctx->directory, name, count); + gs_sprintf(buf, "%s%s/[%d].last.piece", ctx->directory, name, count); file = gp_fopen(buf, "rb"); } if (!file) @@ -394,9 +394,9 @@ xps_read_dir_part(xps_context_t *ctx, char *name) for (i = 0; i < count; i++) { if (i < count - 1) - sprintf(buf, "%s%s/[%d].piece", ctx->directory, name, i); + gs_sprintf(buf, "%s%s/[%d].piece", ctx->directory, name, i); else - sprintf(buf, "%s%s/[%d].last.piece", ctx->directory, name, i); + gs_sprintf(buf, "%s%s/[%d].last.piece", ctx->directory, name, i); file = gp_fopen(buf, "rb"); n = fread(part->data + offset, 1, size - offset, file); offset += n; |