##// END OF EJS Templates
mpatch: attempt to handle unpack alignment issues on Solaris...
mpm@selenic.com -
r384:a29decbf default
parent child Browse files
Show More
@@ -195,15 +195,17 b' static struct flist *decode(char *bin, i'
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++;
General Comments 0
You need to be logged in to leave comments. Login now