diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2017-08-08 02:03:34 +0800 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2017-08-15 20:42:16 +0800 |
commit | 0d4bd8ba31515d329dee1532b6c30ff5e74019b3 (patch) | |
tree | f82176a4baf347c5fd87d2f5322fecae5d2ffa85 /source | |
parent | 7cc9344fb32fdf6b1116235fe6fe8afbc91cdb19 (diff) | |
download | mupdf-0d4bd8ba31515d329dee1532b6c30ff5e74019b3.tar.xz |
Move sign printing into inner formatting functions.
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/printf.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/source/fitz/printf.c b/source/fitz/printf.c index 3b0072f7..30cf85fb 100644 --- a/source/fitz/printf.c +++ b/source/fitz/printf.c @@ -96,7 +96,7 @@ static void fmtuint32(struct fmtbuf *out, unsigned int a, int s, int z, int w, i while (i < w) buf[i++] = z; if (s) - fmtputc(out, '+'); + buf[i++] = s; while (i > 0) fmtputc(out, buf[--i]); } @@ -116,7 +116,7 @@ static void fmtuint64(struct fmtbuf *out, uint64_t a, int s, int z, int w, int b while (i < w) buf[i++] = z; if (s) - fmtputc(out, '+'); + buf[i++] = s; while (i > 0) fmtputc(out, buf[--i]); } @@ -127,11 +127,19 @@ static void fmtint32(struct fmtbuf *out, int value, int s, int z, int w, int bas if (value < 0) { - fmtputc(out, '-'); + s = '-'; a = -value; } + else if (s) + { + s = '+'; + a = value; + } else + { + s = 0; a = value; + } fmtuint32(out, a, s, z, w, base); } @@ -141,11 +149,19 @@ static void fmtint64(struct fmtbuf *out, int64_t value, int s, int z, int w, int if (value < 0) { - fmtputc(out, '-'); + s = '-'; a = -value; } + else if (s) + { + s = '+'; + a = value; + } else + { + s = 0; a = value; + } fmtuint64(out, a, s, z, w, base); } |