From 099bc9342f825a8d970bb888f16a5c0e271686ae Mon Sep 17 00:00:00 2001 From: Michal Labedzki Date: Mon, 23 Jun 2014 08:25:15 +0200 Subject: [PATCH] Logcat: Remove commented code "g_strlcpy" guarante that "dest" to be null-terminated. Also cosmetic change from file_subtype to encap. Change-Id: If188a08cf34dd9def4203404962571c273740636 Reviewed-on: https://code.wireshark.org/review/2718 Reviewed-by: Michal Labedzki --- wiretap/logcat.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/wiretap/logcat.c b/wiretap/logcat.c index 18f9910de5..1f34e0a690 100644 --- a/wiretap/logcat.c +++ b/wiretap/logcat.c @@ -320,8 +320,8 @@ gboolean logcat_binary_dump_open(wtap_dumper *wdh, int *err) wdh->subtype_write = logcat_binary_dump; wdh->subtype_close = NULL; - switch (wdh->file_type_subtype) { - case WTAP_FILE_TYPE_SUBTYPE_LOGCAT: + switch (wdh->encap) { + case WTAP_ENCAP_LOGCAT: wdh->tsprecision = WTAP_FILE_TSPREC_USEC; break; @@ -383,9 +383,7 @@ static gboolean logcat_dump_text(wtap_dumper *wdh, while (dumper->type != DUMP_LONG && (str_end = strchr(str_begin, '\n'))) { log_part = (gchar *) g_malloc(str_end - str_begin + 1); g_strlcpy(log_part, str_begin, str_end - str_begin + 1); -#if 0 - log_part[str_end - str_begin] = '\0'; -#endif + str_begin = str_end + 1; buf = logcat_log(dumper, *datetime, *nanoseconds / 1000000, *pid, *tid, @@ -410,9 +408,6 @@ static gboolean logcat_dump_text(wtap_dumper *wdh, if (*str_begin != '\0') { log_part = (gchar *) g_malloc(strlen(str_begin) + 1); g_strlcpy(log_part, str_begin, strlen(str_begin) + 1); -#if 0 - log_part[strlen(str_begin)] = '\0'; -#endif buf = logcat_log(dumper, *datetime, *nanoseconds / 1000000, *pid, *tid, priority, tag, log_part);