You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Weldon Washburn <we...@gmail.com> on 2006/03/01 00:41:44 UTC

questions about the patches for libjc/zip.c

Archie,
I tried the "pread()" patch but I still get:

Making all in native
make[2]: Entering directory `/cygdrive/c/Documents and Settings/weldon/My Docume
nts/important/SSG_DRL/jchevm/jchevm/libjc/native'
../../tools/jcjavah/jcjavah -classpath ../../java/jc.zip:/usr/local/classpath/sh
are/classpath/glibj.zip `echo gnu_classpath_VMStackWalker.h | sed -e 's/\.h$//g'
 -e 's/_/./g'`
jcjavah: can't load class `gnu/classpath/VMStackWalker': java/lang/NoClassDefFou
ndError: gnu.classpath.VMStackWalker
make[2]: *** [gnu_classpath_VMStackWalker.h] Error 1


Below is a diff of zip.c.  I simply guessed what the arguments to
lseek() and read() should be.  It would be great if someone would
reply with a diff of what this file should look like.
  Thanks
     Weldon



$ svn diff zip.c
Index: zip.c
===================================================================
--- zip.c       (revision 381714)
+++ zip.c       (working copy)
@@ -307,9 +307,12 @@
        }

        /* Read data */
+    lseek(zip->fd, zent->offset, SEEK_SET); // wjw
        for (i = 0; i < zent->comp_len; i += r) {
-               if ((r = pread(zip->fd, (char *)data + i,
-                   zent->comp_len - i, zent->offset + i)) == -1) {
+               //wjw if ((r = pread(zip->fd, (char *)data + i,
+               //wjw    zent->comp_len - i, zent->offset + i)) == -1) {
+        if ((r = read(zip->fd, (char *)data + i, zent->offset + i)) == -1) { //
wjw
+
                        _JC_EX_STORE(env, IOException, "can't read entry `%s'"
                            " in ZIP file `%s': %s", zent->name, zip->path,
                            strerror(errno));
@@ -361,6 +364,7 @@
        }

        /* Read and inflate data */
+    lseek(zip->fd, zent->offset, SEEK_SET); // wjw
        for (i = 0; i < zent->comp_len; i += r) {
                char buf[512];
                int to_read;
@@ -370,8 +374,10 @@
                to_read = zent->comp_len - i;
                if (to_read > sizeof(buf))
                        to_read = sizeof(buf);
-               if ((r = pread(zip->fd, buf,
-                   to_read, zent->offset + i)) == -1) {
+               //wjw if ((r = pread(zip->fd, buf,
+               //wjw     to_read, zent->offset + i)) == -1) {
+               if ((r = read(zip->fd, buf, zent->offset + i)) == -1) {  //wjw
+
                        _JC_EX_STORE(env, IOException, "error reading entry"
                            " `%s' in ZIP file `%s': %s", zent->name,
                            zip->path, strerror(errno));


--
Weldon Washburn
Intel Middleware Products Division