From 33ebeec0b562fe87e4c3f6bd2730ca022d3800c5 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Fri, 13 Jun 2014 15:34:36 -0500 Subject: [PATCH] [libpng16] Split a long output string in contrib/gregbook/rpng2-x.c. --- ANNOUNCE | 1 + CHANGES | 1 + contrib/gregbook/rpng2-x.c | 42 +++++++++++++++++++++++++++----------- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 9788b6f4b..9c36f91b5 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -31,6 +31,7 @@ Version 1.6.13beta01 [June 13, 2014] contrib/pngminus/*.c Added "(void) png_ptr;" where needed in contrib/gregbook to quiet compiler complaints about unused pointers. + Split a long output string in contrib/gregbook/rpng2-x.c. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index fac56b53b..a73ee4673 100644 --- a/CHANGES +++ b/CHANGES @@ -4945,6 +4945,7 @@ Version 1.6.13beta01 [June 13, 2014] contrib/pngminus/*.c Added "(void) png_ptr;" where needed in contrib/gregbook to quiet compiler complaints about unused pointers. + Split a long output string in contrib/gregbook/rpng2-x.c. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/contrib/gregbook/rpng2-x.c b/contrib/gregbook/rpng2-x.c index 7f24b632b..cd70c7afb 100644 --- a/contrib/gregbook/rpng2-x.c +++ b/contrib/gregbook/rpng2-x.c @@ -41,7 +41,11 @@ unexpected-EOF and file-read-error cases; fixed Trace() cut-and- paste bugs - 2.03: deleted runtime MMX-enabling/disabling and obsolete -mmx* options + - 2.04: Added "void(foo);" statements to quiet pedantic compiler warnings + about unused variables (GR-P) + TO DO: + use nanosleep() instead of usleep(), which is obsolete/deprecated. --------------------------------------------------------------------------- Copyright (c) 1998-2008 Greg Roelofs. All rights reserved. @@ -95,10 +99,13 @@ #define PROGNAME "rpng2-x" #define LONGNAME "Progressive PNG Viewer for X" -#define VERSION "2.03 of 25 February 2010" +#define VERSION "2.04 of 15 June 2014" #define RESNAME "rpng2" /* our X resource application name */ #define RESCLASS "Rpng" /* our X resource class name */ +/* This is temporary until the code is rewritten to use nanosleep(). */ +#define usleep(x) sleep(((x)+499999)/1000000) + #include #include #include @@ -456,40 +463,47 @@ int main(int argc, char **argv) fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname); readpng2_version_info(); fprintf(stderr, "\n" - "Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n" + "Usage: "); + fprintf(stderr, + "%s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n" + " %*s [-usleep dur | -timing] [-pause]\n", + PROGNAME, (int)strlen(PROGNAME), " "); + fprintf(stderr, #ifdef FEATURE_LOOP - " %*s [-usleep dur | -timing] [-pause] [-loop [sec]] file.png\n\n" -#else - " %*s [-usleep dur | -timing] [-pause] file.png\n\n" + " [-loop [sec]]" #endif + " file.png\n\n"); + fprintf(stderr, " xdpy\tname of the target X display (e.g., ``hostname:0'')\n" " exp \ttransfer-function exponent (``gamma'') of the display\n" "\t\t system in floating-point format (e.g., ``%.1f''); equal\n" - "\t\t to the product of the lookup-table exponent (varies)\n" + "\t\t to the product of the lookup-table exponent (varies)\n", + default_display_exponent); + fprintf(stderr, "\t\t and the CRT exponent (usually 2.2); must be positive\n" " bg \tdesired background color in 7-character hex RGB format\n" "\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n" "\t\t used with transparent images; overrides -bgpat\n" " pat \tdesired background pattern number (0-%d); used with\n" - "\t\t transparent images; overrides -bgcolor\n" + "\t\t transparent images; overrides -bgcolor\n", + num_bgpat-1); #ifdef FEATURE_LOOP + fprintf(stderr, " -loop\tloops through background images after initial display\n" "\t\t is complete (depends on -bgpat)\n" - " sec \tseconds to display each background image (default = 2)\n" + " sec \tseconds to display each background image (default = 2)\n"); #endif + fprintf(stderr, " dur \tduration in microseconds to wait after displaying each\n" "\t\t row (for demo purposes)\n" " -timing\tenables delay for every block read, to simulate modem\n" "\t\t download of image (~36 Kbps)\n" " -pause\tpauses after displaying each pass until mouse clicked\n" "\nPress Q, Esc or mouse button 1 (within image window, after image\n" - "is displayed) to quit.\n" - "\n", PROGNAME, - (int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat-1); + "is displayed) to quit.\n"); exit(1); } - if (!(infile = fopen(filename, "rb"))) { fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename); ++error; @@ -735,6 +749,7 @@ int main(int argc, char **argv) Trace((stderr, "about to call rpng2_x_cleanup()\n")) rpng2_x_cleanup(); + (void)argc; /* Unused */ return 0; } @@ -1826,6 +1841,9 @@ static void rpng2_x_redisplay_image(ulg startcol, ulg startrow, XFlush(display); } + (void)startcol; + (void)width; + } /* end function rpng2_x_redisplay_image() */