]> git.saurik.com Git - apple/libc.git/blob - db/hash/FreeBSD/hash_page.c.patch
Libc-391.4.3.tar.gz
[apple/libc.git] / db / hash / FreeBSD / hash_page.c.patch
1 --- hash_page.c.orig 2006-04-22 23:04:55.000000000 -0700
2 +++ hash_page.c 2006-04-23 00:23:46.000000000 -0700
3 @@ -74,7 +74,7 @@
4 #include <db.h>
5 #include "hash.h"
6 #include "page.h"
7 -#include "extern.h"
8 +#include "hash_extern.h"
9
10 static u_int32_t *fetch_bitmap(HTAB *, int);
11 static u_int32_t first_free(u_int32_t);
12 @@ -586,7 +586,7 @@
13 int is_bucket, is_bitmap;
14 {
15 int fd, page, size;
16 - int wsize;
17 + int wsize, max;
18
19 size = hashp->BSIZE;
20 if ((hashp->fp == -1) && open_temp(hashp))
21 @@ -595,7 +595,6 @@
22
23 if (hashp->LORDER != BYTE_ORDER) {
24 int i;
25 - int max;
26
27 if (is_bitmap) {
28 max = hashp->BSIZE >> 2; /* divide by 4 */
29 @@ -619,6 +618,18 @@
30 errno = EFTYPE;
31 return (-1);
32 }
33 + /* 4485533 - reswap the in-memory copy */
34 + if (hashp->LORDER != BYTE_ORDER) {
35 + int i;
36 +
37 + if (is_bitmap) {
38 + for (i = 0; i < max; i++)
39 + M_32_SWAP(((int *)p)[i]);
40 + } else {
41 + for (i = 0; i <= max; i++)
42 + M_16_SWAP(((u_int16_t *)p)[i]);
43 + }
44 + }
45 return (0);
46 }
47