Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/db/btree When storing data size as 32bit int in an ...



details:   https://anonhg.NetBSD.org/src/rev/e447ebd26fb8
branches:  trunk
changeset: 556936:e447ebd26fb8
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Dec 30 21:20:16 2003 +0000

description:
When storing data size as 32bit int in an overflow page, copy the
length to a temporary u_int32_t variable and memmove from there to the
final destination - instead of copying the first four 0 bytes from a
64bit variable directly on big endian 64 bit platforms.

This makes sparc64 pass regress/lib/libc/db.

diffstat:

 lib/libc/db/btree/bt_put.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 7ee3a180f580 -r e447ebd26fb8 lib/libc/db/btree/bt_put.c
--- a/lib/libc/db/btree/bt_put.c        Tue Dec 30 21:08:26 2003 +0000
+++ b/lib/libc/db/btree/bt_put.c        Tue Dec 30 21:20:16 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bt_put.c,v 1.13 2003/08/07 16:42:41 agc Exp $  */
+/*     $NetBSD: bt_put.c,v 1.14 2003/12/30 21:20:16 martin Exp $       */
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)bt_put.c   8.8 (Berkeley) 7/26/94";
 #else
-__RCSID("$NetBSD: bt_put.c,v 1.13 2003/08/07 16:42:41 agc Exp $");
+__RCSID("$NetBSD: bt_put.c,v 1.14 2003/12/30 21:20:16 martin Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -80,7 +80,7 @@
        PAGE *h;
        indx_t idx, nxtindex;
        pgno_t pg;
-       u_int32_t nbytes;
+       u_int32_t nbytes, temp;
        int dflags, exact, status;
        char *dest, db[NOVFLSIZE], kb[NOVFLSIZE];
 
@@ -144,8 +144,9 @@
                        tdata.data = db;
                        tdata.size = NOVFLSIZE;
                        memmove(db, &pg, sizeof(pgno_t));
+                       temp = data->size;
                        memmove(db + sizeof(pgno_t),
-                           &data->size, sizeof(u_int32_t));
+                           &temp, sizeof(u_int32_t));
                        dflags |= P_BIGDATA;
                        data = &tdata;
                }



Home | Main Index | Thread Index | Old Index