Mercurial > hg
comparison mercurial/mpatch.c @ 384:a29decbf7475
mpatch: attempt to handle unpack alignment issues on Solaris
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
mpatch: attempt to handle unpack alignment issues on Solaris
manifest hash: e185dc380bab61cf11a9973ee3ddd2e904e56299
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCsnOtywK+sNU5EO8RAlzQAJ9YIhbL8BJjT+J/pOiQVES2wsF0igCgnFRl
ok5f8i8GbNk77sRbpsGnUF0=
=m0Zh
-----END PGP SIGNATURE-----
author | mpm@selenic.com |
---|---|
date | Thu, 16 Jun 2005 22:54:37 -0800 |
parents | 97d83e7fbf2f |
children | 7c678976df3e 688d03d6997a |
comparison
equal
deleted
inserted
replaced
383:4862a134e2c2 | 384:a29decbf7475 |
---|---|
193 static struct flist *decode(char *bin, int len) | 193 static struct flist *decode(char *bin, int len) |
194 { | 194 { |
195 struct flist *l; | 195 struct flist *l; |
196 struct frag *lt; | 196 struct frag *lt; |
197 char *end = bin + len; | 197 char *end = bin + len; |
198 char decode[12]; /* for dealing with alignment issues */ | |
198 | 199 |
199 /* assume worst case size, we won't have many of these lists */ | 200 /* assume worst case size, we won't have many of these lists */ |
200 l = lalloc(len / 12); | 201 l = lalloc(len / 12); |
201 lt = l->tail; | 202 lt = l->tail; |
202 | 203 |
203 while (bin < end) { | 204 while (bin < end) { |
204 lt->start = ntohl(*(uint32_t *)bin); | 205 memcpy(decode, bin, 12); |
205 lt->end = ntohl(*(uint32_t *)(bin + 4)); | 206 lt->start = ntohl(*(uint32_t *)decode); |
206 lt->len = ntohl(*(uint32_t *)(bin + 8)); | 207 lt->end = ntohl(*(uint32_t *)(decode + 4)); |
208 lt->len = ntohl(*(uint32_t *)(decode + 8)); | |
207 lt->data = bin + 12; | 209 lt->data = bin + 12; |
208 bin += 12 + lt->len; | 210 bin += 12 + lt->len; |
209 lt++; | 211 lt++; |
210 } | 212 } |
211 | 213 |