[posix-app] fix warnings on macOS (#3158)

This commit is contained in:
Yakun Xu
2018-10-15 01:56:22 -07:00
committed by Jonathan Hui
parent ad50e4bedd
commit 232379a07c
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -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<unsigned long>(~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_t>(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<size_t>(end - cur), "%s ", argv[index]);
}
sRadioSpinel.PlatDiagProcess(cmd, aOutput, aOutputMaxLen);
+2 -2
View File
@@ -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<uint16_t>(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<uint16_t>(size - offset));
error = OT_ERROR_NONE;
break;
}