]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Remove UNDER_CE: Windows CE is old.
authorDaniel Axtens <dja@axtens.net>
Fri, 8 May 2015 11:11:26 +0000 (21:11 +1000)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Mon, 11 May 2015 18:40:22 +0000 (20:40 +0200)
Signed-off-by: Daniel Axtens <dja@axtens.net>
gzguts.h
gzlib.c
test/minigzip.c

index 5bbd15c7fed3b25ece4beccceafcd34db63740f2..dbec9d9376d408d5a38d68b97fe8a5ed6d29ea00 100644 (file)
--- a/gzguts.h
+++ b/gzguts.h
 /* compile with -Dlocal if your debugger can't find static symbols */
 
 /* get errno and strerror definition */
-#if defined UNDER_CE
-#  include <windows.h>
-#  define zstrerror() gz_strwinerror((DWORD)GetLastError())
+#ifndef NO_STRERROR
+#  include <errno.h>
+#  define zstrerror() strerror(errno)
 #else
-#  ifndef NO_STRERROR
-#    include <errno.h>
-#    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 ce2084152b0991fdae0dc2a8573bb0ac8e428540..8e3b4e53530a17d88be292d130f077dd81597ff5 100644 (file)
--- a/gzlib.c
+++ b/gzlib.c
 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)
 {
index bc041df55c4a382a628f981d3021d59a2e7b9c61..ee7dffd3a3ef9bb71ca89e5ce965f4b422d113b2 100644 (file)
@@ -29,9 +29,6 @@
 #if defined(WIN32) || defined(__CYGWIN__)
 #  include <fcntl.h>
 #  include <io.h>
-#  ifdef UNDER_CE
-#    include <stdlib.h>
-#  endif
 #  define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
 #else
 #  define SET_BINARY_MODE(file)
 #endif
 #endif
 
-#if defined(UNDER_CE)
-#  include <windows.h>
-#  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