From: Daniel Axtens Date: Fri, 8 May 2015 11:11:26 +0000 (+1000) Subject: Remove UNDER_CE: Windows CE is old. X-Git-Tag: 1.9.9-b1~850 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=239692bf136a9ba33f1c4f0562b9a7a08c1f25df;p=thirdparty%2Fzlib-ng.git Remove UNDER_CE: Windows CE is old. Signed-off-by: Daniel Axtens --- diff --git a/gzguts.h b/gzguts.h index 5bbd15c7f..dbec9d937 100644 --- a/gzguts.h +++ b/gzguts.h @@ -67,16 +67,11 @@ /* compile with -Dlocal if your debugger can't find static symbols */ /* get errno and strerror definition */ -#if defined UNDER_CE -# include -# define zstrerror() gz_strwinerror((DWORD)GetLastError()) +#ifndef NO_STRERROR +# include +# define zstrerror() strerror(errno) #else -# ifndef NO_STRERROR -# include -# define zstrerror() strerror(errno) -# else -# define zstrerror() "stdio error (consult errno)" -# endif +# define zstrerror() "stdio error (consult errno)" #endif /* provide prototypes for these when building zlib without LFS */ @@ -146,9 +141,6 @@ typedef gz_state *gz_statep; /* shared functions */ void ZLIB_INTERNAL gz_error (gz_statep, int, const char *); -#if defined UNDER_CE -char ZLIB_INTERNAL *gz_strwinerror (DWORD error); -#endif /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t value -- needed when comparing unsigned to z_off64_t, which is signed diff --git a/gzlib.c b/gzlib.c index ce2084152..8e3b4e535 100644 --- a/gzlib.c +++ b/gzlib.c @@ -19,57 +19,6 @@ local void gz_reset (gz_statep); local gzFile gz_open (const void *, int, const char *); -#if defined UNDER_CE - -/* Map the Windows error number in ERROR to a locale-dependent error message - string and return a pointer to it. Typically, the values for ERROR come - from GetLastError. - - The string pointed to shall not be modified by the application, but may be - overwritten by a subsequent call to gz_strwinerror - - The gz_strwinerror function does not change the current setting of - GetLastError. */ -char ZLIB_INTERNAL *gz_strwinerror (DWORD error) -{ - static char buf[1024]; - - wchar_t *msgbuf; - DWORD lasterr = GetLastError(); - DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM - | FORMAT_MESSAGE_ALLOCATE_BUFFER, - NULL, - error, - 0, /* Default language */ - (LPVOID)&msgbuf, - 0, - NULL); - if (chars != 0) { - /* If there is an \r\n appended, zap it. */ - if (chars >= 2 - && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') { - chars -= 2; - msgbuf[chars] = 0; - } - - if (chars > sizeof (buf) - 1) { - chars = sizeof (buf) - 1; - msgbuf[chars] = 0; - } - - wcstombs(buf, msgbuf, chars + 1); - LocalFree(msgbuf); - } - else { - sprintf(buf, "unknown win32 error (%ld)", error); - } - - SetLastError(lasterr); - return buf; -} - -#endif /* UNDER_CE */ - /* Reset gzip file state */ local void gz_reset(gz_statep state) { diff --git a/test/minigzip.c b/test/minigzip.c index bc041df55..ee7dffd3a 100644 --- a/test/minigzip.c +++ b/test/minigzip.c @@ -29,9 +29,6 @@ #if defined(WIN32) || defined(__CYGWIN__) # include # include -# ifdef UNDER_CE -# include -# endif # define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) #else # define SET_BINARY_MODE(file) @@ -47,68 +44,6 @@ #endif #endif -#if defined(UNDER_CE) -# include -# define perror(s) pwinerror(s) - -/* Map the Windows error number in ERROR to a locale-dependent error - message string and return a pointer to it. Typically, the values - for ERROR come from GetLastError. - - The string pointed to shall not be modified by the application, - but may be overwritten by a subsequent call to strwinerror - - The strwinerror function does not change the current setting - of GetLastError. */ - -static char *strwinerror (DWORD error) -{ - static char buf[1024]; - - wchar_t *msgbuf; - DWORD lasterr = GetLastError(); - DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM - | FORMAT_MESSAGE_ALLOCATE_BUFFER, - NULL, - error, - 0, /* Default language */ - (LPVOID)&msgbuf, - 0, - NULL); - if (chars != 0) { - /* If there is an \r\n appended, zap it. */ - if (chars >= 2 - && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') { - chars -= 2; - msgbuf[chars] = 0; - } - - if (chars > sizeof (buf) - 1) { - chars = sizeof (buf) - 1; - msgbuf[chars] = 0; - } - - wcstombs(buf, msgbuf, chars + 1); - LocalFree(msgbuf); - } - else { - sprintf(buf, "unknown win32 error (%ld)", error); - } - - SetLastError(lasterr); - return buf; -} - -static void pwinerror (const char *s) -{ - if (s && *s) - fprintf(stderr, "%s: %s\n", s, strwinerror(GetLastError ())); - else - fprintf(stderr, "%s\n", strwinerror(GetLastError ())); -} - -#endif /* UNDER_CE */ - #ifndef GZ_SUFFIX # define GZ_SUFFIX ".gz" #endif