mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-07-16 10:54:40 +08:00
Fix bug in storing variable-length field offsets
This commit is contained in:
parent
84f4d7b812
commit
e33c909174
@ -2,6 +2,7 @@ Tue Aug 24 21:04:17 CDT 2004 Jeff Smith <whydoubt@yahoo.com>
|
|||||||
* include/mdbsql.h:
|
* include/mdbsql.h:
|
||||||
* src/sql/mdbsql.c: Tidy up a few SQL-related functions
|
* src/sql/mdbsql.c: Tidy up a few SQL-related functions
|
||||||
* src/libmdb/iconv.c: Tighten packing of strings into rows
|
* src/libmdb/iconv.c: Tighten packing of strings into rows
|
||||||
|
* src/libmdb/write.c: Fix bug in storing variable-length field offsets
|
||||||
|
|
||||||
Sat Aug 21 21:21:56 CDT 2004 Jeff Smith <whydoubt@yahoo.com>
|
Sat Aug 21 21:21:56 CDT 2004 Jeff Smith <whydoubt@yahoo.com>
|
||||||
* src/libmdb/file.c: Clean up a bug in the new mdb_get_single/double
|
* src/libmdb/file.c: Clean up a bug in the new mdb_get_single/double
|
||||||
|
@ -423,9 +423,11 @@ mdb_pack_row4(MdbTableDef *table, unsigned char *row_buffer, unsigned int num_fi
|
|||||||
pos += 2;
|
pos += 2;
|
||||||
|
|
||||||
/* Offsets of the variable-length columns */
|
/* Offsets of the variable-length columns */
|
||||||
for (i=num_fields; i>num_fields-var_cols; i--) {
|
for (i=num_fields; i>0; i--) {
|
||||||
row_buffer[pos++] = fields[i-1].offset & 0xff;
|
if (!fields[i-1].is_fixed) {
|
||||||
row_buffer[pos++] = (fields[i-1].offset >> 8) & 0xff;
|
row_buffer[pos++] = fields[i-1].offset & 0xff;
|
||||||
|
row_buffer[pos++] = (fields[i-1].offset >> 8) & 0xff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* Number of variable-length columns */
|
/* Number of variable-length columns */
|
||||||
row_buffer[pos++] = var_cols & 0xff;
|
row_buffer[pos++] = var_cols & 0xff;
|
||||||
@ -468,10 +470,14 @@ mdb_pack_row3(MdbTableDef *table, unsigned char *row_buffer, unsigned int num_fi
|
|||||||
row_buffer[pos] = pos;
|
row_buffer[pos] = pos;
|
||||||
pos++;
|
pos++;
|
||||||
|
|
||||||
for (i=num_fields;i>num_fields-var_cols;i--) {
|
for (i=num_fields; i>0; i--) {
|
||||||
row_buffer[pos++] = fields[i-1].offset % 256;
|
if (!fields[i-1].is_fixed) {
|
||||||
|
row_buffer[pos++] = fields[i-1].offset & 0xff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME: jump table goes here */
|
||||||
|
|
||||||
row_buffer[pos++] = var_cols;
|
row_buffer[pos++] = var_cols;
|
||||||
|
|
||||||
pos += mdb_pack_null_mask(&row_buffer[pos], num_fields, fields);
|
pos += mdb_pack_null_mask(&row_buffer[pos], num_fields, fields);
|
||||||
|
Loading…
Reference in New Issue
Block a user