Fixed bx::open.

This commit is contained in:
Branimir Karadžić
2016-02-04 22:54:08 -08:00
parent 6f0ecab89d
commit 08ff290e0c
2 changed files with 8 additions and 5 deletions

View File

@@ -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!"); \

View File

@@ -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);
}