mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-19 18:15:18 -07:00
2085693c32
Add new preprocessor directives to allow libsodium to be easily built in C++Builder.
31 lines
430 B
C
31 lines
430 B
C
|
|
#include <stdlib.h>
|
|
|
|
#if defined(random)
|
|
#undef random
|
|
#endif
|
|
|
|
#ifdef __EMSCRIPTEN__
|
|
# define strcmp(s1, s2) xstrcmp(s1, s2)
|
|
|
|
int
|
|
strcmp(const char *s1, const char *s2) {
|
|
while (*s1 == *s2++) { if (*s1++ == 0) return 0; }
|
|
return *(unsigned char *) s1 - *(unsigned char *) --s2;
|
|
}
|
|
#endif
|
|
|
|
#ifdef _WIN32
|
|
static void
|
|
srandom(unsigned seed)
|
|
{
|
|
srand(seed);
|
|
}
|
|
|
|
static long
|
|
random(void)
|
|
{
|
|
return (long) rand();
|
|
}
|
|
#endif
|