From 7dd50b0c12390707a2b68b757d2a9dea9a2dbd8b Mon Sep 17 00:00:00 2001 From: Kira Date: Mon, 1 Apr 2024 21:18:07 -0400 Subject: [PATCH] Fix issues with wrong type of arguments to printf Each call to the printf function or a related function should include the type and sequence of arguments defined by the format. If the function is passed arguments of a different type or in a different sequence then the arguments are reinterpreted to fit the type and sequence expected, resulting in unpredictable behavior. --- lib/psdriver/draw_bitmap.c | 2 +- lib/psdriver/erase.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/psdriver/draw_bitmap.c b/lib/psdriver/draw_bitmap.c index aed22614166..024b4ee2c2a 100644 --- a/lib/psdriver/draw_bitmap.c +++ b/lib/psdriver/draw_bitmap.c @@ -4,7 +4,7 @@ void PS_Bitmap(int ncols, int nrows, int threshold, const unsigned char *buf) { int i, j; - output("%d %d %d %d BITMAP\n", cur_x, cur_y, ncols, nrows); + output("%lf %lf %d %d BITMAP\n", cur_x, cur_y, ncols, nrows); for (j = 0; j < nrows; j++) { unsigned int bit = 0x80; diff --git a/lib/psdriver/erase.c b/lib/psdriver/erase.c index 6999bdef66c..931784bcf54 100644 --- a/lib/psdriver/erase.c +++ b/lib/psdriver/erase.c @@ -3,7 +3,7 @@ void PS_Erase(void) { if (ps.encapsulated) - output("%d %d %d %d BOX\n", ps.left, ps.top, ps.right, ps.bot); + output("%lf %lf %lf %lf BOX\n", ps.left, ps.top, ps.right, ps.bot); else output("ERASE\n"); }