From 5e9acd64be74078f256a764bb86c122779e75484 Mon Sep 17 00:00:00 2001 From: shenchenkai Date: Wed, 10 Nov 2021 18:29:15 +0800 Subject: [PATCH] Description:[fix] fix compile warning problem Change-Id: If3b264e1e599af46cdaec8ababc8a13c64480701 Signed-off-by: shenchenkai --- command/hilog_command.c | 7 ++++--- command/hilog_command.h | 6 +++--- services/apphilogcat/hiview_applogcat.c | 2 +- services/hilogcat/hiview_logcat.c | 3 ++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/command/hilog_command.c b/command/hilog_command.c index e117dac..5d9a706 100644 --- a/command/hilog_command.c +++ b/command/hilog_command.c @@ -15,6 +15,7 @@ #include "hilog_command.h" +#include #include #include #include @@ -183,7 +184,7 @@ int HilogSilenceProc() return 0; } -int HilogCmdProc(const char* tag, int argc, const char **argv) +int HilogCmdProc(const char *tag, int argc, char *argv[]) { int ret = -1; int optionIndex = 0; @@ -196,7 +197,7 @@ int HilogCmdProc(const char* tag, int argc, const char **argv) {"silence", no_argument, NULL, OPTION_SILENCE}, {0, 0, 0, 0} }; - const char* const shortOptions = "hL:D:"; + const char *shortOptions = "hL:D:"; while ((opt = getopt_long(argc, argv, shortOptions, longOptions, &optionIndex)) != -1) { switch (opt) { @@ -240,7 +241,7 @@ bool FilterLevelLog(unsigned char setLevel, unsigned char logLevel) return false; } -bool FilterModuleLog(unsigned char *setModule, const char *logModule) +bool FilterModuleLog(const char *setModule, const char *logModule) { if (strncmp(setModule, HILOG_MODULE_MAX, DOMAIN_ID_LENGTH) == 0) { return true; diff --git a/command/hilog_command.h b/command/hilog_command.h index 60e0263..6e0e7bc 100644 --- a/command/hilog_command.h +++ b/command/hilog_command.h @@ -38,7 +38,7 @@ typedef struct { unsigned char eventSwitch : 1; /* Indicates whether to enable the event component. */ unsigned char dumpSwitch : 1; /* Indicates whether to enable the dump component. */ unsigned char silenceMod : 1; /* Silent mode, 0 for mode off, 1 for mdoe on. */ - unsigned char logOutputModule[DOMAIN_ID_LENGTH + 1]; /* Control log output module (including '\0' byte). */ + char logOutputModule[DOMAIN_ID_LENGTH + 1]; /* Control log output module (including '\0' byte). */ unsigned short writeFailureCount; } HiviewConfig; @@ -52,9 +52,9 @@ typedef enum { extern HiviewConfig g_hiviewConfig; -int HilogCmdProc(const char* tag, int argc, const char **argv); +int HilogCmdProc(const char *tag, int argc, char *argv[]); bool FilterLevelLog(unsigned char setLevel, unsigned char logLevel); -bool FilterModuleLog(unsigned char* setModule, const char *logModule); +bool FilterModuleLog(const char *setModule, const char *logModule); #ifdef __cplusplus #if __cplusplus diff --git a/services/apphilogcat/hiview_applogcat.c b/services/apphilogcat/hiview_applogcat.c index 6f4c26e..539cd6d 100755 --- a/services/apphilogcat/hiview_applogcat.c +++ b/services/apphilogcat/hiview_applogcat.c @@ -131,7 +131,7 @@ static void FileClose(FILE *file) } } -int main(int argc, const char **argv) +int main(int argc, char *argv[]) { #define HILOG_UMASK 0027 int fd; diff --git a/services/hilogcat/hiview_logcat.c b/services/hilogcat/hiview_logcat.c index 852d320..91ff612 100755 --- a/services/hilogcat/hiview_logcat.c +++ b/services/hilogcat/hiview_logcat.c @@ -14,6 +14,7 @@ */ #include +#include #include #include "hilog_command.h" @@ -24,7 +25,7 @@ #undef LOG_TAG #define LOG_TAG "hilogcat" -int main(int argc, const char **argv) +int main(int argc, char *argv[]) { int ret; bool printFlag = true; -- Gitee