[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kexi/3.1] src/migration/mdb/3rdparty/mdbtools: Minimal fix for mdbtools on Windows (vs 2015)
From:       Jaroslaw Staniek <null () kde ! org>
Date:       2018-02-13 0:55:22
Message-ID: E1elOsU-0007JL-Fc () code ! kde ! org
[Download RAW message or body]

Git commit 94ed3941ccd9a45d6cb03ae90e278726ce4aa8fd by Jaroslaw Staniek.
Committed on 13/02/2018 at 00:53.
Pushed by staniek into branch '3.1'.

Minimal fix for mdbtools on Windows (vs 2015)

M  +4    -0    src/migration/mdb/3rdparty/mdbtools/include/mdbtools.h
M  +5    -2    src/migration/mdb/3rdparty/mdbtools/libmdb/money.c
M  +4    -4    src/migration/mdb/3rdparty/mdbtools/libmdb/props.c
M  +6    -5    src/migration/mdb/3rdparty/mdbtools/libmdb/table.c

https://commits.kde.org/kexi/94ed3941ccd9a45d6cb03ae90e278726ce4aa8fd

diff --git a/src/migration/mdb/3rdparty/mdbtools/include/mdbtools.h \
b/src/migration/mdb/3rdparty/mdbtools/include/mdbtools.h index 68b326fad..91e97740c \
                100644
--- a/src/migration/mdb/3rdparty/mdbtools/include/mdbtools.h
+++ b/src/migration/mdb/3rdparty/mdbtools/include/mdbtools.h
@@ -54,9 +54,13 @@
 #define MDB_NO_BACKENDS 1
 #define MDB_NO_STATS 1
 
+#ifdef _MSC_VER
+#define MDB_DEPRECATED(type, funcname) type funcname
+#else
 // Theses 2 atrbutes are not supported by all compilers:
 // M$VC see http://stackoverflow.com/questions/1113409/attribute-constructor-equivalent-in-vc
  #define MDB_DEPRECATED(type, funcname) type __attribute__((deprecated)) funcname
+#endif
 #define MDB_CONSTRUCTOR(funcname) void __attribute__((constructor)) funcname()
 
 enum {
diff --git a/src/migration/mdb/3rdparty/mdbtools/libmdb/money.c \
b/src/migration/mdb/3rdparty/mdbtools/libmdb/money.c index 488d5701b..0c8c91d61 \
                100644
--- a/src/migration/mdb/3rdparty/mdbtools/libmdb/money.c
+++ b/src/migration/mdb/3rdparty/mdbtools/libmdb/money.c
@@ -42,7 +42,8 @@ static char *array_to_string(unsigned char *array, int unsigned \
                scale, int neg);
  */
 char *mdb_money_to_string(MdbHandle *mdb, int start)
 {
-	int num_bytes=8, scale=4;
+#define num_bytes 8
+	int scale=4;
 	int i;
 	int neg=0;
        unsigned char multiplier[MAX_NUMERIC_PRECISION], temp[MAX_NUMERIC_PRECISION];
@@ -77,10 +78,11 @@ char *mdb_money_to_string(MdbHandle *mdb, int start)
 	}
        return array_to_string(product, scale, neg);
 
+#undef num_bytes
 }
 
 char *mdb_numeric_to_string(MdbHandle *mdb, int start, int prec, int scale) {
-       int num_bytes = 16;
+#define num_bytes 16
        int i;
        int neg=0;
        unsigned char multiplier[MAX_NUMERIC_PRECISION], temp[MAX_NUMERIC_PRECISION];
@@ -104,6 +106,7 @@ char *mdb_numeric_to_string(MdbHandle *mdb, int start, int prec, \
int scale) {  multiply_byte(multiplier, 256, temp);
        }
        return array_to_string(product, scale, neg);
+#undef num_bytes
 }
 
 static int multiply_byte(unsigned char *product, int num, unsigned char *multiplier)
diff --git a/src/migration/mdb/3rdparty/mdbtools/libmdb/props.c \
b/src/migration/mdb/3rdparty/mdbtools/libmdb/props.c index 38e0660de..670d2269a \
                100644
