diff options
Diffstat (limited to 'ext/repo_rpmdb_bdb.h')
-rw-r--r-- | ext/repo_rpmdb_bdb.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/ext/repo_rpmdb_bdb.h b/ext/repo_rpmdb_bdb.h index ed82a69..ae477f7 100644 --- a/ext/repo_rpmdb_bdb.h +++ b/ext/repo_rpmdb_bdb.h @@ -22,7 +22,13 @@ #endif #ifdef RPM5 -# define RPM_INDEX_SIZE 4 /* just the rpmdbid */ +# include <rpm/rpmversion.h> +# if RPMLIB_VERSION < RPMLIB_VERSION_ENCODE(5,3,_,0,0,_) +# define RPM_INDEX_SIZE 8 /* rpmdbid + array index */ +# else +# define RPM_INDEX_SIZE 4 /* just the rpmdbid */ +# define RPM5_BIG_ENDIAN_ID +#endif #else # define RPM_INDEX_SIZE 8 /* rpmdbid + array index */ #endif @@ -66,11 +72,10 @@ stat_database(struct rpmdbstate *state, char *dbname, struct stat *statbuf, int return 0; } - static inline Id db2rpmdbid(unsigned char *db, int byteswapped) { -#ifdef RPM5 +#ifdef RPM5_BIG_ENDIAN_ID return db[0] << 24 | db[1] << 16 | db[2] << 8 | db[3]; #else # if defined(WORDS_BIGENDIAN) @@ -87,7 +92,7 @@ db2rpmdbid(unsigned char *db, int byteswapped) static inline void rpmdbid2db(unsigned char *db, Id id, int byteswapped) { -#ifdef RPM5 +#ifdef RPM5_BIG_ENDIAN_ID db[0] = id >> 24, db[1] = id >> 16, db[2] = id >> 8, db[3] = id; #else # if defined(WORDS_BIGENDIAN) |