From f9f170e6483ce11f02a97e26b1ccf0a3e8cb9bfc Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Fri, 17 Jul 2009 16:08:25 +0000 Subject: various small fixes for 64Bit systems texk/dvipsk: add casts to avoid compiler warnings texk/gsftopk: add casts to avoid compiler warnings texk/ps2pkm: import changes from libs/t1lib texk/ttfdump: add casts to avoid compiler warnings texk/dviljk: add casts for printing and proper format specs for scanf to avoid compiler warnings and potential bugs git-svn-id: svn://tug.org/texlive/trunk@14299 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dviljk/ChangeLog | 8 ++++++++ Build/source/texk/dviljk/config.h | 2 ++ Build/source/texk/dviljk/dvi2xx.c | 14 +++++++------- 3 files changed, 17 insertions(+), 7 deletions(-) (limited to 'Build/source/texk/dviljk') diff --git a/Build/source/texk/dviljk/ChangeLog b/Build/source/texk/dviljk/ChangeLog index 9d8d50611cf..3bed8b36c03 100644 --- a/Build/source/texk/dviljk/ChangeLog +++ b/Build/source/texk/dviljk/ChangeLog @@ -1,3 +1,11 @@ +2009-07-17 Peter Breitenlohner + + * config.h: define FMT_long4 as "%ld" or "%d" when long4 is + long or int resp. + * dvi2xx.c (main, DoSpecial): cast long4 to long for printing. + (DecodeArgs): use FMT_long4 for scanf; on 64Bit systems + sscanf(string, "%ld", &) is wrong. + 2009-07-16 Peter Breitenlohner * Makefile.am (dvilj.man): rebuild only in maintainer-mode. diff --git a/Build/source/texk/dviljk/config.h b/Build/source/texk/dviljk/config.h index 97af49738fd..bcdf4c577c1 100644 --- a/Build/source/texk/dviljk/config.h +++ b/Build/source/texk/dviljk/config.h @@ -199,8 +199,10 @@ typedef SCHAR_TYPE signed_char; #if SIZEOF_LONG > 4 # define long4 int +# define FMT_long4 "%d" #else # define long4 long +# define FMT_long4 "%ld" #endif #include diff --git a/Build/source/texk/dviljk/dvi2xx.c b/Build/source/texk/dviljk/dvi2xx.c index 0fedea81632..69453cafbbd 100644 --- a/Build/source/texk/dviljk/dvi2xx.c +++ b/Build/source/texk/dviljk/dvi2xx.c @@ -378,9 +378,9 @@ main(int argc, char *argv[]) DEBUG_PRINT ("BOP for ["); for (i = 0; i <= 9; i++) { count[i] = NoSignExtend(dvifp, 4); - DEBUG_PRINT1 ("%d.", (int) count[i]); + DEBUG_PRINT1 ("%ld.", (long) count[i]); } - DEBUG_PRINT1 ("] at %ld.\n", cpagep); + DEBUG_PRINT1 ("] at %ld.\n", (long)cpagep); ppagep = (long)NoSignExtend(dvifp, 4); h = v = w = x = y = z = 0; hh = vv = 0; @@ -2907,7 +2907,7 @@ Primary author of Dvi2xx: Gustaf Neumann; -k maintainer: K. Berry."); #endif break; case 'f': /* next arg is starting pagenumber */ - if ( sscanf(tcp + 1, "%ld", &FirstPage) != 1 ) + if ( sscanf(tcp + 1, FMT_long4, &FirstPage) != 1 ) Fatal("Argument is not a valid integer\n"); FirstPageSpecified = _TRUE; break; @@ -3020,7 +3020,7 @@ Primary author of Dvi2xx: Gustaf Neumann; -k maintainer: K. Berry."); break; #endif case 'p': /* print n pages */ - if ( sscanf(tcp + 1, "%ld", &PrintPages) != 1 ) + if ( sscanf(tcp + 1, FMT_long4, &PrintPages) != 1 ) Fatal("Argument is not a valid integer\n"); if (PrintPages < 1) Fatal("Argument of -p must be greater than 0\n"); @@ -3070,7 +3070,7 @@ Primary author of Dvi2xx: Gustaf Neumann; -k maintainer: K. Berry."); break; #endif case 't': /* ending pagenumber */ - if ( sscanf(tcp + 1, "%ld", &LastPage) != 1 ) + if ( sscanf(tcp + 1, FMT_long4, &LastPage) != 1 ) Fatal("Argument is not a valid integer\n"); LastPageSpecified = _TRUE; break; @@ -3856,9 +3856,9 @@ void DoSpecial(char *str, int n) if (labs(x_pos)