summaryrefslogtreecommitdiff
path: root/rpmdb
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2004-03-18 15:29:23 +0000
committerjbj <devnull@localhost>2004-03-18 15:29:23 +0000
commita1a283837a6b70c9ee4731f9172cfc614a1a7c6b (patch)
tree4a7259520f11a18126f78fa95f91fa542a8b4643 /rpmdb
parent73260d956c54a3d95aa7d367c09ed3e2cb2a2a00 (diff)
downloadlibrpm-tizen-a1a283837a6b70c9ee4731f9172cfc614a1a7c6b.tar.gz
librpm-tizen-a1a283837a6b70c9ee4731f9172cfc614a1a7c6b.tar.bz2
librpm-tizen-a1a283837a6b70c9ee4731f9172cfc614a1a7c6b.zip
Resurrect "other endian" rpmdb functionality.
CVS patchset: 7177 CVS date: 2004/03/18 15:29:23
Diffstat (limited to 'rpmdb')
-rw-r--r--rpmdb/dbconfig.c2
-rw-r--r--rpmdb/rpmdb.c24
2 files changed, 19 insertions, 7 deletions
diff --git a/rpmdb/dbconfig.c b/rpmdb/dbconfig.c
index d20327c0c..0a87cd99e 100644
--- a/rpmdb/dbconfig.c
+++ b/rpmdb/dbconfig.c
@@ -437,7 +437,7 @@ dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
}
/*@=sizeoftype@*/
- dbi->dbi_byteswapped = 0; /* -1 unknown, 0 native order, 1 alien order */
+ dbi->dbi_byteswapped = -1; /* -1 unknown, 0 native order, 1 alien order */
if (!dbi->dbi_use_dbenv) { /* db3 dbenv is always used now. */
dbi->dbi_use_dbenv = 1;
diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c
index 409a56540..4803818fb 100644
--- a/rpmdb/rpmdb.c
+++ b/rpmdb/rpmdb.c
@@ -2200,9 +2200,15 @@ top:
/* Don't bother re-checking a previously read header. */
if (mi->mi_db->db_bits) {
- pbm_set * set = PBM_REALLOC((pbm_set **)&mi->mi_db->db_bits,
- &mi->mi_db->db_nbits, mi->mi_offset);
- if (PBM_ISSET(mi->mi_offset, set))
+ pbm_set * set;
+union _dbswap mi_offset;
+
+memcpy(&mi_offset.ui, &mi->mi_offset, sizeof(mi_offset.ui));
+if (dbiByteSwapped(dbi) == 1)
+ _DBSWAP(mi_offset);
+ set = PBM_REALLOC((pbm_set **)&mi->mi_db->db_bits,
+ &mi->mi_db->db_nbits, mi_offset.ui);
+ if (PBM_ISSET(mi_offset.ui, set))
rpmrc = RPMRC_OK;
}
@@ -2220,9 +2226,15 @@ top:
/* Mark header checked. */
if (mi->mi_db && mi->mi_db->db_bits && rpmrc == RPMRC_OK) {
- pbm_set * set = PBM_REALLOC((pbm_set **)&mi->mi_db->db_bits,
- &mi->mi_db->db_nbits, mi->mi_offset);
- PBM_SET(mi->mi_offset, set);
+ pbm_set * set;
+union _dbswap mi_offset;
+
+memcpy(&mi_offset.ui, &mi->mi_offset, sizeof(mi_offset.ui));
+if (dbiByteSwapped(dbi) == 1)
+ _DBSWAP(mi_offset);
+ set = PBM_REALLOC((pbm_set **)&mi->mi_db->db_bits,
+ &mi->mi_db->db_nbits, mi_offset.ui);
+ PBM_SET(mi_offset.ui, set);
}
/* Skip damaged and inconsistent headers. */