AW: [Zlib-devel] CE Port

Cosmin Truta cosmin at cs.toronto.edu
Wed Jun 18 14:32:01 EDT 2003


On Wed, 18 Jun 2003, Alexander Mai wrote:

> > I looked a little more at the Windows CE port, and I would like to
> > bring in some objections and suggestions.
>
> You are talking about the existing, full CE port on that
> given URL, right?!

I am talking about
  http://www.tenik.co.jp/~adachi/wince/zlibce/index.html

> My recent proposal is not to use it, but to incorporate
> the set of patches being provided by me. (a first set was
> already sent to this list, more to come when I have a bit more
> time...)

Now I realize that you provided a different patch, to a newer version of
Windows CE, that has the standard C library. This is excellent!

I am sorry that my previous message on this topic mislead some people.


> > As I see, Windows CE doesn't support a minimum of decent portability.
> > ***What's good in using C, if it isn't possible to use the standard C
> > library properly?***
>
> A somehow funny statement. What would you use on a system where
> only a non-ANSI C implementation exists??

If one has an alternative that is technically better than C (that is,
a familiar programming language that offers the same performance as C,
but a higher level of expression), and the portability reason does not
exist, then there is not much reason left in the favor of C. But if C
is your only choice, then, you are right, you are stuck with it.
My point was that a C platform without the standard library should be
treated like a non-C platform - in the same manner as the non-C ports,
found in the contrib/ directory.


> > - If there is no sprintf() or snprintf(), there should be wsprintf()
> > on Windows CE. (Is this correct?)
>
> The "C API" exists for char and the unicode versions (at least
> as far as available at all...).
> The system API however is pure UNICODE.

I was talking about the other port for the old CE. I am glad to know
that we don't have to worry about non-standard library workarounds
anymore.


I wish to make one suggestion, though: I see that rewind() is
unavaliable on CE. The way you provide it via a macro will break as soon
as it will become available on a later version of CE. I suggest to
replace rewind(s->file) with fseek(s->file, 0L, SEEK_SET) directly in
gzrewind().

--- zlib-1.2.0.1/gzio.c		Thu Apr 03 00:27:56 2003
+++ zlib-1.2.0.1-CE/gzio.c	Wed Jun 18 15:30:00 2003
@@ -811,7 +811,7 @@
     s->crc = crc32(0L, Z_NULL, 0);

     if (s->startpos == 0) { /* not a compressed file */
-        rewind(s->file);
+        fseek(s->file, 0L, SEEK_SET); /* rewind() is not always available */
         return 0;
     }

The difference between rewind(fp) and fseek(fp, 0L, SEEK_SET) is that
rewind() clears the error and the EOF indicator, while fseek() only
clears the EOF indicator. This is not relevant to zlib's behavior.


Best regards,
Cosmin





More information about the Zlib-devel mailing list