Changeset 7c91cdd in subsurface


Ignore:
Timestamp:
Feb 10, 2017, 8:30:58 PM (2 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
f7045c5
Parents:
032c325
git-author:
Salvador Cuñat <salvador.cunat@…> (01/22/17 04:43:10)
git-committer:
Dirk Hohndel <dirk@…> (02/10/17 20:30:58)
Message:

smtk-import-Fix crash due to localization issues

Libmdbº:xturns localized strings while parsing the data bases. This is
bad for time calculations as we may end with different strings formats
(e.g. en_US vs almost the rest of the world). Solution is simple: set a
fixed locale and parse only this format.

Signed-off-by: Salvador Cuñat <salvador.cunat@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • smtk-import/smartrak.c

    r2226776 r7c91cdd  
    2828#include <mdbtools.h>
    2929#include <stdarg.h>
     30#include <locale.h>
    3031
    3132#include "core/dive.h"
     
    105106        char *temp = NULL;
    106107
    107         temp = rindex(copy_string(t_buffer), ' ');
     108        temp = index(copy_string(t_buffer), ' ');
    108109        if (temp)
    109110                strptime(temp, "%X", tm_date);
     
    656657        MdbTableDef *mdb_table;
    657658        MdbColumn *col[MDB_MAX_COLS];
    658 
    659659        char *bound_values[MDB_MAX_COLS];
    660660        int i, dc_model;
    661661
     662        // Set an european style locale to work date/time conversion
     663        setlocale(LC_TIME, "POSIX");
    662664        mdb = mdb_open(file, MDB_NOFLAGS);
    663665        if (!mdb) {
Note: See TracChangeset for help on using the changeset viewer.