From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: Andy Whitcroft <apw@shadowen.org>
Cc: Erik Mouw <erik@harddisk-recovery.com>,
Gerrit Pape <pape@smarden.org>,
git@vger.kernel.org
Subject: Re: sizeof(struct ...)
Date: Thu, 23 Nov 2006 18:57:00 +0100 [thread overview]
Message-ID: <4565E0EC.4030709@lsrfire.ath.cx> (raw)
In-Reply-To: <4565CA02.20602@shadowen.org>
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.
next prev parent reply other threads:[~2006-11-23 17:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-23 10:16 sizeof(struct ...) Gerrit Pape
2006-11-23 12:43 ` René Scharfe
2006-11-23 13:38 ` René Scharfe
2006-11-23 13:55 ` Andy Whitcroft
2006-11-23 15:45 ` René Scharfe
2006-11-23 15:54 ` Erik Mouw
2006-11-23 16:14 ` René Scharfe
2006-11-23 16:19 ` Andy Whitcroft
2006-11-23 17:57 ` René Scharfe [this message]
2006-11-23 16:42 ` Erik Mouw
2006-11-23 20:47 ` Junio C Hamano
2006-11-23 22:02 ` [PATCH] archive-zip: don't use " René Scharfe
2006-11-24 8:53 ` Gerrit Pape
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4565E0EC.4030709@lsrfire.ath.cx \
--to=rene.scharfe@lsrfire.ath.cx \
--cc=apw@shadowen.org \
--cc=erik@harddisk-recovery.com \
--cc=git@vger.kernel.org \
--cc=pape@smarden.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).