Logcat text: small fixes

* fix exporting "beginning of" frame logs into info field
  * add missing "Failure" level to regexp in wiretap part
  * remove usage of GDateTime from wiretap part

Change-Id: Ibdea730623241cccbbc1694a34daa308e48c0a89
Reviewed-on: https://code.wireshark.org/review/3493
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
Michał Orynicz 2014-08-08 09:06:38 +02:00 committed by Pascal Quantin
parent ad4d672976
commit 735263e58e
2 changed files with 10 additions and 10 deletions

View File

@ -220,7 +220,7 @@ static int dissect_logcat_text(tvbuff_t *tvb, proto_tree *tree, packet_info *pin
} else {
tokens = g_regex_split(special_regex, frame, G_REGEX_MATCH_NOTEMPTY);
if (NULL == tokens) return 0;
get_log(frame, tokens[1], tvb, maintree, 0, pinfo);
offset = get_log(frame, tokens[1], tvb, maintree, 0, pinfo);
}
g_strfreev(tokens);
return offset;

View File

@ -34,7 +34,7 @@
#define SPECIAL_STRING "[-]+ beginning of \\/"
#define BRIEF_STRING "[IVDWEF]/.*\\( *\\d*\\): .*"
#define TAG_STRING "[IVDWEF]/.*: .*"
#define TIME_STRING "\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\\.\\d{3} [IVDWE]/.*\\( *\\d*\\): .*"
#define TIME_STRING "\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\\.\\d{3} [IVDWEF]/.*\\( *\\d*\\): .*"
#define THREAD_STRING "[IVDWEF]\\( *\\d+: *\\d+\\) .*"
#define PROCESS_STRING "[IVDWEF]\\( *\\d+\\) .*"
#define THREADTIME_STRING "\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}\\.\\d{3} *\\d+ *\\d+ [IVDWEF] .+: +"
@ -156,18 +156,18 @@ static gchar *logcat_log(const struct dumper_t *dumper, guint32 seconds,
}
static void get_time(gchar *string, struct wtap_pkthdr *phdr) {
gint day, month, hrs, min, sec, ms;
GDateTime *date = NULL;
gint64 seconds;
gint ms;
struct tm date;
time_t seconds;
if (6 == sscanf(string, "%d-%d %d:%d:%d.%d", &month, &day, &hrs, &min, &sec, &ms)) {
date = g_date_time_new_local(1970, month, day, hrs, min,
(gdouble) sec + ((gdouble) ms) * 0.001);
seconds = g_date_time_to_unix(date);
if (6 == sscanf(string, "%d-%d %d:%d:%d.%d", &date.tm_mon, &date.tm_mday, &date.tm_hour,
&date.tm_min, &date.tm_sec, &ms)) {
date.tm_year = 70;
date.tm_mon -= 1;
seconds = mktime(&date);
phdr->ts.secs = (time_t) seconds;
phdr->ts.nsecs = (int) (ms * 1e6);
phdr->presence_flags = WTAP_HAS_TS;
g_date_time_unref(date);
} else {
phdr->presence_flags = 0;
phdr->ts.secs = (time_t) 0;