--- a/src/migration/mdb/3rdparty/mdbtools/libmdb/props.c
+++ b/src/migration/mdb/3rdparty/mdbtools/libmdb/props.c
@@ -185,14 +185,14 @@ mdb_kkd_to_props(MdbHandle *mdb, void *buffer, size_t len) {
 
 	pos = 4;
 	while (pos < len) {
-		record_len = mdb_get_int32(buffer, pos);
-		record_type = mdb_get_int16(buffer, pos + 4);
+		record_len = mdb_get_int32(buffer, (int)pos);
+		record_type = mdb_get_int16(buffer, (int)pos + 4);
 		mdb_debug(MDB_DEBUG_PROPS,"prop chunk type:0x%04x len:%d", record_type, \
record_len);  //mdb_buffer_dump(buffer, pos+4, record_len);
 		switch (record_type) {
 			case 0x80:
 				if (names) free_names(names);
-				names = mdb_read_props_list(mdb, buffer+pos+6, record_len - 6);
+				names = mdb_read_props_list(mdb, (gchar *)buffer+pos+6, record_len - 6);
 				break;
 			case 0x00:
 			case 0x01:
@@ -200,7 +200,7 @@ mdb_kkd_to_props(MdbHandle *mdb, void *buffer, size_t len) {
 					fprintf(stderr,"sequence error!\n");
 					break;
 				}
-				props = mdb_read_props(mdb, names, buffer+pos+6, record_len - 6);
+				props = mdb_read_props(mdb, names, (gchar *)buffer+pos+6, record_len - 6);
 				g_array_append_val(result, props);
 				//mdb_dump_props(props, stderr, 1);
 				break;
diff --git a/src/migration/mdb/3rdparty/mdbtools/libmdb/table.c \
b/src/migration/mdb/3rdparty/mdbtools/libmdb/table.c index 2590e5735..896e8fa1a \
                100644
--- a/src/migration/mdb/3rdparty/mdbtools/libmdb/table.c
+++ b/src/migration/mdb/3rdparty/mdbtools/libmdb/table.c
@@ -95,7 +95,7 @@ MdbTableDef *mdb_read_table(MdbCatalogEntry *entry)
 	/* grab a copy of the usage map */
 	pg_row = mdb_get_int32(pg_buf, fmt->tab_usage_map_offset);
 	mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &(table->map_sz));
-	table->usage_map = g_memdup((char*)buf + row_start, table->map_sz);
+	table->usage_map = g_memdup((char*)buf + row_start, (int)table->map_sz);
 	if (mdb_get_option(MDB_DEBUG_USAGE))
 		mdb_buffer_dump(buf, row_start, table->map_sz);
 	mdb_debug(MDB_DEBUG_USAGE,"usage map found on page %ld row %d start %d len %d",
@@ -104,7 +104,7 @@ MdbTableDef *mdb_read_table(MdbCatalogEntry *entry)
 	/* grab a copy of the free space page map */
 	pg_row = mdb_get_int32(pg_buf, fmt->tab_free_map_offset);
 	mdb_find_pg_row(mdb, pg_row, &buf, &row_start, &(table->freemap_sz));
-	table->free_usage_map = g_memdup((char*)buf + row_start, table->freemap_sz);
+	table->free_usage_map = g_memdup((char*)buf + row_start, (int)table->freemap_sz);
 	mdb_debug(MDB_DEBUG_USAGE,"free map found on page %ld row %d start %d len %d\n",
 		pg_row >> 8, pg_row & 0xff, row_start, table->freemap_sz);
 
@@ -166,15 +166,16 @@ read_pg_if_8(MdbHandle *mdb, int *cur_pos)
  * are still advanced and the page cursor is still updated.
  */
 void *
-read_pg_if_n(MdbHandle *mdb, void *buf, int *cur_pos, size_t len)
+read_pg_if_n(MdbHandle *mdb, void *void_buf, int *cur_pos, size_t len)
 {
+	gchar *buf = void_buf;
 	/* Advance to page which contains the first byte */
 	while (*cur_pos >= mdb->fmt->pg_size) {
 		mdb_read_pg(mdb, mdb_get_int32(mdb->pg_buf,4));
-		*cur_pos -= (mdb->fmt->pg_size - 8);
+		*cur_pos -= (int)(mdb->fmt->pg_size - 8);
 	}
 	/* Copy pages into buffer */
-	while (*cur_pos + len >= mdb->fmt->pg_size) {
+	while ((ssize_t)(*cur_pos + len) >= mdb->fmt->pg_size) {
 		int piece_len = mdb->fmt->pg_size - *cur_pos;
 		if (buf) {
 			memcpy(buf, mdb->pg_buf + *cur_pos, piece_len);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic