Changeset bde73f0 in subsurface


Ignore:
Timestamp:
Jun 11, 2017, 1:50:59 PM (13 days ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
8faf33e
Parents:
95ee579
git-author:
Salvador Cuñat <salvador.cunat@…> (06/11/17 08:24:08)
git-committer:
Dirk Hohndel <dirk@…> (06/11/17 13:50:59)
Message:

smtk-import portability: avoid using %m[] in sscanf

As Lubomir pointed out in his patch for datatrak.c, the format option %m
for sscanf doesn't work in mingw/windows. Fortunately it's unnecessary
as dates are dropped and we just get times.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • smtk-import/smartrak.c

    r95ee579 rbde73f0  
    117117static void smtk_time_to_tm(char *t_buffer, struct tm *tm_date)
    118118{
    119         unsigned int n, hr, min, sec;
     119        int n, hr, min, sec;
    120120
    121121        if ((t_buffer) && (!same_string(t_buffer, ""))) {
    122                 n = sscanf(t_buffer, "%*m[/0-9] %d:%d:%d ", &hr, &min, &sec);
     122                n = sscanf(t_buffer, "%*[0-9/] %d:%d:%d ", &hr, &min, &sec);
    123123                if (n == 3) {
    124124                        tm_date->tm_hour = hr;
     
    142142static unsigned int smtk_time_to_secs(char *t_buffer)
    143143{
    144         unsigned int n, hr, min, sec;
     144        int n, hr, min, sec;
    145145
    146146        if (!same_string(t_buffer, "")) {
    147                 n = sscanf(t_buffer, "%*m[/0-9] %d:%d:%d ", &hr, &min, &sec);
     147                n = sscanf(t_buffer, "%*[0-9/] %d:%d:%d ", &hr, &min, &sec);
    148148                return((n == 3) ? (((hr*60)+min)*60)+sec : 0);
    149149        } else {
Note: See TracChangeset for help on using the changeset viewer.