1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-19 10:05:05 -07:00

Introduce C++Builder compatibility

Add new preprocessor directives to allow libsodium to be easily
built in C++Builder.
This commit is contained in:
unknown 2016-03-18 12:56:37 -04:00 committed by Jackson Collier
parent 0c06979260
commit 2085693c32
3 changed files with 20 additions and 1 deletions

View File

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

View File

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

View File

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