Jonathan~ On 9/22/05, Jonathan Worthington <[EMAIL PROTECTED]> wrote: > "Roger Browne" <[EMAIL PROTECTED]> wrote: > > If you do tweak the signature for the packfile format, I suggest you > > take a leaf out of the PNG specification and ensure that the signature > > will robustly detect common errors such as byte order transpositions, > > CRLF-to-newline mappings (e.g. when binary files are FTPd using ASCII > > mode), etc. > > > > See section 12.11 of the PNG specification: > > http://www.faqs.org/rfcs/rfc2083.html > > > Interesting, thanks - they make some good suggestions there. Our current > magic number is "13155a1" - I'm unsure of the rationale behind it, but there > may be a reason. If we're going to change the packfile format, we may as > well make sure we're squeezing whatever use we can out of our magic number. > > "Mark A. Biggar" <[EMAIL PROTECTED]> wrote: > > Joshua Hoblitt wrote: > > > >> a) live with it > >> b) change the magic number to be two identical bytes so the byte > >> ordering doesn't matter > >> c) shrink the magic number to be a single byte > > > When I talked about doing something endian-independent, I meant something > along the lines of store a sequence of, say, 4 bytes that will have certain > values. Forget reading the 4 bytes as an int at all, read it as a char[4] > and check each element is what it should be. Makes adding support to "file" > easy enough, and is my preferred solution. > > > d) use a magic number that can also be used as the byte order indicator. > > > Clever, though not sure it helps with writing something to independently > identify a Parrot packfile, if it can be one of a number of things (though I > guess in this case, one of only two things - unless there's some insane > ordering scheme I've not heard of).
I have seen architectures that swap byte ordering for 8 byte things (like doubles) but not 4 byte things. So that gives 3 options and requires an 8 byte magic number if you want to do it that way. Matt -- "Computer Science is merely the post-Turing Decline of Formal Systems Theory." -Stan Kelly-Bootle, The Devil's DP Dictionary