Commit 15643f8e authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by Cesanta Bot

Use rand() instead of random(), it's more standard

Remove the random() stubs from the codebase

PUBLISHED_FROM=0f56ec7dffa0af1f5061a17d8801239d6f0e32a5
parent b987df19
......@@ -4113,15 +4113,15 @@ static uint32_t mg_ws_random_mask(void) {
* is untrusted code that wouldn't have access to a lower level net API
* anyway (e.g. web browsers). Hence this feature is low prio for most
* mongoose use cases and thus can be disabled, e.g. when porting to a platform
* that lacks random().
* that lacks rand().
*/
#ifdef MG_DISABLE_WS_RANDOM_MASK
mask = 0xefbeadde; /* generated with a random number generator, I swear */
#else
if (sizeof(long) >= 4) {
mask = (uint32_t) random();
mask = (uint32_t) rand();
} else if (sizeof(long) == 2) {
mask = (uint32_t) random() << 16 | (uint32_t) random();
mask = (uint32_t) rand() << 16 | (uint32_t) rand();
}
#endif
return mask;
......@@ -9568,10 +9568,6 @@ int gettimeofday(struct timeval *tp, void *tzp) {
return 0;
}
long int random(void) {
return 42; /* FIXME */
}
void fprint_str(FILE *fp, const char *str) {
while (*str != '\0') {
if (*str == '\n') MAP_UARTCharPut(CONSOLE_UART, '\r');
......@@ -9631,10 +9627,6 @@ int gettimeofday(struct timeval *tp, void *tzp) {
return 0;
}
long int random(void) {
return 42; /* FIXME */
}
#endif /* CS_PLATFORM == CS_P_MSP432 */
#ifdef MG_MODULE_LINES
#line 1 "./src/../../common/platforms/simplelink/sl_fs_slfs.h"
......
......@@ -151,7 +151,6 @@
#include <sys/stat.h>
#include <time.h>
#define random() rand()
#ifdef _MSC_VER
#pragma comment(lib, "ws2_32.lib") /* Linking with winsock library */
#endif
......@@ -187,7 +186,6 @@
#else
#define fseeko(x, y, z) fseek((x), (y), (z))
#endif
#define random() rand()
typedef int socklen_t;
#if _MSC_VER >= 1700
#include <stdint.h>
......@@ -460,8 +458,6 @@ int asprintf(char **strp, const char *fmt, ...);
#endif
long int random(void);
/* TI's libc does not have stat & friends, add them. */
#ifdef __TI_COMPILER_VERSION__
......@@ -582,8 +578,6 @@ struct SlTimeval_t;
int gettimeofday(struct timeval *t, void *tz);
#endif
long int random(void);
/* TI's libc does not have stat & friends, add them. */
#ifdef __TI_COMPILER_VERSION__
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment