1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-20 02:25:14 -07:00

Merge pull request #373 from jcolli44/master

Introduce C++Builder compatibility
This commit is contained in:
Frank Denis 2016-03-18 22:06:59 +01:00
commit a456244a95
3 changed files with 20 additions and 1 deletions

View File

@ -17,6 +17,10 @@
# include "randombytes_nativeclient.h" # include "randombytes_nativeclient.h"
#endif #endif
#if defined(random)
#undef random
#endif
#ifndef __EMSCRIPTEN__ #ifndef __EMSCRIPTEN__
#ifdef __native_client__ #ifdef __native_client__
static const randombytes_implementation *implementation = static const randombytes_implementation *implementation =

View File

@ -16,7 +16,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifndef _MSC_VER #if !defined(_MSC_VER) && !defined(__BORLANDC__)
# include <unistd.h> # include <unistd.h>
#endif #endif
@ -77,10 +77,21 @@ sodium_hrtime(void)
#ifdef _WIN32 #ifdef _WIN32
{ {
#ifdef __BORLANDC__
struct timeb tb;
#else
struct _timeb tb; struct _timeb tb;
#endif
# pragma warning(push) # pragma warning(push)
# pragma warning(disable: 4996) # pragma warning(disable: 4996)
#ifdef __BORLANDC__
ftime(&tb);
#else
_ftime(&tb); _ftime(&tb);
#endif
# pragma warning(pop) # pragma warning(pop)
ts = ((uint64_t) tb.time) * 1000000U + ((uint64_t) tb.millitm) * 1000U; ts = ((uint64_t) tb.time) * 1000000U + ((uint64_t) tb.millitm) * 1000U;
} }

View File

@ -1,6 +1,10 @@
#include <stdlib.h> #include <stdlib.h>
#if defined(random)
#undef random
#endif
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
# define strcmp(s1, s2) xstrcmp(s1, s2) # define strcmp(s1, s2) xstrcmp(s1, s2)