chore: Format SDK headers
This commit is contained in:
parent
8739f0a85c
commit
0b4d6eb9fe
8 changed files with 1769 additions and 1757 deletions
File diff suppressed because it is too large
Load diff
|
@ -38,7 +38,7 @@ class ApiAllocator : public Allocator
|
|||
|
||||
public:
|
||||
ApiAllocator(AllocatorApi *api, AllocatorObject *object) : _object(object), _api(api) {}
|
||||
ApiAllocator(const ApiAllocator &a) : _object(a._object), _api(a._api) {}
|
||||
ApiAllocator(const ApiAllocator &a) : Allocator(), _object(a._object), _api(a._api) {}
|
||||
ApiAllocator & operator=(const ApiAllocator &a) { _object = a._object; _api = a._api; return *this; }
|
||||
|
||||
virtual void *allocate(size_t size, unsigned align = DEFAULT_ALIGN) override {return _api->allocate(_object, size, align);}
|
||||
|
@ -78,7 +78,10 @@ public:
|
|||
return ret;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
size_t deallocate(void *p) override { return 0; }
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
char *start() {return _start;}
|
||||
bool out_of_memory() {return _p > _end;}
|
||||
|
|
|
@ -16,21 +16,21 @@
|
|||
}
|
||||
}
|
||||
|
||||
#define XASSERT_BASE(test, test_msg, msg, ...) \
|
||||
#define XASSERT_BASE(test, test_msg, ...) \
|
||||
do {if (!(test)) { \
|
||||
struct ErrorApi *api = stingray_plugin_foundation::error_api(); \
|
||||
if (api && api->report_assert_failure) \
|
||||
api->report_assert_failure(__LINE__, __FILE__, test_msg, api->eprintf(msg, ## __VA_ARGS__)); \
|
||||
api->report_assert_failure(__LINE__, __FILE__, test_msg, api->eprintf(__VA_ARGS__)); \
|
||||
else \
|
||||
assert(test); \
|
||||
}} while (0)
|
||||
#define XASSERT(test, msg, ...) do {XASSERT_BASE(test, #test, msg, ## __VA_ARGS__);} while(0)
|
||||
#define XENSURE(test) do {XASSERT_BASE(test, #test, "Assertion failed");} while(0)
|
||||
#define XERROR(msg, ...) do {XASSERT_BASE(false, nullptr, msg, ## __VA_ARGS__);} while(0)
|
||||
#define XASSERT(test, ...) do {XASSERT_BASE(test, #test, __VA_ARGS__);} while(0)
|
||||
#define XENSURE(test) do {XASSERT_BASE(test, #test, "Assertion failed");} while(0)
|
||||
#define XERROR(...) do {XASSERT_BASE(false, nullptr, __VA_ARGS__);} while(0)
|
||||
#else
|
||||
#define XASSERT(test, msg, ...) ((void)0)
|
||||
#define XENSURE(test) ((void)0)
|
||||
#define XERROR(msg, ...) ((void)0)
|
||||
#define XASSERT(test, ...) ((void)0)
|
||||
#define XENSURE(test) ((void)0)
|
||||
#define XERROR(...) ((void)0)
|
||||
|
||||
namespace stingray_plugin_foundation {
|
||||
inline void set_error_api(struct ErrorApi *api) {}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#pragma once
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
|
||||
namespace stingray_plugin_foundation {
|
||||
|
||||
|
@ -15,3 +17,5 @@ struct equal_to
|
|||
};
|
||||
|
||||
} // namespace stingray_plugin_foundation
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -108,11 +111,7 @@ inline uint64_t eight_byte_hash_64(const void * key)
|
|||
}
|
||||
|
||||
// Default hashing for builtin-types.
|
||||
template <class T> struct default_hash
|
||||
{
|
||||
static constexpr bool value = false;
|
||||
unsigned operator()(T t) const { static_assert(value, "default_hash not implemented for this type!"); return 0; }
|
||||
};
|
||||
template <class T> struct default_hash;
|
||||
|
||||
template <class T> struct default_hash<T *>
|
||||
{
|
||||
|
@ -190,3 +189,5 @@ inline unsigned mix(unsigned h, unsigned k)
|
|||
}
|
||||
|
||||
} // namespace stingray_plugin_foundation
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
|
|
|
@ -22,6 +22,8 @@ inline IdString64::IdString64(unsigned len, const char *s)
|
|||
_id = murmur_hash_64(s, len, 0);
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
inline IdString64::IdString64(const char *s, uint64_t id)
|
||||
{
|
||||
_id = id;
|
||||
|
@ -29,6 +31,7 @@ inline IdString64::IdString64(const char *s, uint64_t id)
|
|||
XASSERT(_id == murmur_hash_64(s, (unsigned)strlen(s), 0), "Bad static idstring `%s`", s);
|
||||
#endif
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
inline const char *IdString64::to_id_hex() const
|
||||
{
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
#include <string.h> // memmove
|
||||
#include <algorithm>
|
||||
|
||||
#if !defined(PS4)
|
||||
#pragma warning(disable:4345)
|
||||
#endif
|
||||
|
||||
namespace stingray_plugin_foundation {
|
||||
|
||||
struct NoAllocator {};
|
||||
|
|
|
@ -60,10 +60,7 @@ void Vector<T>::push_back(const ASSIGNABLE &item)
|
|||
if (_size + 1 > _capacity)
|
||||
grow();
|
||||
construct(_data + _size, IS_ALLOCATOR_AWARE_TYPE(T)());
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4244) // can't fix cast warning
|
||||
_data[_size] = item;
|
||||
#pragma warning(pop)
|
||||
++_size;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue