mirror of
https://github.com/mdbtools/mdbtools.git
synced 2026-03-10 00:20:54 +08:00
unicode compression for Access 2000
This commit is contained in:
@@ -10,6 +10,11 @@
|
||||
#include <limits.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
@@ -20,8 +25,9 @@ int main(int argc, char **argv)
|
||||
int length;
|
||||
int pg=0;
|
||||
char addr[10];
|
||||
int jet4 = 0;
|
||||
|
||||
if (argc < 2) {
|
||||
if (argc < 1) {
|
||||
fprintf(stderr, "Usage: mdb-dump <filename>\n\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -29,9 +35,15 @@ int main(int argc, char **argv)
|
||||
fprintf(stderr, "Couldn't open file %s\n", argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
fseek(in,0x14,SEEK_SET);
|
||||
fread(data,1,1,in);
|
||||
if (data[0]==0x01) {
|
||||
jet4 = 1;
|
||||
}
|
||||
fseek(in,0,SEEK_SET);
|
||||
while (length = fread(data,1,16,in)) {
|
||||
sprintf(addr, "%06x", i);
|
||||
if (!strcmp(&addr[3],"000") ) { //|| ! strcmp(&addr[3],"800")) {
|
||||
if (!strcmp(&addr[3],"000") || (!jet4 && !strcmp(&addr[3],"800"))) {
|
||||
fprintf(stdout,"-- Page 0x%04x (%d) --\n", pg, pg);
|
||||
pg++;
|
||||
}
|
||||
|
||||
@@ -433,9 +433,22 @@ int i;
|
||||
return "";
|
||||
}
|
||||
if (mdb->jet_version==MDB_VER_JET4) {
|
||||
for (i=0;i<size;i+=2)
|
||||
text[i/2] = mdb->pg_buf[start + i];
|
||||
text[size/2]='\0';
|
||||
/*
|
||||
for (i=0;i<size;i++) {
|
||||
fprintf(stdout, "%c %02x ", mdb->pg_buf[start+i], mdb->pg_buf[start+i]);
|
||||
}
|
||||
fprintf(stdout, "\n");
|
||||
*/
|
||||
if (mdb->pg_buf[start]==0xff &&
|
||||
mdb->pg_buf[start+1]==0xfe) {
|
||||
strncpy(text, &mdb->pg_buf[start+2], size-2);
|
||||
text[size-2]='\0';
|
||||
} else {
|
||||
/* convert unicode to ascii, rather sloppily */
|
||||
for (i=0;i<size;i+=2)
|
||||
text[i/2] = mdb->pg_buf[start + i];
|
||||
text[size/2]='\0';
|
||||
}
|
||||
} else {
|
||||
strncpy(text, &mdb->pg_buf[start], size);
|
||||
text[size]='\0';
|
||||
|
||||
@@ -73,6 +73,7 @@ MdbTableDef *table;
|
||||
}
|
||||
void mdb_free_tabledef(MdbTableDef *table)
|
||||
{
|
||||
if (table->usage_map) free(table->usage_map);
|
||||
if (table) free(table);
|
||||
}
|
||||
mdb_append_column(GPtrArray *columns, MdbColumn *in_col)
|
||||
|
||||
Reference in New Issue
Block a user