diff options
author | Salvador Cuñat <salvador.cunat@gmail.com> | 2017-06-11 17:24:08 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-06-11 13:50:59 -0700 |
commit | bde73f05d44d633aac320122eacd76df2ae64dc4 (patch) | |
tree | 54ce2ac6cb2341219eaf7c53f5fed0a152fd69f2 | |
parent | 95ee57915027b41040e57fdeac8cd8e0b6be306d (diff) | |
download | subsurface-bde73f05d44d633aac320122eacd76df2ae64dc4.tar.gz |
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@gmail.com>
-rw-r--r-- | smtk-import/smartrak.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/smtk-import/smartrak.c b/smtk-import/smartrak.c index 3997975de..6b952062c 100644 --- a/smtk-import/smartrak.c +++ b/smtk-import/smartrak.c @@ -116,10 +116,10 @@ static void smtk_date_to_tm(char *d_buffer, struct tm *tm_date) */ static void smtk_time_to_tm(char *t_buffer, struct tm *tm_date) { - unsigned int n, hr, min, sec; + int n, hr, min, sec; if ((t_buffer) && (!same_string(t_buffer, ""))) { - n = sscanf(t_buffer, "%*m[/0-9] %d:%d:%d ", &hr, &min, &sec); + n = sscanf(t_buffer, "%*[0-9/] %d:%d:%d ", &hr, &min, &sec); if (n == 3) { tm_date->tm_hour = hr; tm_date->tm_min = min; @@ -141,10 +141,10 @@ static void smtk_time_to_tm(char *t_buffer, struct tm *tm_date) */ static unsigned int smtk_time_to_secs(char *t_buffer) { - unsigned int n, hr, min, sec; + int n, hr, min, sec; if (!same_string(t_buffer, "")) { - n = sscanf(t_buffer, "%*m[/0-9] %d:%d:%d ", &hr, &min, &sec); + n = sscanf(t_buffer, "%*[0-9/] %d:%d:%d ", &hr, &min, &sec); return((n == 3) ? (((hr*60)+min)*60)+sec : 0); } else { return 0; |