fix(esp_wifi): Modifying os_time_t datatype for platform and compiler independence

This commit is contained in:
tarun.kumar
2025-01-22 10:57:36 +05:30
committed by BOT
parent da22d36fc1
commit 2ea5e8afa3
3 changed files with 35 additions and 31 deletions

View File

@@ -24,7 +24,9 @@
#include "esp_private/esp_wifi_private.h"
#include "esp_wifi.h"
typedef time_t os_time_t;
/* Modifying datatype for platform and compiler independence */
typedef uint64_t os_time_t;
/**
* os_sleep - Sleep (sec, usec)
@@ -231,7 +233,6 @@ static inline char *os_readfile(const char *name, size_t *len)
#define os_bzero(s, n) bzero(s, n)
#endif
#ifndef os_strdup
#ifdef _MSC_VER
#define os_strdup(s) _strdup(s)
@@ -314,8 +315,9 @@ static inline int os_snprintf_error(size_t size, int res)
static inline void * os_realloc_array(void *ptr, size_t nmemb, size_t size)
{
if (size && nmemb > (~(size_t) 0) / size)
if (size && nmemb > (~(size_t) 0) / size) {
return NULL;
}
return os_realloc(ptr, nmemb * size);
}
@@ -384,11 +386,11 @@ static inline void os_timer_disarm(void *ptimer)
{
return wifi_funcs->_timer_disarm(ptimer);
}
static inline void os_timer_arm_us(void *ptimer,uint32_t u_seconds,bool repeat_flag)
static inline void os_timer_arm_us(void *ptimer, uint32_t u_seconds, bool repeat_flag)
{
return wifi_funcs->_timer_arm_us(ptimer, u_seconds, repeat_flag);
}
static inline void os_timer_arm(void *ptimer,uint32_t milliseconds,bool repeat_flag)
static inline void os_timer_arm(void *ptimer, uint32_t milliseconds, bool repeat_flag)
{
return wifi_funcs->_timer_arm(ptimer, milliseconds, repeat_flag);
}

View File

@@ -1209,7 +1209,9 @@ void wps_registrar_probe_req_rx(struct wps_registrar *reg, const u8 *addr,
struct os_reltime now, dur;
os_get_reltime(&now);
os_reltime_sub(&now, &reg->pbc_ignore_start, &dur);
if (dur.sec >= 0 && dur.sec < 5) {
#ifdef ESP_SUPPLICANT
if (dur.sec < 5) {
#endif /* ESP_SUPPLICANT */
wpa_printf(MSG_DEBUG, "WPS: Ignore PBC activation "
"based on Probe Request from the Enrollee "
"that just completed PBC provisioning");