Update of /project/elephant/cvsroot/elephant/src/db-bdb In directory clnet:/tmp/cvs-serv771
Modified Files: libberkeley-db.c Log Message:
Fixed build errors in db-bdb C interface file. This file is not yet complete for serializer2
--- /project/elephant/cvsroot/elephant/src/db-bdb/libberkeley-db.c 2006/12/16 19:35:10 1.2 +++ /project/elephant/cvsroot/elephant/src/db-bdb/libberkeley-db.c 2007/01/16 18:02:27 1.3 @@ -67,7 +67,7 @@ /* Pointer arithmetic utility functions */ /* should these be in network-byte order? probably not..... */ int read_int(char *buf, int offset) { - int int; + int i; memcpy(&i, buf+offset, sizeof(int)); return i; } @@ -79,7 +79,7 @@ }
int32_t read_int32(char *buf, int offset) { - int int32_t; + int32_t i; memcpy(&i, buf+offset, sizeof(int32_t)); return i; } @@ -119,7 +119,7 @@ memcpy(buf+offset, &num, sizeof(int)); }
-void write_uint(char *buf, unsighed int num, int offset) { +void write_uint(char *buf, unsigned int num, int offset) { memcpy(buf+offset, &num, sizeof(unsigned int)); }
@@ -277,6 +277,7 @@
double read_num(char *buf); int case_cmp(const char *a, int32_t length1, const char *b, int32_t length2); +int wcs_cmp(const wchar_t *a, int32_t length1, const wchar_t *b, int32_t length2); int lex_cmp(const char *a, int32_t length1, const char *b, int32_t length2); int utf16_cmp(const char *s1, int32_t length1, const char *s2, int32_t length2); @@ -316,7 +317,7 @@ }
/* Compare types. */ - if + /* ISE: need extra conditional here...forget why, so research it */ difference = at - bt; if (difference) return difference;
@@ -335,7 +336,7 @@ case 20: case 21: case 22: - return wcs_cmp(ad+9, read_int(ad, 5), bd+9, read_int(bd, 5)); + return wcs_cmp((wchar_t*)ad+9, read_int(ad, 5), (wchar_t*)bd+9, read_int(bd, 5)); default: return lex_cmp(ad+5, (a->size)-5, bd+5, (b->size)-5); } @@ -368,33 +369,37 @@
/* Compare numerics. */ if (type_numeric2(at) && type_numeric2(bt)) { - ddifference = read_num2(ad+4) - read_num2(bd+4); + /* ddifference = read_num2(ad+4) - read_num2(bd+4); */ + ddifference = read_num(ad+4) - read_num(bd+4); if (ddifference > 0) return 1; else if (ddifference < 0) return -1; return 0; }
/* Compare types. */ - if + /* ISE: need extra conditional here...forget why, so research it */ difference = at - bt; if (difference) return difference;
- ;; TODO: compare strings of different sizes? - ;; TODO: compare symbol-ids? + /* TODO: compare strings of different sizes? */ + /* TODO: compare symbol-ids? */
/* Same type! */ switch (at) { - case #x3F: /* nil */ + case 0x3F: /* nil */ return 0; case 9: /* 8-bit string */ + return case_cmp(ad+9, read_int32(ad, 5), bd+9, read_int32(bd, 5)); + /* ISE: Why did I do this? if( bt == 9 ) return case_cmp(ad+9, read_int32(ad, 5), bd+9, read_int32(bd, 5)); else return full_cmp(ad+9, read_int32(ad, 5), bd+9, read_int32(bd, 5)) + */ case 10: /* 16-bit string */ return utf16_cmp(ad+9, read_int32(ad, 5), bd+9, read_int32(bd, 5)); case 11: - return wcs_cmp(ad+9, read_int32(ad, 5), bd+9, read_int32(bd, 5)); + return wcs_cmp((wchar_t*)ad+9, read_int32(ad, 5), (wchar_t*)bd+9, read_int32(bd, 5)); default: return lex_cmp(ad+5, (a->size)-5, bd+5, (b->size)-5); } @@ -866,8 +871,8 @@ }
void db_multiple_key_next(void *pointer, DBT *data, - char **key, u_int32_t *ret_key_size, - char **result, u_int32_t *result_size) { + unsigned char **key, u_int32_t *ret_key_size, + unsigned char **result, u_int32_t *result_size) { DB_MULTIPLE_KEY_NEXT(pointer, data, *key, *ret_key_size, *result, *result_size); @@ -875,7 +880,7 @@
/* Transactions */
-DB_TXN * db_txn_begin(DB_ENV *env, DB_TXN *parent, +DB_TXN *db_txn_begin(DB_ENV *env, DB_TXN *parent, u_int32_t flags, int *errno) { DB_TXN * p; *errno = env->txn_begin(env, parent, &p, flags);