mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
RRenamed BX_CHECK to BX_ASSERT.
This commit is contained in:
@@ -22,7 +22,7 @@ namespace bx
|
||||
|
||||
inline void Error::setError(ErrorResult _errorResult, const StringView& _msg)
|
||||
{
|
||||
BX_CHECK(0 != _errorResult.code, "Invalid ErrorResult passed to setError!");
|
||||
BX_ASSERT(0 != _errorResult.code, "Invalid ErrorResult passed to setError!");
|
||||
|
||||
if (!isOk() )
|
||||
{
|
||||
@@ -62,12 +62,12 @@ namespace bx
|
||||
inline ErrorScope::ErrorScope(Error* _err)
|
||||
: m_err(_err)
|
||||
{
|
||||
BX_CHECK(NULL != _err, "_err can't be NULL");
|
||||
BX_ASSERT(NULL != _err, "_err can't be NULL");
|
||||
}
|
||||
|
||||
inline ErrorScope::~ErrorScope()
|
||||
{
|
||||
BX_CHECK(m_err->isOk(), "Error: %d", m_err->get().code);
|
||||
BX_ASSERT(m_err->isOk(), "Error: %d", m_err->get().code);
|
||||
}
|
||||
|
||||
} // namespace bx
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace bx
|
||||
template <uint16_t MaxHandlesT>
|
||||
inline uint16_t HandleListT<MaxHandlesT>::getNext(uint16_t _handle) const
|
||||
{
|
||||
BX_CHECK(isValid(_handle), "Invalid handle %d!", _handle);
|
||||
BX_ASSERT(isValid(_handle), "Invalid handle %d!", _handle);
|
||||
const Link& curr = m_links[_handle];
|
||||
return curr.m_next;
|
||||
}
|
||||
@@ -194,7 +194,7 @@ namespace bx
|
||||
template <uint16_t MaxHandlesT>
|
||||
inline uint16_t HandleListT<MaxHandlesT>::getPrev(uint16_t _handle) const
|
||||
{
|
||||
BX_CHECK(isValid(_handle), "Invalid handle %d!", _handle);
|
||||
BX_ASSERT(isValid(_handle), "Invalid handle %d!", _handle);
|
||||
const Link& curr = m_links[_handle];
|
||||
return curr.m_prev;
|
||||
}
|
||||
@@ -202,7 +202,7 @@ namespace bx
|
||||
template <uint16_t MaxHandlesT>
|
||||
inline void HandleListT<MaxHandlesT>::remove(uint16_t _handle)
|
||||
{
|
||||
BX_CHECK(isValid(_handle), "Invalid handle %d!", _handle);
|
||||
BX_ASSERT(isValid(_handle), "Invalid handle %d!", _handle);
|
||||
Link& curr = m_links[_handle];
|
||||
|
||||
if (kInvalidHandle != curr.m_prev)
|
||||
@@ -358,7 +358,7 @@ namespace bx
|
||||
template <uint16_t MaxHandlesT>
|
||||
inline void HandleAllocLruT<MaxHandlesT>::free(uint16_t _handle)
|
||||
{
|
||||
BX_CHECK(isValid(_handle), "Invalid handle %d!", _handle);
|
||||
BX_ASSERT(isValid(_handle), "Invalid handle %d!", _handle);
|
||||
m_list.remove(_handle);
|
||||
m_alloc.free(_handle);
|
||||
}
|
||||
@@ -366,7 +366,7 @@ namespace bx
|
||||
template <uint16_t MaxHandlesT>
|
||||
inline void HandleAllocLruT<MaxHandlesT>::touch(uint16_t _handle)
|
||||
{
|
||||
BX_CHECK(isValid(_handle), "Invalid handle %d!", _handle);
|
||||
BX_ASSERT(isValid(_handle), "Invalid handle %d!", _handle);
|
||||
m_list.remove(_handle);
|
||||
m_list.pushFront(_handle);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace bx
|
||||
|
||||
inline int32_t SizerWriter::write(const void* /*_data*/, int32_t _size, Error* _err)
|
||||
{
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
int32_t morecore = int32_t(m_pos - m_top) + _size;
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace bx
|
||||
|
||||
inline int32_t MemoryReader::read(void* _data, int32_t _size, Error* _err)
|
||||
{
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
int64_t remainder = m_top-m_pos;
|
||||
int32_t size = uint32_min(_size, uint32_t(min<int64_t>(remainder, INT32_MAX) ) );
|
||||
@@ -233,7 +233,7 @@ namespace bx
|
||||
|
||||
inline int32_t MemoryWriter::write(const void* _data, int32_t _size, Error* _err)
|
||||
{
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
int32_t morecore = int32_t(m_pos - m_size) + _size;
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace bx
|
||||
, m_size(_size)
|
||||
, m_buffer(_buffer)
|
||||
{
|
||||
BX_CHECK(_control.available() >= _size, "%d >= %d", _control.available(), _size);
|
||||
BX_ASSERT(_control.available() >= _size, "%d >= %d", _control.available(), _size);
|
||||
}
|
||||
|
||||
template <typename ControlT>
|
||||
@@ -210,7 +210,7 @@ namespace bx
|
||||
{
|
||||
uint32_t size = m_control.reserve(_size);
|
||||
BX_UNUSED(size);
|
||||
BX_CHECK(size == _size, "%d == %d", size, _size);
|
||||
BX_ASSERT(size == _size, "%d == %d", size, _size);
|
||||
m_write = m_control.m_current;
|
||||
m_end = m_write+_size;
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace bx
|
||||
template<typename Rng, typename Ty>
|
||||
inline void shuffle(Rng* _rng, Ty* _array, uint32_t _num)
|
||||
{
|
||||
BX_CHECK(_num != 0, "Number of elements can't be 0!");
|
||||
BX_ASSERT(_num != 0, "Number of elements can't be 0!");
|
||||
|
||||
for (uint32_t ii = 0, num = _num-1; ii < num; ++ii)
|
||||
{
|
||||
|
||||
@@ -230,9 +230,9 @@
|
||||
# define BX_CLASS(_class, ...) BX_MACRO_DISPATCHER(BX_CLASS_, __VA_ARGS__)(_class, __VA_ARGS__)
|
||||
#endif // BX_COMPILER_MSVC
|
||||
|
||||
#ifndef BX_CHECK
|
||||
# define BX_CHECK(_condition, ...) BX_NOOP()
|
||||
#endif // BX_CHECK
|
||||
#ifndef BX_ASSERT
|
||||
# define BX_ASSERT(_condition, ...) BX_NOOP()
|
||||
#endif // BX_ASSERT
|
||||
|
||||
#ifndef BX_TRACE
|
||||
# define BX_TRACE(...) BX_NOOP()
|
||||
@@ -240,7 +240,7 @@
|
||||
|
||||
#ifndef BX_WARN
|
||||
# define BX_WARN(_condition, ...) BX_NOOP()
|
||||
#endif // BX_CHECK
|
||||
#endif // BX_ASSERT
|
||||
|
||||
// static_assert sometimes causes unused-local-typedef...
|
||||
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wunused-local-typedef")
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#if BX_CONFIG_DEBUG
|
||||
# define BX_TRACE _BX_TRACE
|
||||
# define BX_WARN _BX_WARN
|
||||
# define BX_CHECK _BX_CHECK
|
||||
# define BX_ASSERT _BX_ASSERT
|
||||
# define BX_CONFIG_ALLOCATOR_DEBUG 1
|
||||
#endif // BX_CONFIG_DEBUG
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
} \
|
||||
BX_MACRO_BLOCK_END
|
||||
|
||||
#define _BX_CHECK(_condition, _format, ...) \
|
||||
#define _BX_ASSERT(_condition, _format, ...) \
|
||||
BX_MACRO_BLOCK_BEGIN \
|
||||
if (!BX_IGNORE_C4127(_condition) ) \
|
||||
{ \
|
||||
|
||||
@@ -100,7 +100,7 @@ extern "C" const char* strstr(const char* _str, const char* _find)
|
||||
|
||||
extern "C" void qsort(void* _base, size_t _num, size_t _size, bx::ComparisonFn _fn)
|
||||
{
|
||||
BX_CHECK(_num <= UINT32_MAX && _size <= UINT32_MAX, "");
|
||||
BX_ASSERT(_num <= UINT32_MAX && _size <= UINT32_MAX, "");
|
||||
return bx::quickSort(_base, _num, _size, _fn);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,8 +74,8 @@ namespace bx
|
||||
|
||||
DiyFp operator-(const DiyFp& rhs) const
|
||||
{
|
||||
BX_CHECK(e == rhs.e, "");
|
||||
BX_CHECK(f >= rhs.f, "");
|
||||
BX_ASSERT(e == rhs.e, "");
|
||||
BX_ASSERT(f >= rhs.f, "");
|
||||
return DiyFp(f - rhs.f, e);
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ namespace bx
|
||||
uint32_t index = static_cast<uint32_t>( (k >> 3) + 1);
|
||||
*K = -(-348 + static_cast<int32_t>(index << 3) ); // decimal exponent no need lookup table
|
||||
|
||||
BX_CHECK(index < sizeof(s_kCachedPowers_F) / sizeof(s_kCachedPowers_F[0]), "");
|
||||
BX_ASSERT(index < sizeof(s_kCachedPowers_F) / sizeof(s_kCachedPowers_F[0]), "");
|
||||
return DiyFp(s_kCachedPowers_F[index], s_kCachedPowers_E[index]);
|
||||
}
|
||||
|
||||
|
||||
38
src/file.cpp
38
src/file.cpp
@@ -100,7 +100,7 @@ namespace bx
|
||||
|
||||
virtual bool open(const FilePath& _filePath, Error* _err) override
|
||||
{
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
if (NULL != m_file)
|
||||
{
|
||||
@@ -131,15 +131,15 @@ namespace bx
|
||||
|
||||
virtual int64_t seek(int64_t _offset, Whence::Enum _whence) override
|
||||
{
|
||||
BX_CHECK(NULL != m_file, "Reader/Writer file is not open.");
|
||||
BX_ASSERT(NULL != m_file, "Reader/Writer file is not open.");
|
||||
fseeko64(m_file, _offset, _whence);
|
||||
return ftello64(m_file);
|
||||
}
|
||||
|
||||
virtual int32_t read(void* _data, int32_t _size, Error* _err) override
|
||||
{
|
||||
BX_CHECK(NULL != m_file, "Reader/Writer file is not open.");
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
BX_ASSERT(NULL != m_file, "Reader/Writer file is not open.");
|
||||
BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
int32_t size = (int32_t)fread(_data, 1, _size, m_file);
|
||||
if (size != _size)
|
||||
@@ -180,7 +180,7 @@ namespace bx
|
||||
|
||||
virtual bool open(const FilePath& _filePath, bool _append, Error* _err) override
|
||||
{
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
if (NULL != m_file)
|
||||
{
|
||||
@@ -212,15 +212,15 @@ namespace bx
|
||||
|
||||
virtual int64_t seek(int64_t _offset, Whence::Enum _whence) override
|
||||
{
|
||||
BX_CHECK(NULL != m_file, "Reader/Writer file is not open.");
|
||||
BX_ASSERT(NULL != m_file, "Reader/Writer file is not open.");
|
||||
fseeko64(m_file, _offset, _whence);
|
||||
return ftello64(m_file);
|
||||
}
|
||||
|
||||
virtual int32_t write(const void* _data, int32_t _size, Error* _err) override
|
||||
{
|
||||
BX_CHECK(NULL != m_file, "Reader/Writer file is not open.");
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
BX_ASSERT(NULL != m_file, "Reader/Writer file is not open.");
|
||||
BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
int32_t size = (int32_t)fwrite(_data, 1, _size, m_file);
|
||||
if (size != _size)
|
||||
@@ -272,7 +272,7 @@ namespace bx
|
||||
|
||||
virtual bool open(const FilePath& _filePath, Error* _err) override
|
||||
{
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
if (0 != m_fd)
|
||||
{
|
||||
@@ -304,14 +304,14 @@ namespace bx
|
||||
|
||||
virtual int64_t seek(int64_t _offset, Whence::Enum _whence) override
|
||||
{
|
||||
BX_CHECK(0 != m_fd, "Reader/Writer file is not open.");
|
||||
BX_ASSERT(0 != m_fd, "Reader/Writer file is not open.");
|
||||
return crt0::seek(m_fd, _offset, crt0::Whence::Enum(_whence) );
|
||||
}
|
||||
|
||||
virtual int32_t read(void* _data, int32_t _size, Error* _err) override
|
||||
{
|
||||
BX_CHECK(0 != m_fd, "Reader/Writer file is not open.");
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
BX_ASSERT(0 != m_fd, "Reader/Writer file is not open.");
|
||||
BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
int32_t size = crt0::read(m_fd, _data, _size);
|
||||
if (size != _size)
|
||||
@@ -353,7 +353,7 @@ namespace bx
|
||||
|
||||
virtual bool open(const FilePath& _filePath, bool _append, Error* _err) override
|
||||
{
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
if (0 != m_fd)
|
||||
{
|
||||
@@ -385,14 +385,14 @@ namespace bx
|
||||
|
||||
virtual int64_t seek(int64_t _offset, Whence::Enum _whence) override
|
||||
{
|
||||
BX_CHECK(0 != m_fd, "Reader/Writer file is not open.");
|
||||
BX_ASSERT(0 != m_fd, "Reader/Writer file is not open.");
|
||||
return crt0::seek(m_fd, _offset, crt0::Whence::Enum(_whence) );
|
||||
}
|
||||
|
||||
virtual int32_t write(const void* _data, int32_t _size, Error* _err) override
|
||||
{
|
||||
BX_CHECK(0 != m_fd, "Reader/Writer file is not open.");
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
BX_ASSERT(0 != m_fd, "Reader/Writer file is not open.");
|
||||
BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
int32_t size = crt0::write(m_fd, _data, _size);
|
||||
if (size != _size)
|
||||
@@ -582,7 +582,7 @@ namespace bx
|
||||
|
||||
virtual bool open(const FilePath& _filePath, Error* _err) override
|
||||
{
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
m_dir = opendir(_filePath.getCPtr() );
|
||||
|
||||
@@ -608,7 +608,7 @@ namespace bx
|
||||
|
||||
virtual int32_t read(void* _data, int32_t _size, Error* _err) override
|
||||
{
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
int32_t total = 0;
|
||||
|
||||
@@ -701,7 +701,7 @@ namespace bx
|
||||
virtual int32_t read(void* _data, int32_t _size, Error* _err) override
|
||||
{
|
||||
BX_UNUSED(_data, _size);
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
BX_ERROR_SET(_err, BX_ERROR_READERWRITER_EOF, "DirectoryReader: EOF.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ namespace bx
|
||||
|
||||
ProcessReader::~ProcessReader()
|
||||
{
|
||||
BX_CHECK(NULL == m_file, "Process not closed!");
|
||||
BX_ASSERT(NULL == m_file, "Process not closed!");
|
||||
}
|
||||
|
||||
bool ProcessReader::open(const FilePath& _filePath, const StringView& _args, Error* _err)
|
||||
{
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
if (NULL != m_file)
|
||||
{
|
||||
@@ -64,7 +64,7 @@ namespace bx
|
||||
|
||||
void ProcessReader::close()
|
||||
{
|
||||
BX_CHECK(NULL != m_file, "Process not open!");
|
||||
BX_ASSERT(NULL != m_file, "Process not open!");
|
||||
FILE* file = (FILE*)m_file;
|
||||
m_exitCode = pclose(file);
|
||||
m_file = NULL;
|
||||
@@ -72,7 +72,7 @@ namespace bx
|
||||
|
||||
int32_t ProcessReader::read(void* _data, int32_t _size, Error* _err)
|
||||
{
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); BX_UNUSED(_err);
|
||||
BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors."); BX_UNUSED(_err);
|
||||
|
||||
FILE* file = (FILE*)m_file;
|
||||
int32_t size = (int32_t)fread(_data, 1, _size, file);
|
||||
@@ -105,12 +105,12 @@ namespace bx
|
||||
|
||||
ProcessWriter::~ProcessWriter()
|
||||
{
|
||||
BX_CHECK(NULL == m_file, "Process not closed!");
|
||||
BX_ASSERT(NULL == m_file, "Process not closed!");
|
||||
}
|
||||
|
||||
bool ProcessWriter::open(const FilePath& _filePath, const StringView& _args, Error* _err)
|
||||
{
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors.");
|
||||
|
||||
if (NULL != m_file)
|
||||
{
|
||||
@@ -135,7 +135,7 @@ namespace bx
|
||||
|
||||
void ProcessWriter::close()
|
||||
{
|
||||
BX_CHECK(NULL != m_file, "Process not open!");
|
||||
BX_ASSERT(NULL != m_file, "Process not open!");
|
||||
FILE* file = (FILE*)m_file;
|
||||
m_exitCode = pclose(file);
|
||||
m_file = NULL;
|
||||
@@ -143,7 +143,7 @@ namespace bx
|
||||
|
||||
int32_t ProcessWriter::write(const void* _data, int32_t _size, Error* _err)
|
||||
{
|
||||
BX_CHECK(NULL != _err, "Reader/Writer interface calling functions must handle errors."); BX_UNUSED(_err);
|
||||
BX_ASSERT(NULL != _err, "Reader/Writer interface calling functions must handle errors."); BX_UNUSED(_err);
|
||||
|
||||
FILE* file = (FILE*)m_file;
|
||||
int32_t size = (int32_t)fwrite(_data, 1, _size, file);
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace bx
|
||||
|
||||
SemaphoreInternal* si = (SemaphoreInternal*)m_internal;
|
||||
si->m_handle = dispatch_semaphore_create(0);
|
||||
BX_CHECK(NULL != si->m_handle, "dispatch_semaphore_create failed.");
|
||||
BX_ASSERT(NULL != si->m_handle, "dispatch_semaphore_create failed.");
|
||||
}
|
||||
|
||||
Semaphore::~Semaphore()
|
||||
@@ -140,10 +140,10 @@ namespace bx
|
||||
int result;
|
||||
|
||||
result = pthread_mutex_init(&si->m_mutex, NULL);
|
||||
BX_CHECK(0 == result, "pthread_mutex_init %d", result);
|
||||
BX_ASSERT(0 == result, "pthread_mutex_init %d", result);
|
||||
|
||||
result = pthread_cond_init(&si->m_cond, NULL);
|
||||
BX_CHECK(0 == result, "pthread_cond_init %d", result);
|
||||
BX_ASSERT(0 == result, "pthread_cond_init %d", result);
|
||||
|
||||
BX_UNUSED(result);
|
||||
}
|
||||
@@ -154,10 +154,10 @@ namespace bx
|
||||
|
||||
int result;
|
||||
result = pthread_cond_destroy(&si->m_cond);
|
||||
BX_CHECK(0 == result, "pthread_cond_destroy %d", result);
|
||||
BX_ASSERT(0 == result, "pthread_cond_destroy %d", result);
|
||||
|
||||
result = pthread_mutex_destroy(&si->m_mutex);
|
||||
BX_CHECK(0 == result, "pthread_mutex_destroy %d", result);
|
||||
BX_ASSERT(0 == result, "pthread_mutex_destroy %d", result);
|
||||
|
||||
BX_UNUSED(result);
|
||||
}
|
||||
@@ -167,18 +167,18 @@ namespace bx
|
||||
SemaphoreInternal* si = (SemaphoreInternal*)m_internal;
|
||||
|
||||
int result = pthread_mutex_lock(&si->m_mutex);
|
||||
BX_CHECK(0 == result, "pthread_mutex_lock %d", result);
|
||||
BX_ASSERT(0 == result, "pthread_mutex_lock %d", result);
|
||||
|
||||
for (uint32_t ii = 0; ii < _count; ++ii)
|
||||
{
|
||||
result = pthread_cond_signal(&si->m_cond);
|
||||
BX_CHECK(0 == result, "pthread_cond_signal %d", result);
|
||||
BX_ASSERT(0 == result, "pthread_cond_signal %d", result);
|
||||
}
|
||||
|
||||
si->m_count += _count;
|
||||
|
||||
result = pthread_mutex_unlock(&si->m_mutex);
|
||||
BX_CHECK(0 == result, "pthread_mutex_unlock %d", result);
|
||||
BX_ASSERT(0 == result, "pthread_mutex_unlock %d", result);
|
||||
|
||||
BX_UNUSED(result);
|
||||
}
|
||||
@@ -188,7 +188,7 @@ namespace bx
|
||||
SemaphoreInternal* si = (SemaphoreInternal*)m_internal;
|
||||
|
||||
int result = pthread_mutex_lock(&si->m_mutex);
|
||||
BX_CHECK(0 == result, "pthread_mutex_lock %d", result);
|
||||
BX_ASSERT(0 == result, "pthread_mutex_lock %d", result);
|
||||
|
||||
if (-1 == _msecs)
|
||||
{
|
||||
@@ -219,7 +219,7 @@ namespace bx
|
||||
}
|
||||
|
||||
result = pthread_mutex_unlock(&si->m_mutex);
|
||||
BX_CHECK(0 == result, "pthread_mutex_unlock %d", result);
|
||||
BX_ASSERT(0 == result, "pthread_mutex_unlock %d", result);
|
||||
|
||||
BX_UNUSED(result);
|
||||
|
||||
@@ -240,7 +240,7 @@ namespace bx
|
||||
#else
|
||||
si->m_handle = CreateSemaphoreA(NULL, 0, LONG_MAX, NULL);
|
||||
#endif
|
||||
BX_CHECK(NULL != si->m_handle, "Failed to create Semaphore!");
|
||||
BX_ASSERT(NULL != si->m_handle, "Failed to create Semaphore!");
|
||||
}
|
||||
|
||||
Semaphore::~Semaphore()
|
||||
|
||||
@@ -310,9 +310,9 @@ namespace bx
|
||||
|
||||
inline int32_t strCopy(char* _dst, int32_t _dstSize, const char* _src, int32_t _num)
|
||||
{
|
||||
BX_CHECK(NULL != _dst, "_dst can't be NULL!");
|
||||
BX_CHECK(NULL != _src, "_src can't be NULL!");
|
||||
BX_CHECK(0 < _dstSize, "_dstSize can't be 0!");
|
||||
BX_ASSERT(NULL != _dst, "_dst can't be NULL!");
|
||||
BX_ASSERT(NULL != _src, "_src can't be NULL!");
|
||||
BX_ASSERT(0 < _dstSize, "_dstSize can't be 0!");
|
||||
|
||||
const int32_t len = strLen(_src, _num);
|
||||
const int32_t max = _dstSize-1;
|
||||
@@ -330,9 +330,9 @@ namespace bx
|
||||
|
||||
inline int32_t strCat(char* _dst, int32_t _dstSize, const char* _src, int32_t _num)
|
||||
{
|
||||
BX_CHECK(NULL != _dst, "_dst can't be NULL!");
|
||||
BX_CHECK(NULL != _src, "_src can't be NULL!");
|
||||
BX_CHECK(0 < _dstSize, "_dstSize can't be 0!");
|
||||
BX_ASSERT(NULL != _dst, "_dst can't be NULL!");
|
||||
BX_ASSERT(NULL != _src, "_src can't be NULL!");
|
||||
BX_ASSERT(0 < _dstSize, "_dstSize can't be 0!");
|
||||
|
||||
const int32_t max = _dstSize;
|
||||
const int32_t len = strLen(_dst, max);
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace bx
|
||||
|
||||
bool Thread::init(ThreadFn _fn, void* _userData, uint32_t _stackSize, const char* _name)
|
||||
{
|
||||
BX_CHECK(!m_running, "Already running!");
|
||||
BX_ASSERT(!m_running, "Already running!");
|
||||
|
||||
m_fn = _fn;
|
||||
m_userData = _userData;
|
||||
@@ -220,7 +220,7 @@ namespace bx
|
||||
|
||||
void Thread::shutdown()
|
||||
{
|
||||
BX_CHECK(m_running, "Not running!");
|
||||
BX_ASSERT(m_running, "Not running!");
|
||||
ThreadInternal* ti = (ThreadInternal*)m_internal;
|
||||
#if BX_CRT_NONE
|
||||
crt0::threadJoin(ti->m_handle, NULL);
|
||||
@@ -388,14 +388,14 @@ namespace bx
|
||||
|
||||
TlsDataInternal* ti = (TlsDataInternal*)m_internal;
|
||||
ti->m_id = TlsAlloc();
|
||||
BX_CHECK(TLS_OUT_OF_INDEXES != ti->m_id, "Failed to allocated TLS index (err: 0x%08x).", GetLastError() );
|
||||
BX_ASSERT(TLS_OUT_OF_INDEXES != ti->m_id, "Failed to allocated TLS index (err: 0x%08x).", GetLastError() );
|
||||
}
|
||||
|
||||
TlsData::~TlsData()
|
||||
{
|
||||
TlsDataInternal* ti = (TlsDataInternal*)m_internal;
|
||||
BOOL result = TlsFree(ti->m_id);
|
||||
BX_CHECK(0 != result, "Failed to free TLS index (err: 0x%08x).", GetLastError() ); BX_UNUSED(result);
|
||||
BX_ASSERT(0 != result, "Failed to free TLS index (err: 0x%08x).", GetLastError() ); BX_UNUSED(result);
|
||||
}
|
||||
|
||||
void* TlsData::get() const
|
||||
@@ -418,14 +418,14 @@ namespace bx
|
||||
|
||||
TlsDataInternal* ti = (TlsDataInternal*)m_internal;
|
||||
int result = pthread_key_create(&ti->m_id, NULL);
|
||||
BX_CHECK(0 == result, "pthread_key_create failed %d.", result); BX_UNUSED(result);
|
||||
BX_ASSERT(0 == result, "pthread_key_create failed %d.", result); BX_UNUSED(result);
|
||||
}
|
||||
|
||||
TlsData::~TlsData()
|
||||
{
|
||||
TlsDataInternal* ti = (TlsDataInternal*)m_internal;
|
||||
int result = pthread_key_delete(ti->m_id);
|
||||
BX_CHECK(0 == result, "pthread_key_delete failed %d.", result); BX_UNUSED(result);
|
||||
BX_ASSERT(0 == result, "pthread_key_delete failed %d.", result); BX_UNUSED(result);
|
||||
}
|
||||
|
||||
void* TlsData::get() const
|
||||
@@ -438,7 +438,7 @@ namespace bx
|
||||
{
|
||||
TlsDataInternal* ti = (TlsDataInternal*)m_internal;
|
||||
int result = pthread_setspecific(ti->m_id, _ptr);
|
||||
BX_CHECK(0 == result, "pthread_setspecific failed %d.", result); BX_UNUSED(result);
|
||||
BX_ASSERT(0 == result, "pthread_setspecific failed %d.", result); BX_UNUSED(result);
|
||||
}
|
||||
#endif // BX_PLATFORM_*
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace bx
|
||||
gettimeofday(&now, 0);
|
||||
int64_t i64 = now.tv_sec*INT64_C(1000000) + now.tv_usec;
|
||||
#else
|
||||
BX_CHECK(false, "Not implemented!");
|
||||
BX_ASSERT(false, "Not implemented!");
|
||||
int64_t i64 = UINT64_MAX;
|
||||
#endif // BX_PLATFORM_
|
||||
return i64;
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace bx
|
||||
|
||||
Blk remove()
|
||||
{
|
||||
BX_CHECK(0 == m_used, "");
|
||||
BX_ASSERT(0 == m_used, "");
|
||||
|
||||
if (0 < m_free.size() )
|
||||
{
|
||||
@@ -134,7 +134,7 @@ namespace bx
|
||||
|
||||
void free(const Blk& _blk)
|
||||
{
|
||||
BX_CHECK(isValid(_blk), "Freeing invalid block!");
|
||||
BX_ASSERT(isValid(_blk), "Freeing invalid block!");
|
||||
|
||||
m_used -= _blk.size;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user