[libpng16] Use nanosleep() instead of usleep() in contrib/gregbook/rpng2-x.c

because usleep() is deprecated.
This commit is contained in:
Glenn Randers-Pehrson 2014-09-14 16:34:09 -05:00
parent e4489f1db2
commit 996046aed5
3 changed files with 17 additions and 4 deletions

View File

@ -33,8 +33,11 @@ Version 1.6.14beta01 [September 14, 2014]
Add "#include <setjmp.h>" to contrib/tools/pngfix.c (John Bowler)
Version 1.6.14beta02 [September 14, 2014]
Use nanosleep() instead of usleep() in contrib/gregbook/rpng2-x.c
because usleep() is deprecated.
Define usleep() in contrib/gregbook/rpng2-x.c if not already defined
in unistd.h; fixes error introduced in libpng-1.6.13.
in unistd.h and nanosleep() is not available; fixes error introduced
in libpng-1.6.13.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -4986,8 +4986,11 @@ Version 1.6.14beta01 [September 14, 2014]
Add "#include <setjmp.h>" to contrib/tools/pngfix.c (John Bowler)
Version 1.6.14beta02 [September 14, 2014]
Use nanosleep() instead of usleep() in contrib/gregbook/rpng2-x.c
because usleep() is deprecated.
Define usleep() in contrib/gregbook/rpng2-x.c if not already defined
in unistd.h; fixes error introduced in libpng-1.6.13.
in unistd.h and nanosleep() is not available; fixes error introduced
in libpng-1.6.13.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -115,8 +115,15 @@
#include <X11/Xos.h>
#include <X11/keysym.h> /* defines XK_* macros */
/* This is temporary until the code is rewritten to use nanosleep(). */
#ifndef usleep
#if _POSIX_C_SOURCE >= 199309L /* have nanosleep() */
# undef usleep
# define usleep(usec) { \
struct timespec ts; \
ts.tv_nsec = (usec) * 1000; \
nanosleep(&ts, NULL); }
# endif
#ifndef usleep /* have neither nanosleep() nor usleep() */
# define usleep(x) sleep(((x)+499999)/1000000)
#endif