From 8e84e054295a1836e10ad0f314bd34bb370f2bfe Mon Sep 17 00:00:00 2001 From: Zhanglong Xia Date: Wed, 13 May 2020 09:03:32 +0800 Subject: [PATCH] [posix] fix inconsistent function definitions issue (#4950) The arguments of the funtion `otPlatDiagProcess` in posix radio driver is different from the one defined in the `diag.h`. It causes the diag module uses the weak definition of the function `otPlatDiagProcess`. This commit fixes this issue. --- src/posix/platform/radio.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/posix/platform/radio.cpp b/src/posix/platform/radio.cpp index a5865ddaf..52b874015 100644 --- a/src/posix/platform/radio.cpp +++ b/src/posix/platform/radio.cpp @@ -380,7 +380,11 @@ exit: #endif #if OPENTHREAD_CONFIG_DIAG_ENABLE -otError otPlatDiagProcess(otInstance *aInstance, int argc, char *argv[], char *aOutput, size_t aOutputMaxLen) +otError otPlatDiagProcess(otInstance *aInstance, + uint8_t aArgsLength, + char * aArgs[], + char * aOutput, + size_t aOutputMaxLen) { // deliver the platform specific diags commands to radio only ncp. OT_UNUSED_VARIABLE(aInstance); @@ -388,9 +392,9 @@ otError otPlatDiagProcess(otInstance *aInstance, int argc, char *argv[], char *a char *cur = cmd; char *end = cmd + sizeof(cmd); - for (int index = 0; index < argc; index++) + for (uint8_t index = 0; index < aArgsLength; index++) { - cur += snprintf(cur, static_cast(end - cur), "%s ", argv[index]); + cur += snprintf(cur, static_cast(end - cur), "%s ", aArgs[index]); } return sRadioSpinel.PlatDiagProcess(cmd, aOutput, aOutputMaxLen);