--- IO-AIO/AIO.xs 2009/06/06 18:19:35 1.142 +++ IO-AIO/AIO.xs 2009/06/15 05:34:49 1.147 @@ -230,7 +230,8 @@ if (req->result >= 0) { int i; - char *buf = req->ptr2; + char *names = (char *)req->ptr2; + eio_dirent *ent = (eio_dirent *)req->ptr1; /* might be 0 */ AV *av = newAV (); av_extend (av, req->result - 1); @@ -239,8 +240,7 @@ { if (req->int1 & EIO_READDIR_DENTS) { - eio_dirent *ent = (eio_dirent *)buf; - SV *namesv = newSVpvn (ent->name, ent->namelen); + SV *namesv = newSVpvn (names + ent->nameofs, ent->namelen); if (req->int1 & EIO_READDIR_CUSTOM2) { @@ -256,21 +256,21 @@ } av_store (avent, 0, namesv); - av_store (avent, 1, IVSIZE >= 8 ? newSVuv (ent->inode) : newSVnv (ent->inode)); - av_store (avent, 2, SvREFCNT_inc (sv_type [ent->type])); + av_store (avent, 1, SvREFCNT_inc (sv_type [ent->type])); + av_store (avent, 2, IVSIZE >= 8 ? newSVuv (ent->inode) : newSVnv (ent->inode)); av_store (av, i, newRV_noinc ((SV *)avent)); } else av_store (av, i, namesv); - buf += sizeof (eio_dirent); + ++ent; } else { - SV *name = newSVpv (buf, 0); + SV *name = newSVpv (names, 0); av_store (av, i, name); - buf += SvCUR (name) + 1; + names += SvCUR (name) + 1; } } @@ -296,7 +296,7 @@ char sym [64]; int symlen; - symlen = snprintf (sym, sizeof (sym), "fd#%d", req->result); + symlen = snprintf (sym, sizeof (sym), "fd#%d", (int)req->result); gv_init (gv, stash, sym, symlen, 0); symlen = snprintf ( @@ -304,7 +304,7 @@ sizeof (sym), "%s&=%d", flags == O_RDONLY ? "<" : flags == O_WRONLY ? ">" : "+<", - req->result + (int)req->result ); if (do_open (gv, sym, symlen, 0, 0, 0, 0)) @@ -557,8 +557,6 @@ BOOT: { - stash = gv_stashpv ("IO::AIO", 1); - static const struct { const char *name; IV iv; @@ -594,6 +592,8 @@ const_eio (DT_WHT) }; + stash = gv_stashpv ("IO::AIO", 1); + for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));