equal
deleted
inserted
replaced
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 |