Merge branch 'dev' of github.com:mdbtools/mdbtools into dev

This commit is contained in:
Evan Miller 2020-11-12 16:26:48 -05:00
commit 509831205b
2 changed files with 8 additions and 6 deletions

View File

@ -24,8 +24,8 @@
#define DEBUG 1
static unsigned long opts;
static int optset;
static __thread unsigned long opts;
static __thread int optset;
static void load_options(void);
@ -50,9 +50,10 @@ load_options()
{
char *opt;
char *s;
char *ctx;
if (!optset && (s=getenv("MDBOPTS"))) {
opt = strtok(s, ":");
opt = strtok_r(s, ":", &ctx);
while (opt) {
if (!strcmp(opt, "use_index")) opts |= MDB_USE_INDEX;
if (!strcmp(opt, "no_memo")) opts |= MDB_NO_MEMO;
@ -70,7 +71,7 @@ load_options()
opts |= MDB_DEBUG_ROW;
opts |= MDB_DEBUG_PROPS;
}
opt = strtok(NULL,":");
opt = strtok_r(NULL,":", &ctx);
}
}
optset = 1;

View File

@ -760,8 +760,9 @@ int mdb_sql_find_sargcol(MdbSargNode *node, gpointer data)
* Plain integers are UNIX timestamps for backwards compatibility of parser
*/
if (col->col_type == MDB_DATETIME && node->val_type == MDB_INT) {
struct tm *tm = gmtime((time_t*)&node->value.i);
mdb_tm_to_date(tm, &node->value.d);
struct tm tm;
gmtime_r((time_t*)&node->value.i, &tm);
mdb_tm_to_date(&tm, &node->value.d);
node->val_type = MDB_DOUBLE;
}
}