Merge branch 'master' into no-glib

This commit is contained in:
Evan Miller 2020-08-04 23:53:50 -04:00
commit bcc6defe94
12 changed files with 91 additions and 12 deletions

View File

@ -19,3 +19,15 @@ before_script:
script:
- ./configure --disable-man --disable-silent-rules
- make
- ./src/util/mdb-array test/data/ASampleDatabase.accdb "Asset Items"
- ./src/util/mdb-array test/data/nwind.mdb "Customers"
- ./src/util/mdb-count test/data/ASampleDatabase.accdb "Asset Items"
- ./src/util/mdb-count test/data/nwind.mdb "Customers"
- ./src/util/mdb-prop test/data/ASampleDatabase.accdb "Asset Items"
- ./src/util/mdb-prop test/data/nwind.mdb "Customers"
- ./src/util/mdb-schema test/data/ASampleDatabase.accdb
- ./src/util/mdb-schema test/data/nwind.mdb
- ./src/util/mdb-tables test/data/ASampleDatabase.accdb
- ./src/util/mdb-tables test/data/nwind.mdb
- ./src/util/mdb-ver test/data/ASampleDatabase.accdb
- ./src/util/mdb-ver test/data/nwind.mdb

View File

@ -1,4 +1,5 @@
[![Build Status](https://travis-ci.org/evanmiller/mdbtools.svg?branch=master)](https://travis-ci.org/evanmiller/mdbtools)
[![Build status](https://ci.appveyor.com/api/projects/status/22wwy5d0rrmk6e3c/branch/master?svg=true)](https://ci.appveyor.com/project/evanmiller/mdbtools/branch/master)
MDB Tools, where open source goes to die.

48
appveyor.yml Normal file
View File

@ -0,0 +1,48 @@
version: 0.1.{build}
os: Windows Server 2012 R2
platform: x64
environment:
matrix:
- TOOLCHAIN: "msys2"
- TOOLCHAIN: "cygwin"
branches:
only:
- master
clone_folder: c:\projects\mdbtools
skip_tags: true
build_script:
- ps: |
if ($env:TOOLCHAIN -eq "msys2")
{
$env:MSYSTEM="MINGW64"
C:\msys64\usr\bin\bash -l -c "pacman -S --noconfirm mingw-w64-x86_64-glib2"
C:\msys64\usr\bin\bash -l -c "cd /c/projects/mdbtools && autoreconf -i -f"
C:\msys64\usr\bin\bash -l -c "cd /c/projects/mdbtools && ./configure --disable-man --disable-silent-rules"
C:\msys64\usr\bin\bash -l -c "cd /c/projects/mdbtools && make"
}
else
{
C:\cygwin64\setup-x86_64.exe -qP libglib2.0-devel
C:\cygwin64\bin\sh -lc "cd /cygdrive/c/projects/mdbtools && autoreconf -i -f"
C:\cygwin64\bin\sh -lc "cd /cygdrive/c/projects/mdbtools && ./configure --disable-man --disable-silent-rules"
C:\cygwin64\bin\sh -lc "cd /cygdrive/c/projects/mdbtools && make"
}
test_script:
- ps: |
if ($env:TOOLCHAIN -eq "msys2")
{
$env:MSYSTEM="MINGW64"
C:\msys64\usr\bin\bash -l -c "cd /c/projects/mdbtools && ./src/util/mdb-count ./test/data/nwind.mdb Customers"
}
else
{
C:\cygwin64\bin\sh -lc "cd /cygdrive/c/projects/mdbtools && ./src/util/mdb-count ./test/data/nwind.mdb Customers"
}

View File

@ -12,7 +12,7 @@ AC_PROG_CC(gcc)
dnl Checks for programs.
AC_PROG_MAKE_SET
m4_pattern_allow([AM_PROG_AR], [AM_PROG_AR])
LT_INIT
LT_INIT([win32-dll])
AC_PROG_LEX
AC_PROG_YACC
@ -62,6 +62,8 @@ AC_SUBST(SQL)
AC_SUBST(LFLAGS)
CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
AS_CASE([$host],
[*mingw*|*cygwin*], [LDFLAGS="$LDFLAGS -no-undefined"], [])
dnl Enable -Wl,--as-needed by default to prevent overlinking
AC_ARG_ENABLE([as-needed],

View File

@ -372,7 +372,7 @@ static ssize_t _mdb_read_pg(MdbHandle *mdb, void *pg_buf, unsigned long pg)
fstat(mdb->f->fd, &status);
if (status.st_size < offset) {
fprintf(stderr,"offset %jd is beyond EOF\n",(intmax_t)offset);
fprintf(stderr,"offset %" PRIu64 " is beyond EOF\n",(uint64_t)offset);
return 0;
}
if (mdb->stats && mdb->stats->collect)

View File

@ -88,11 +88,8 @@ mdb_unicode2ascii(MdbHandle *mdb, char *src, size_t slen, char *dest, size_t dle
dlen -= len_out;
#else
if (IS_JET3(mdb)) {
size_t copy_len = len_in;
if (copy_len > dlen)
copy_len = dlen;
strncpy(out_ptr, in_ptr, copy_len);
dlen = copy_len;
dlen = MIN(len_in, len_out);
strncpy(out_ptr, in_ptr, dlen);
} else {
/* rough UCS-2LE to ISO-8859-1 conversion */
unsigned int i;

View File

@ -131,6 +131,23 @@ mdb_read_props(MdbHandle *mdb, GPtrArray *names, gchar *kkd, int len)
if (dtype == MDB_BOOL) {
g_hash_table_insert(props->hash, g_strdup(name),
g_strdup(kkd[pos + 8] ? "yes" : "no"));
} else if (dtype == MDB_BINARY && dsize == 16 && strcmp(name, "GUID") == 0) {
gchar *guid = g_malloc0(39);
snprintf(guid, 39, "{%02X%02X%02X%02X" "-" "%02X%02X" "-" "%02X%02X"
"-" "%02X%02X" "%02X%02X%02X%02X%02X%02X}",
(unsigned char)kkd[pos+11], (unsigned char)kkd[pos+10],
(unsigned char)kkd[pos+9], (unsigned char)kkd[pos+8], // little-endian
(unsigned char)kkd[pos+13], (unsigned char)kkd[pos+12], // little-endian
(unsigned char)kkd[pos+15], (unsigned char)kkd[pos+14], // little-endian
(unsigned char)kkd[pos+16], (unsigned char)kkd[pos+17], // big-endian
(unsigned char)kkd[pos+18], (unsigned char)kkd[pos+19],
(unsigned char)kkd[pos+20], (unsigned char)kkd[pos+21],
(unsigned char)kkd[pos+22], (unsigned char)kkd[pos+23]); // big-endian
g_hash_table_insert(props->hash, g_strdup(name), guid);
} else {
g_hash_table_insert(props->hash, g_strdup(name),
mdb_col_to_string(mdb, kkd, pos + 8, dtype, dsize));

View File

@ -81,7 +81,7 @@ mdb_write_pg(MdbHandle *mdb, unsigned long pg)
fstat(mdb->f->fd, &status);
/* is page beyond current size + 1 ? */
if (status.st_size < offset + mdb->fmt->pg_size) {
fprintf(stderr,"offset %jd is beyond EOF\n",(intmax_t)offset);
fprintf(stderr,"offset %" PRIu64 " is beyond EOF\n",(uint64_t)offset);
return 0;
}
lseek(mdb->f->fd, offset, SEEK_SET);

View File

@ -32,9 +32,10 @@
#ifdef HAVE_STRPTIME
#include <time.h>
#include <stdio.h>
#include <locale.h>
#endif
#include <locale.h>
char *g_input_ptr;
/* Prevent warnings from -Wmissing-prototypes. */
@ -52,6 +53,8 @@ int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */
static MdbSargNode * mdb_sql_alloc_node(void);
void
mdb_sql_error(MdbSQL* sql, char *fmt, ...)
{
@ -204,7 +207,7 @@ MdbHandle *mdb_sql_open(MdbSQL *sql, char *db_name)
return sql->mdb;
}
MdbSargNode *
static MdbSargNode *
mdb_sql_alloc_node()
{
return (MdbSargNode *) g_malloc0(sizeof(MdbSargNode));

View File

@ -122,6 +122,7 @@ FILE *cfile;
fprintf (cfile, "\tdump_string (x.");
break;
default:
fprintf(stderr, "ERROR: unsupported type: 0x%02x\n", col->col_type);
unsupported = 1;
break;
}
@ -147,8 +148,6 @@ FILE *cfile;
mdb_close (mdb);
if (unsupported)
fputs("ERROR: unsupported type.\n", stderr);
exit(unsupported);
}

Binary file not shown.

BIN
test/data/nwind.mdb Normal file

Binary file not shown.