mirror of
https://github.com/lvgl/lvgl.git
synced 2026-06-02 01:18:04 +08:00
fix(xml): make the XML parser work on MCUs too
This commit is contained in:
committed by
Felipe Neves
parent
82996a504a
commit
2e7d17f406
@@ -107,12 +107,14 @@
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# define getpid GetCurrentProcessId
|
# define getpid GetCurrentProcessId
|
||||||
#else
|
#elif defined(__linux__)
|
||||||
# include <sys/time.h> /* gettimeofday() */
|
# include <sys/time.h> /* gettimeofday() */
|
||||||
# include <sys/types.h> /* getpid() */
|
# include <sys/types.h> /* getpid() */
|
||||||
# include <unistd.h> /* getpid() */
|
# include <unistd.h> /* getpid() */
|
||||||
# include <fcntl.h> /* O_RDONLY */
|
# include <fcntl.h> /* O_RDONLY */
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
|
#else
|
||||||
|
# define getpid() 0xAABBCCDD /* Fallback for MCUs */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -921,7 +923,7 @@ gather_time_entropy(void) {
|
|||||||
FILETIME ft;
|
FILETIME ft;
|
||||||
GetSystemTimeAsFileTime(&ft); /* never fails */
|
GetSystemTimeAsFileTime(&ft); /* never fails */
|
||||||
return ft.dwHighDateTime ^ ft.dwLowDateTime;
|
return ft.dwHighDateTime ^ ft.dwLowDateTime;
|
||||||
# else
|
# elif defined(__linux__)
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
int gettimeofday_res;
|
int gettimeofday_res;
|
||||||
|
|
||||||
@@ -932,9 +934,10 @@ gather_time_entropy(void) {
|
|||||||
# else
|
# else
|
||||||
assert(gettimeofday_res == 0);
|
assert(gettimeofday_res == 0);
|
||||||
# endif /* defined(NDEBUG) */
|
# endif /* defined(NDEBUG) */
|
||||||
|
|
||||||
/* Microseconds time is <20 bits entropy */
|
/* Microseconds time is <20 bits entropy */
|
||||||
return tv.tv_usec;
|
return tv.tv_usec;
|
||||||
|
# else
|
||||||
|
return 0x12345678; /*Fallback for MCUs*/
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8552,13 +8555,8 @@ getDebugLevel(const char *variableName, unsigned long defaultDebugLevel) {
|
|||||||
}
|
}
|
||||||
const char *const value = valueOrNull;
|
const char *const value = valueOrNull;
|
||||||
|
|
||||||
errno = 0;
|
|
||||||
char *afterValue = NULL;
|
char *afterValue = NULL;
|
||||||
unsigned long debugLevel = strtoul(value, &afterValue, 10);
|
unsigned long debugLevel = strtoul(value, &afterValue, 10);
|
||||||
if ((errno != 0) || (afterValue == value) || (afterValue[0] != '\0')) {
|
|
||||||
errno = 0;
|
|
||||||
return defaultDebugLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
return debugLevel;
|
return debugLevel;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user