mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-18 04:53:06 +01:00
Fixed bx::open.
This commit is contained in:
@@ -14,10 +14,13 @@
|
||||
_ptr->setError(_result, "" _msg); \
|
||||
BX_MACRO_BLOCK_END
|
||||
|
||||
#define BX_ERROR_USE_TEMP_WHEN_NULL(_ptr) \
|
||||
const bx::Error tmpError; /* It should not be used directly! */ \
|
||||
_ptr = NULL == _ptr ? const_cast<bx::Error*>(&tmpError) : _ptr
|
||||
|
||||
#define BX_ERROR_SCOPE(_ptr) \
|
||||
const bx::Error tmpError /* It should not be used directly! */; \
|
||||
_ptr = NULL == _ptr ? const_cast<bx::Error*>(&tmpError) : _ptr; \
|
||||
bx::ErrorScope bxErrorScope(const_cast<bx::Error*>(&tmpError))
|
||||
BX_ERROR_USE_TEMP_WHEN_NULL(_ptr); \
|
||||
bx::ErrorScope bxErrorScope(const_cast<bx::Error*>(&tmpError) )
|
||||
|
||||
#define BX_ERROR_RESULT(_err, _code) \
|
||||
BX_STATIC_ASSERT(_code != 0, "ErrorCode 0 is reserved!"); \
|
||||
|
||||
@@ -224,7 +224,7 @@ namespace bx
|
||||
|
||||
inline bool open(FileReaderI* _reader, const char* _filePath, Error* _err = NULL)
|
||||
{
|
||||
BX_ERROR_SCOPE(_err);
|
||||
BX_ERROR_USE_TEMP_WHEN_NULL(_err);
|
||||
return _reader->open(_filePath, _err);
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ namespace bx
|
||||
|
||||
inline bool open(FileWriterI* _writer, const char* _filePath, bool _append = false, Error* _err = NULL)
|
||||
{
|
||||
BX_ERROR_SCOPE(_err);
|
||||
BX_ERROR_USE_TEMP_WHEN_NULL(_err);
|
||||
return _writer->open(_filePath, _append, _err);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user