Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to build on FreeBSD. #53

Open
wants to merge 1 commit into
base: 7.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions opennurbs_font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8898,7 +8898,7 @@ const ON_wString ON_Font::FamilyNameFromDirtyName(
const wchar_t* prev_clean_family_name = nullptr;
for (size_t i = 0; i < installed_count; i++)
{
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX)
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__)
const ON_Font* font = installed_fonts[(int)i];
#else
const ON_Font* font = installed_fonts[i];
Expand Down Expand Up @@ -8961,7 +8961,7 @@ const ON_wString ON_Font::FamilyNameFromDirtyName(
InternalHashToName candidate;
for (size_t i = 0; i < count0; i++)
{
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX)
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__)
InternalHashToName e = a[(int)i];
#else
InternalHashToName e = a[i];
Expand Down
12 changes: 6 additions & 6 deletions opennurbs_locale.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static ON_CRT_locale_t ON_CRT_C_locale()
ON_C_locale = _create_locale(LC_ALL, "C");
#elif defined(ON_RUNTIME_APPLE)
ON_C_locale = _c_locale;
#elif defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX)
#elif defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__)
ON_C_locale = 0;
#else
ON_C_locale = _create_locale(category, locale);
Expand Down Expand Up @@ -104,7 +104,7 @@ static ON_CRT_locale_t ON_CRT_create_locale_ALL( const char * locale )
}
}
return newlocale(LC_ALL_MASK, apple_name, ON_CRT_C_locale() );
#elif defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX)
#elif defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__)
return 0;
#else
return _create_locale(category, locale);
Expand Down Expand Up @@ -1344,7 +1344,7 @@ class ON_CRT_LOCALE
static bool Validate_sprintf_l()
{
#if defined(ON_COMPILER_CLANG) || defined(ON_COMPILER_GNU)
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX)
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__)
// Test formatted printing
char buffer[64] = { 0 };
// Testing C-runtime - do not using ON_String::FormatIntoBuffer
Expand All @@ -1369,7 +1369,7 @@ class ON_CRT_LOCALE
static bool Validate_sprintf_s_l()
{
#if defined(ON_COMPILER_CLANG) || defined(ON_COMPILER_GNU)
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX)
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__)
// Test formatted printing
char buffer[64] = { 0 };
size_t buffer_capacity = (sizeof(buffer) / sizeof(buffer[0])) - 1;
Expand Down Expand Up @@ -1423,7 +1423,7 @@ class ON_CRT_LOCALE
static bool Validate_sscanf_l()
{
#if defined(ON_COMPILER_CLANG) || defined(ON_COMPILER_GNU)
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX)
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__)
// Test formatted scanning
double a = ON_UNSET_VALUE;
// Testing C-runtime - do not using ON_String::Scan
Expand All @@ -1448,7 +1448,7 @@ class ON_CRT_LOCALE
static bool Validate_sscanf_s_l()
{
#if defined(ON_COMPILER_CLANG) || defined(ON_COMPILER_GNU)
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX)
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__)
// Test formatted scanning
double a = ON_UNSET_VALUE;
// Testing C-runtime - do not using ON_String::Scan
Expand Down
2 changes: 1 addition & 1 deletion opennurbs_polyline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ bool ON_IsConvexPolyline(
maxN = maxN.UnitVector();
for (size_t i = 0; i < point_count; ++i)
{
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX)
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__)
double d = maxN * C[(unsigned int)i];
#else
double d = maxN * C[i];
Expand Down
4 changes: 2 additions & 2 deletions opennurbs_string_format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ int ON_String::FormatVargsIntoBuffer(
// CLang modifies args so a copy is required
va_list args_copy;
va_copy (args_copy, args);
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX)
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__)
int len = vsnprintf(buffer, buffer_capacity, format, args_copy);
#else
int len = vsnprintf_l(buffer, buffer_capacity, ON_Locale::Ordinal.NumericLocalePtr(), format, args_copy);
Expand Down Expand Up @@ -859,7 +859,7 @@ int ON_String::FormatVargsOutputCount(
va_list args_copy;
va_copy (args_copy, args);

#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX)
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__)
int len = vsnprintf(nullptr, 0, format, args_copy);
#else
int len = vsnprintf_l(nullptr, 0, ON_Locale::Ordinal.NumericLocalePtr(), format, args_copy);
Expand Down
6 changes: 3 additions & 3 deletions opennurbs_string_scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ int ON_String::ScanBufferVargs(
)
{
#if defined(ON_COMPILER_CLANG) || defined(ON_RUNTIME_LINUX)
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX)
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__)
if (nullptr == buffer || nullptr == format)
return -1;
return vsscanf(buffer, format, args);
Expand Down Expand Up @@ -399,7 +399,7 @@ const char* ON_String::ToNumber(

double x = value_on_failure;
#if defined(ON_COMPILER_CLANG) || defined(ON_RUNTIME_LINUX)
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX)
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__)
if (1 == sscanf(local_buffer, "%lg", &x))
{
*value = x;
Expand Down Expand Up @@ -661,7 +661,7 @@ const wchar_t* ON_wString::ToNumber(

double x = value_on_failure;
#if defined(ON_COMPILER_CLANG) || defined(ON_RUNTIME_LINUX)
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX)
#if defined(ON_RUNTIME_ANDROID) || defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__)
if (1 == sscanf(local_buffer, "%lg", &x))
{
*value = x;
Expand Down
5 changes: 2 additions & 3 deletions opennurbs_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
#if !defined(OPENNURBS_SYSTEM_INC_)
#define OPENNURBS_SYSTEM_INC_



#define ON_SIZEOF_WCHAR_T 4


#define OPENNURBS_PP2STR_HELPER(s) #s
Expand Down Expand Up @@ -434,7 +433,7 @@ typedef ON__UINT32 wchar_t;
#if defined(ON_COMPILER_CLANG) && defined(ON_RUNTIME_APPLE)
#include <malloc/malloc.h>
#else
#include <malloc.h>
#include <stdlib.h>
#endif
#pragma ON_PRAGMA_WARNING_AFTER_DIRTY_INCLUDE

Expand Down
4 changes: 2 additions & 2 deletions opennurbs_uuid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ bool ON_CreateUuid( ON_UUID& new_uuid )
// identifies the user and some
// customers may object.
return true;
#elif defined(ON_COMPILER_CLANG)
#elif defined(ON_COMPILER_CLANG) && !defined(__FreeBSD__)
// Header: #include <uuid/uuid.h>
if ( ON::endian::little_endian == ON::Endian() )
{
Expand Down Expand Up @@ -224,7 +224,7 @@ bool ON_CreateUuid( ON_UUID& new_uuid )
return true;
#else

#if defined(ON_RUNTIME_LINUX)
#if defined(ON_RUNTIME_LINUX) || defined(__FreeBSD__)
uuid_generate((unsigned char*)&new_uuid);
return true;
#else
Expand Down