Re: sizeof(struct ...)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andy Whitcroft schrieb:
> Perhaps we can look and see what a portable application like gzip or
> bzip2 do in this situation.  They must have the same problem.

Info-ZIP's zip uses structs only for in-memory storage and has a write
function for each of them that writes the members one by one.  I find
the structs in archive-zip.c easier to read, but I might be biased. ;-)

Anyway, archive-zip.c assumes that there is no padding between unsigned
char arrays and that an unsigned char is exactly one byte wide.  The
additional current assumption -- that sizeof(struct ...) sums up the
sizes of all struct members -- is wrong on ARM, and the patches in this
thread correct this error.

So we're not as portable as Info-ZIP, but I think the assumptions above
hold true for all interesting architectures.  And we have a readable
description of the on-disk ZIP file headers.

René
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]