From 232379a07c7bdfc74271f2285d0a0a6fcb5887f1 Mon Sep 17 00:00:00 2001 From: Yakun Xu Date: Mon, 15 Oct 2018 16:56:22 +0800 Subject: [PATCH] [posix-app] fix warnings on macOS (#3158) --- src/posix/platform/radio_spinel.cpp | 6 +++--- src/posix/platform/settings.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/posix/platform/radio_spinel.cpp b/src/posix/platform/radio_spinel.cpp index c6c4e6531..5a68e7997 100644 --- a/src/posix/platform/radio_spinel.cpp +++ b/src/posix/platform/radio_spinel.cpp @@ -360,7 +360,7 @@ static int OpenFile(const char *aFile, const char *aConfig) switch (cstopb) { case 1: - tios.c_cflag &= ~CSTOPB; + tios.c_cflag &= static_cast(~CSTOPB); break; case 2: tios.c_cflag |= CSTOPB; @@ -459,7 +459,7 @@ static int OpenFile(const char *aFile, const char *aConfig) break; } - VerifyOrExit((rval = cfsetspeed(&tios, speed)) == 0, perror("cfsetspeed")); + VerifyOrExit((rval = cfsetspeed(&tios, static_cast(speed))) == 0, perror("cfsetspeed")); VerifyOrExit((rval = tcsetattr(fd, TCSANOW, &tios)) == 0, perror("tcsetattr")); VerifyOrExit((rval = tcflush(fd, TCIOFLUSH)) == 0); } @@ -1937,7 +1937,7 @@ void otPlatDiagProcess(otInstance *aInstance, int argc, char *argv[], char *aOut for (int index = 0; index < argc; index++) { - cur += snprintf(cur, end - cur, "%s ", argv[index]); + cur += snprintf(cur, static_cast(end - cur), "%s ", argv[index]); } sRadioSpinel.PlatDiagProcess(cmd, aOutput, aOutputMaxLen); diff --git a/src/posix/platform/settings.cpp b/src/posix/platform/settings.cpp index 9a5e6d07e..c0754b6dd 100644 --- a/src/posix/platform/settings.cpp +++ b/src/posix/platform/settings.cpp @@ -247,7 +247,7 @@ otError otPlatSettingsAdd(otInstance *aInstance, uint16_t aKey, const uint8_t *a if (size > 0) { VerifyOrDie(0 == lseek(sSettingsFd, 0, SEEK_SET)); - swapWrite(swapFd, size); + swapWrite(swapFd, static_cast(size)); } VerifyOrDie(write(swapFd, &aKey, sizeof(aKey)) == sizeof(aKey) && @@ -290,7 +290,7 @@ otError otPlatSettingsDelete(otInstance *aInstance, uint16_t aKey, int aIndex) if (aIndex == 0) { VerifyOrExit(offset == lseek(sSettingsFd, length, SEEK_CUR), error = OT_ERROR_PARSE); - swapWrite(swapFd, size - offset); + swapWrite(swapFd, static_cast(size - offset)); error = OT_ERROR_NONE; break; }