mirror of
https://github.com/espressif/openthread.git
synced 2026-09-11 11:40:06 +00:00
[windows] fix warnings (#3435)
This commit is contained in:
@@ -151,7 +151,11 @@ void platformAlarmUpdateTimeout(struct timeval *aTimeout)
|
|||||||
remaining = 1;
|
remaining = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
aTimeout->tv_sec = (time_t)remaining / US_PER_S;
|
#ifndef _WIN32
|
||||||
|
aTimeout->tv_sec = (time_t)remaining / US_PER_S;
|
||||||
|
#else
|
||||||
|
aTimeout->tv_sec = (long)remaining / US_PER_S;
|
||||||
|
#endif
|
||||||
aTimeout->tv_usec = remaining % US_PER_S;
|
aTimeout->tv_usec = remaining % US_PER_S;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
#include <WinSock2.h>
|
#include <WinSock2.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#define POLL WSAPoll
|
#define POLL WSAPoll
|
||||||
#define ssize_t int
|
#define ssize_t long
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#define localtime _localtime32
|
#define localtime _localtime32
|
||||||
// In user mode, define some Linux functions
|
// In user mode, define some Linux functions
|
||||||
|
|||||||
@@ -446,7 +446,11 @@ void platformRadioInit(void)
|
|||||||
|
|
||||||
void platformRadioDeinit(void)
|
void platformRadioDeinit(void)
|
||||||
{
|
{
|
||||||
|
#ifndef _WIN32
|
||||||
close(sSockFd);
|
close(sSockFd);
|
||||||
|
#else
|
||||||
|
closesocket(sSockFd);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool otPlatRadioIsEnabled(otInstance *aInstance)
|
bool otPlatRadioIsEnabled(otInstance *aInstance)
|
||||||
@@ -841,7 +845,7 @@ void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
|
|||||||
sSrcMatchEnabled = aEnable;
|
sSrcMatchEnabled = aEnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
|
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, uint16_t aShortAddress)
|
||||||
{
|
{
|
||||||
OT_UNUSED_VARIABLE(aInstance);
|
OT_UNUSED_VARIABLE(aInstance);
|
||||||
|
|
||||||
@@ -881,7 +885,7 @@ exit:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
|
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, uint16_t aShortAddress)
|
||||||
{
|
{
|
||||||
OT_UNUSED_VARIABLE(aInstance);
|
OT_UNUSED_VARIABLE(aInstance);
|
||||||
|
|
||||||
|
|||||||
@@ -671,7 +671,7 @@ void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
|
|||||||
sSrcMatchEnabled = aEnable;
|
sSrcMatchEnabled = aEnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
|
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, uint16_t aShortAddress)
|
||||||
{
|
{
|
||||||
OT_UNUSED_VARIABLE(aInstance);
|
OT_UNUSED_VARIABLE(aInstance);
|
||||||
|
|
||||||
@@ -711,7 +711,7 @@ exit:
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
|
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, uint16_t aShortAddress)
|
||||||
{
|
{
|
||||||
OT_UNUSED_VARIABLE(aInstance);
|
OT_UNUSED_VARIABLE(aInstance);
|
||||||
|
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ exit:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reads an item of given size and updates the pointer `aPtr`.
|
// Reads an item of given size and updates the pointer `aPtr`.
|
||||||
otError SpinelDecoder::ReadItem(const uint8_t **aPtr, size_t aSize)
|
otError SpinelDecoder::ReadItem(const uint8_t **aPtr, uint16_t aSize)
|
||||||
{
|
{
|
||||||
otError error = OT_ERROR_NONE;
|
otError error = OT_ERROR_NONE;
|
||||||
|
|
||||||
@@ -303,7 +303,8 @@ otError SpinelDecoder::ReadUtf8(const char *&aUtf8)
|
|||||||
|
|
||||||
aUtf8 = reinterpret_cast<const char *>(&mFrame[mIndex]);
|
aUtf8 = reinterpret_cast<const char *>(&mFrame[mIndex]);
|
||||||
|
|
||||||
mIndex += (len + sizeof(uint8_t)); // `sizeof(uint8_t)` is added for the terminating null character.
|
// `sizeof(uint8_t)` is added for the terminating null character.
|
||||||
|
mIndex += static_cast<uint16_t>(len + sizeof(uint8_t));
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
return error;
|
return error;
|
||||||
|
|||||||
@@ -564,7 +564,7 @@ public:
|
|||||||
otError ResetToSaved(void);
|
otError ResetToSaved(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
otError ReadItem(const uint8_t **aPtr, size_t aSize);
|
otError ReadItem(const uint8_t **aPtr, uint16_t aSize);
|
||||||
void ClearSavedPosition(void) { mSavedIndex = mLength; }
|
void ClearSavedPosition(void) { mSavedIndex = mLength; }
|
||||||
bool IsSavedPositionValid(void) const { return (mSavedIndex < mLength); }
|
bool IsSavedPositionValid(void) const { return (mSavedIndex < mLength); }
|
||||||
|
|
||||||
|
|||||||
@@ -1467,7 +1467,7 @@ void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
|
|||||||
OT_UNUSED_VARIABLE(aInstance);
|
OT_UNUSED_VARIABLE(aInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
|
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, uint16_t aShortAddress)
|
||||||
{
|
{
|
||||||
OT_UNUSED_VARIABLE(aInstance);
|
OT_UNUSED_VARIABLE(aInstance);
|
||||||
return sRadioSpinel.AddSrcMatchShortEntry(aShortAddress);
|
return sRadioSpinel.AddSrcMatchShortEntry(aShortAddress);
|
||||||
@@ -1486,7 +1486,7 @@ otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress
|
|||||||
return sRadioSpinel.AddSrcMatchExtEntry(addr);
|
return sRadioSpinel.AddSrcMatchExtEntry(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
|
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, uint16_t aShortAddress)
|
||||||
{
|
{
|
||||||
OT_UNUSED_VARIABLE(aInstance);
|
OT_UNUSED_VARIABLE(aInstance);
|
||||||
return sRadioSpinel.ClearSrcMatchShortEntry(aShortAddress);
|
return sRadioSpinel.ClearSrcMatchShortEntry(aShortAddress);
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ int8_t GetRandomRss(void)
|
|||||||
uint32_t value;
|
uint32_t value;
|
||||||
|
|
||||||
value = otPlatRandomGet() % 128;
|
value = otPlatRandomGet() % 128;
|
||||||
return static_cast<int8_t>(-value);
|
return -static_cast<int8_t>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRssAveraging(void)
|
void TestRssAveraging(void)
|
||||||
|
|||||||
Reference in New Issue
Block a user