[Debootloaders-devel] r108 - in trunk/rsrce: . debian
Jeremie Koenig
jkoenig-guest at costa.debian.org
Fri Jul 14 13:27:05 UTC 2006
Author: jkoenig-guest
Date: 2006-07-14 13:27:05 +0000 (Fri, 14 Jul 2006)
New Revision: 108
Modified:
trunk/rsrce/debian/changelog
trunk/rsrce/resource.c
Log:
* fix the write side of the type list offset bug
* fix the written resource map lenght which had space for non-existant names
Modified: trunk/rsrce/debian/changelog
===================================================================
--- trunk/rsrce/debian/changelog 2006-07-14 13:14:44 UTC (rev 107)
+++ trunk/rsrce/debian/changelog 2006-07-14 13:27:05 UTC (rev 108)
@@ -7,9 +7,11 @@
* Jérémie Koenig <sprite at sprite.fr.eu.org>
- Fix the type list offset in the map header which points to the
- number of types field before the actual list.
+ number of types field before the actual list.
+ - Fix the written resource map lenght which included space for
+ non-existant names.
- -- Aurélien GÉRÔME <ag at roxor.cx> Fri, 14 Jul 2006 15:10:01 +0200
+ -- Jeremie Koenig <jk at jk.dnsalias.net> Fri, 14 Jul 2006 15:30:04 +0200
rsrce (0.2) unstable; urgency=low
Modified: trunk/rsrce/resource.c
===================================================================
--- trunk/rsrce/resource.c 2006-07-14 13:14:44 UTC (rev 107)
+++ trunk/rsrce/resource.c 2006-07-14 13:27:05 UTC (rev 108)
@@ -395,7 +395,8 @@
for(r = f->tt[ti].rlist ; r ; r = r->next) {
dlen += sizeof(struct resdata) + r->datalen;
rlen += sizeof(struct resref);
- nlen += sizeof(struct resname) + r->namelen;
+ if(r->name)
+ nlen += sizeof(struct resname) + r->namelen;
}
}
@@ -421,14 +422,14 @@
/* write the resource map header */
memset(&mh.reserved, 0, sizeof mh.reserved);
mh.attr = htons(f->attr);
- mh.tlistofs = htons(sizeof mh);
+ mh.tlistofs = htons((char *) &mh.tnum - (char *) &mh);
mh.nlistofs = htons(mlen + rlen);
mh.tnum = htons(f->tn - 1);
if(fwrite(&mh, sizeof mh, 1, stream) != 1)
return -1;
/* write the type list */
- rofs = f->tn * sizeof type;
+ rofs = sizeof mh.tnum + f->tn * sizeof type;
for(ti = 0; ti < f->tn; ti++) {
/* count resources */
for(r = f->tt[ti].rlist, rnum = 0; r; r = r->next, rnum++);
More information about the Debootloaders-devel
mailing list