diff options
author | Dario Lombardo <lomato@gmail.com> | 2015-10-06 13:55:07 +0200 |
---|---|---|
committer | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2015-10-09 11:40:29 +0000 |
commit | 5f2576be3b7d9fa7240647719927d65279bcdf0a (patch) | |
tree | 148cc334cfd1cc383bb05c77936c65d646a6d4a2 /wiretap | |
parent | 2bd7c48b44af5ebedefdb4c98d1b8cb708463881 (diff) |
catapult_dct2000: code restyle
Remove a clang 3.7 complain.
Change-Id: I5237b130dcd0ffd3a4ea61a3c98fa344fddbe633
Reviewed-on: https://code.wireshark.org/review/10834
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/catapult_dct2000.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/wiretap/catapult_dct2000.c b/wiretap/catapult_dct2000.c index bdf34c8ffa..764df9e993 100644 --- a/wiretap/catapult_dct2000.c +++ b/wiretap/catapult_dct2000.c @@ -1565,7 +1565,6 @@ packet_offset_hash_func(gconstpointer v) static gboolean get_file_time_stamp(gchar *linebuff, time_t *secs, guint32 *usecs) { - int n; struct tm tm; #define MAX_MONTH_LETTERS 9 char month[MAX_MONTH_LETTERS+1]; @@ -1578,12 +1577,14 @@ get_file_time_stamp(gchar *linebuff, time_t *secs, guint32 *usecs) return FALSE; } - /**************************************************************/ - /* First is month. Read until get a space following the month */ - for (n=0; (linebuff[n] != ' ') && (n < MAX_MONTH_LETTERS); n++) { - month[n] = linebuff[n]; + /********************************************************/ + /* Scan for all fields */ + scan_found = sscanf(linebuff, "%9s %2d, %4d %2d:%2d:%2d.%4u", + month, &day, &year, &hour, &minute, &second, usecs); + if (scan_found != 7) { + /* Give up if not all found */ + return FALSE; } - month[n] = '\0'; if (strcmp(month, "January" ) == 0) tm.tm_mon = 0; else if (strcmp(month, "February" ) == 0) tm.tm_mon = 1; @@ -1601,17 +1602,6 @@ get_file_time_stamp(gchar *linebuff, time_t *secs, guint32 *usecs) /* Give up if not found a properly-formatted date */ return FALSE; } - /* Skip space char */ - n++; - - /********************************************************/ - /* Scan for remaining numerical fields */ - scan_found = sscanf(linebuff+n, "%2d, %4d %2d:%2d:%2d.%4u", - &day, &year, &hour, &minute, &second, usecs); - if (scan_found != 6) { - /* Give up if not all found */ - return FALSE; - } /******************************************************/ /* Fill in remaining fields and return it in a time_t */ |