|
|
@@ -1,6 +1,6 @@ |
|
|
|
/* |
|
|
|
* Carla common utils |
|
|
|
* Copyright (C) 2011-2014 Filipe Coelho <falktx@falktx.com> |
|
|
|
* Copyright (C) 2011-2015 Filipe Coelho <falktx@falktx.com> |
|
|
|
* |
|
|
|
* This program is free software; you can redistribute it and/or |
|
|
|
* modify it under the terms of the GNU General Public License as |
|
|
@@ -39,7 +39,7 @@ |
|
|
|
# include <unistd.h> |
|
|
|
#endif |
|
|
|
|
|
|
|
// ----------------------------------------------------------------------- |
|
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
|
// misc functions |
|
|
|
|
|
|
|
/* |
|
|
@@ -66,7 +66,7 @@ void nullStrBuf(char* const strBuf) noexcept |
|
|
|
static inline |
|
|
|
void pass() noexcept {} |
|
|
|
|
|
|
|
// ----------------------------------------------------------------------- |
|
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
|
// string print functions |
|
|
|
|
|
|
|
/* |
|
|
@@ -148,7 +148,7 @@ void carla_stderr2(const char* const fmt, ...) noexcept |
|
|
|
} catch (...) {} |
|
|
|
} |
|
|
|
|
|
|
|
// ----------------------------------------------------------------------- |
|
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
|
// carla_safe_assert* |
|
|
|
|
|
|
|
/* |
|
|
@@ -164,12 +164,14 @@ void carla_safe_assert(const char* const assertion, const char* const file, cons |
|
|
|
* Print a safe assertion error message, with 1 extra integer value. |
|
|
|
*/ |
|
|
|
static inline |
|
|
|
void carla_safe_assert_int(const char* const assertion, const char* const file, const int line, const int value) noexcept |
|
|
|
void carla_safe_assert_int(const char* const assertion, const char* const file, const int line, |
|
|
|
const int value) noexcept |
|
|
|
{ |
|
|
|
carla_stderr2("Carla assertion failure: \"%s\" in file %s, line %i, value %i", assertion, file, line, value); |
|
|
|
} |
|
|
|
static inline |
|
|
|
void carla_safe_assert_uint(const char* const assertion, const char* const file, const int line, const uint value) noexcept |
|
|
|
void carla_safe_assert_uint(const char* const assertion, const char* const file, const int line, |
|
|
|
const uint value) noexcept |
|
|
|
{ |
|
|
|
carla_stderr2("Carla assertion failure: \"%s\" in file %s, line %i, value %u", assertion, file, line, value); |
|
|
|
} |
|
|
@@ -178,17 +180,19 @@ void carla_safe_assert_uint(const char* const assertion, const char* const file, |
|
|
|
* Print a safe assertion error message, with 2 extra integer values. |
|
|
|
*/ |
|
|
|
static inline |
|
|
|
void carla_safe_assert_int2(const char* const assertion, const char* const file, const int line, const int v1, const int v2) noexcept |
|
|
|
void carla_safe_assert_int2(const char* const assertion, const char* const file, const int line, |
|
|
|
const int v1, const int v2) noexcept |
|
|
|
{ |
|
|
|
carla_stderr2("Carla assertion failure: \"%s\" in file %s, line %i, v1 %i, v2 %i", assertion, file, line, v1, v2); |
|
|
|
} |
|
|
|
static inline |
|
|
|
void carla_safe_assert_uint2(const char* const assertion, const char* const file, const int line, const uint v1, const uint v2) noexcept |
|
|
|
void carla_safe_assert_uint2(const char* const assertion, const char* const file, const int line, |
|
|
|
const uint v1, const uint v2) noexcept |
|
|
|
{ |
|
|
|
carla_stderr2("Carla assertion failure: \"%s\" in file %s, line %i, v1 %u, v2 %u", assertion, file, line, v1, v2); |
|
|
|
} |
|
|
|
|
|
|
|
// ----------------------------------------------------------------------- |
|
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
|
// carla_safe_exception* |
|
|
|
|
|
|
|
/* |
|
|
@@ -200,7 +204,7 @@ void carla_safe_exception(const char* const exception, const char* const file, c |
|
|
|
carla_stderr2("Carla exception caught: \"%s\" in file %s, line %i", exception, file, line); |
|
|
|
} |
|
|
|
|
|
|
|
// ----------------------------------------------------------------------- |
|
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
|
// carla_*sleep |
|
|
|
|
|
|
|
/* |
|
|
@@ -237,7 +241,7 @@ void carla_msleep(const uint msecs) noexcept |
|
|
|
} CARLA_SAFE_EXCEPTION("carla_msleep"); |
|
|
|
} |
|
|
|
|
|
|
|
// ----------------------------------------------------------------------- |
|
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
|
// carla_setenv |
|
|
|
|
|
|
|
/* |
|
|
@@ -275,7 +279,7 @@ void carla_unsetenv(const char* const key) noexcept |
|
|
|
#endif |
|
|
|
} |
|
|
|
|
|
|
|
// ----------------------------------------------------------------------- |
|
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
|
// carla_strdup |
|
|
|
|
|
|
|
/* |
|
|
@@ -337,7 +341,7 @@ const char* carla_strdup_safe(const char* const strBuf) noexcept |
|
|
|
return buffer; |
|
|
|
} |
|
|
|
|
|
|
|
// ----------------------------------------------------------------------- |
|
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
|
// memory functions |
|
|
|
|
|
|
|
/* |
|
|
@@ -474,6 +478,6 @@ void carla_copyStruct(T* const struct1, const T* const struct2, const std::size_ |
|
|
|
std::memcpy(struct1, struct2, count*sizeof(T)); |
|
|
|
} |
|
|
|
|
|
|
|
// ----------------------------------------------------------------------- |
|
|
|
// -------------------------------------------------------------------------------------------------------------------- |
|
|
|
|
|
|
|
#endif // CARLA_UTILS_HPP_INCLUDED |