diff options
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_alloca.h | 4 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_linear_allocator.hh | 6 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_map.hh | 24 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_map_slots.hh | 4 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_resource_scope.hh | 2 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_stack.hh | 2 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_vector.hh | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/array_store.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/fileops.c | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_base_inline.c | 6 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_color.c | 10 |
11 files changed, 38 insertions, 36 deletions
diff --git a/source/blender/blenlib/BLI_alloca.h b/source/blender/blenlib/BLI_alloca.h index 92567ed35fa..9e3bd98537d 100644 --- a/source/blender/blenlib/BLI_alloca.h +++ b/source/blender/blenlib/BLI_alloca.h @@ -28,9 +28,9 @@ #if defined(__GNUC__) || defined(__clang__) # if defined(__cplusplus) && (__cplusplus > 199711L) -# define BLI_array_alloca(arr, realsize) (decltype(arr)) alloca(sizeof(*arr) * (realsize)) +# define BLI_array_alloca(arr, realsize) (decltype(arr))alloca(sizeof(*arr) * (realsize)) # else -# define BLI_array_alloca(arr, realsize) (typeof(arr)) alloca(sizeof(*arr) * (realsize)) +# define BLI_array_alloca(arr, realsize) (typeof(arr))alloca(sizeof(*arr) * (realsize)) # endif #else # define BLI_array_alloca(arr, realsize) alloca(sizeof(*arr) * (realsize)) diff --git a/source/blender/blenlib/BLI_linear_allocator.hh b/source/blender/blenlib/BLI_linear_allocator.hh index 7de6bcfdd98..bb14a6008a7 100644 --- a/source/blender/blenlib/BLI_linear_allocator.hh +++ b/source/blender/blenlib/BLI_linear_allocator.hh @@ -121,7 +121,7 @@ template<typename Allocator = GuardedAllocator> class LinearAllocator : NonCopya * You must not call `delete` on the returned value. * Instead, only the destructor has to be called. */ - template<typename T, typename... Args> destruct_ptr<T> construct(Args &&... args) + template<typename T, typename... Args> destruct_ptr<T> construct(Args &&...args) { void *buffer = this->allocate(sizeof(T), alignof(T)); T *value = new (buffer) T(std::forward<Args>(args)...); @@ -134,7 +134,7 @@ template<typename Allocator = GuardedAllocator> class LinearAllocator : NonCopya * the constructed elements. */ template<typename T, typename... Args> - MutableSpan<T> construct_array(int64_t size, Args &&... args) + MutableSpan<T> construct_array(int64_t size, Args &&...args) { MutableSpan<T> array = this->allocate_array<T>(size); for (const int64_t i : IndexRange(size)) { @@ -186,7 +186,7 @@ template<typename Allocator = GuardedAllocator> class LinearAllocator : NonCopya } template<typename T, typename... Args> - Span<T *> construct_elements_and_pointer_array(int64_t n, Args &&... args) + Span<T *> construct_elements_and_pointer_array(int64_t n, Args &&...args) { MutableSpan<void *> void_pointers = this->allocate_elements_and_pointer_array( n, sizeof(T), alignof(T)); diff --git a/source/blender/blenlib/BLI_map.hh b/source/blender/blenlib/BLI_map.hh index 4d254960f34..0e7d7c06049 100644 --- a/source/blender/blenlib/BLI_map.hh +++ b/source/blender/blenlib/BLI_map.hh @@ -248,7 +248,7 @@ class Map { this->add_new_as(std::move(key), std::move(value)); } template<typename ForwardKey, typename... ForwardValue> - void add_new_as(ForwardKey &&key, ForwardValue &&... value) + void add_new_as(ForwardKey &&key, ForwardValue &&...value) { this->add_new__impl( std::forward<ForwardKey>(key), hash_(key), std::forward<ForwardValue>(value)...); @@ -278,7 +278,7 @@ class Map { return this->add_as(std::move(key), std::move(value)); } template<typename ForwardKey, typename... ForwardValue> - bool add_as(ForwardKey &&key, ForwardValue &&... value) + bool add_as(ForwardKey &&key, ForwardValue &&...value) { return this->add__impl( std::forward<ForwardKey>(key), hash_(key), std::forward<ForwardValue>(value)...); @@ -308,7 +308,7 @@ class Map { return this->add_overwrite_as(std::move(key), std::move(value)); } template<typename ForwardKey, typename... ForwardValue> - bool add_overwrite_as(ForwardKey &&key, ForwardValue &&... value) + bool add_overwrite_as(ForwardKey &&key, ForwardValue &&...value) { return this->add_overwrite__impl( std::forward<ForwardKey>(key), hash_(key), std::forward<ForwardValue>(value)...); @@ -414,7 +414,7 @@ class Map { return this->pop_default_as(key, std::move(default_value)); } template<typename ForwardKey, typename... ForwardValue> - Value pop_default_as(const ForwardKey &key, ForwardValue &&... default_value) + Value pop_default_as(const ForwardKey &key, ForwardValue &&...default_value) { Slot *slot = this->lookup_slot_ptr(key, hash_(key)); if (slot == nullptr) { @@ -526,7 +526,7 @@ class Map { return this->lookup_default_as(key, default_value); } template<typename ForwardKey, typename... ForwardValue> - Value lookup_default_as(const ForwardKey &key, ForwardValue &&... default_value) const + Value lookup_default_as(const ForwardKey &key, ForwardValue &&...default_value) const { const Value *ptr = this->lookup_ptr_as(key); if (ptr != nullptr) { @@ -558,7 +558,7 @@ class Map { return this->lookup_or_add_as(std::move(key), std::move(value)); } template<typename ForwardKey, typename... ForwardValue> - Value &lookup_or_add_as(ForwardKey &&key, ForwardValue &&... value) + Value &lookup_or_add_as(ForwardKey &&key, ForwardValue &&...value) { return this->lookup_or_add__impl( std::forward<ForwardKey>(key), hash_(key), std::forward<ForwardValue>(value)...); @@ -1058,7 +1058,7 @@ class Map { } template<typename ForwardKey, typename... ForwardValue> - void add_new__impl(ForwardKey &&key, uint64_t hash, ForwardValue &&... value) + void add_new__impl(ForwardKey &&key, uint64_t hash, ForwardValue &&...value) { BLI_assert(!this->contains_as(key)); @@ -1075,7 +1075,7 @@ class Map { } template<typename ForwardKey, typename... ForwardValue> - bool add__impl(ForwardKey &&key, uint64_t hash, ForwardValue &&... value) + bool add__impl(ForwardKey &&key, uint64_t hash, ForwardValue &&...value) { this->ensure_can_add(); @@ -1148,7 +1148,7 @@ class Map { } template<typename ForwardKey, typename... ForwardValue> - Value &lookup_or_add__impl(ForwardKey &&key, uint64_t hash, ForwardValue &&... value) + Value &lookup_or_add__impl(ForwardKey &&key, uint64_t hash, ForwardValue &&...value) { this->ensure_can_add(); @@ -1166,7 +1166,7 @@ class Map { } template<typename ForwardKey, typename... ForwardValue> - bool add_overwrite__impl(ForwardKey &&key, uint64_t hash, ForwardValue &&... value) + bool add_overwrite__impl(ForwardKey &&key, uint64_t hash, ForwardValue &&...value) { auto create_func = [&](Value *ptr) { new (static_cast<void *>(ptr)) Value(std::forward<ForwardValue>(value)...); @@ -1283,13 +1283,13 @@ template<typename Key, typename Value> class StdUnorderedMapWrapper { } template<typename ForwardKey, typename... ForwardValue> - void add_new(ForwardKey &&key, ForwardValue &&... value) + void add_new(ForwardKey &&key, ForwardValue &&...value) { map_.insert({std::forward<ForwardKey>(key), Value(std::forward<ForwardValue>(value)...)}); } template<typename ForwardKey, typename... ForwardValue> - bool add(ForwardKey &&key, ForwardValue &&... value) + bool add(ForwardKey &&key, ForwardValue &&...value) { return map_ .insert({std::forward<ForwardKey>(key), Value(std::forward<ForwardValue>(value)...)}) diff --git a/source/blender/blenlib/BLI_map_slots.hh b/source/blender/blenlib/BLI_map_slots.hh index 1b4ca11af41..7658ae51fd9 100644 --- a/source/blender/blenlib/BLI_map_slots.hh +++ b/source/blender/blenlib/BLI_map_slots.hh @@ -196,7 +196,7 @@ template<typename Key, typename Value> class SimpleMapSlot { * constructed by calling the constructor with the given key/value as parameter. */ template<typename ForwardKey, typename... ForwardValue> - void occupy(ForwardKey &&key, uint64_t hash, ForwardValue &&... value) + void occupy(ForwardKey &&key, uint64_t hash, ForwardValue &&...value) { BLI_assert(!this->is_occupied()); new (&value_buffer_) Value(std::forward<ForwardValue>(value)...); @@ -316,7 +316,7 @@ template<typename Key, typename Value, typename KeyInfo> class IntrusiveMapSlot } template<typename ForwardKey, typename... ForwardValue> - void occupy(ForwardKey &&key, uint64_t hash, ForwardValue &&... value) + void occupy(ForwardKey &&key, uint64_t hash, ForwardValue &&...value) { BLI_assert(!this->is_occupied()); BLI_assert(KeyInfo::is_not_empty_or_removed(key)); diff --git a/source/blender/blenlib/BLI_resource_scope.hh b/source/blender/blenlib/BLI_resource_scope.hh index e5a698f25f1..6a98c2dcc1c 100644 --- a/source/blender/blenlib/BLI_resource_scope.hh +++ b/source/blender/blenlib/BLI_resource_scope.hh @@ -148,7 +148,7 @@ class ResourceScope : NonCopyable, NonMovable { /** * Utility method to construct an instance of type T that will be owned by the ResourceScope. */ - template<typename T, typename... Args> T &construct(const char *name, Args &&... args) + template<typename T, typename... Args> T &construct(const char *name, Args &&...args) { destruct_ptr<T> value_ptr = m_allocator.construct<T>(std::forward<Args>(args)...); T &value_ref = *value_ptr; diff --git a/source/blender/blenlib/BLI_stack.hh b/source/blender/blenlib/BLI_stack.hh index d66316a95d9..c9c355288b6 100644 --- a/source/blender/blenlib/BLI_stack.hh +++ b/source/blender/blenlib/BLI_stack.hh @@ -233,7 +233,7 @@ class Stack { this->push_as(std::move(value)); } /* This is similar to `std::stack::emplace`. */ - template<typename... ForwardT> void push_as(ForwardT &&... value) + template<typename... ForwardT> void push_as(ForwardT &&...value) { if (top_ == top_chunk_->capacity_end) { this->activate_next_chunk(1); diff --git a/source/blender/blenlib/BLI_vector.hh b/source/blender/blenlib/BLI_vector.hh index da02c4f4ae1..d2b94a6d8ef 100644 --- a/source/blender/blenlib/BLI_vector.hh +++ b/source/blender/blenlib/BLI_vector.hh @@ -445,7 +445,7 @@ class Vector { this->append_as(std::move(value)); } /* This is similar to `std::vector::emplace_back`. */ - template<typename... ForwardValue> void append_as(ForwardValue &&... value) + template<typename... ForwardValue> void append_as(ForwardValue &&...value) { this->ensure_space_for_one(); this->append_unchecked_as(std::forward<ForwardValue>(value)...); @@ -487,7 +487,7 @@ class Vector { { this->append_unchecked_as(std::move(value)); } - template<typename... ForwardT> void append_unchecked_as(ForwardT &&... value) + template<typename... ForwardT> void append_unchecked_as(ForwardT &&...value) { BLI_assert(end_ < capacity_end_); new (end_) T(std::forward<ForwardT>(value)...); diff --git a/source/blender/blenlib/intern/array_store.c b/source/blender/blenlib/intern/array_store.c index 5ad57a7bec8..ee06d8b6347 100644 --- a/source/blender/blenlib/intern/array_store.c +++ b/source/blender/blenlib/intern/array_store.c @@ -1436,8 +1436,8 @@ BArrayStore *BLI_array_store_create(uint stride, uint chunk_count) bs->info.accum_steps = BCHUNK_HASH_TABLE_ACCUMULATE_STEPS - 1; /* Triangle number, identifying now much read-ahead we need: * https://en.wikipedia.org/wiki/Triangular_number (+ 1) */ - bs->info.accum_read_ahead_len = (uint)( - (((bs->info.accum_steps * (bs->info.accum_steps + 1))) / 2) + 1); + bs->info.accum_read_ahead_len = + (uint)((((bs->info.accum_steps * (bs->info.accum_steps + 1))) / 2) + 1); bs->info.accum_read_ahead_bytes = bs->info.accum_read_ahead_len * stride; #else bs->info.accum_read_ahead_bytes = BCHUNK_HASH_LEN * stride; diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 1a00142ddb1..ac034d2b5cd 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -919,8 +919,8 @@ static int delete_soft(const char *file, const char **error_message) Class NSStringClass = objc_getClass("NSString"); SEL stringWithUTF8StringSel = sel_registerName("stringWithUTF8String:"); - id pathString = ((id(*)(Class, SEL, const char *))objc_msgSend)( - NSStringClass, stringWithUTF8StringSel, file); + id pathString = (( + id(*)(Class, SEL, const char *))objc_msgSend)(NSStringClass, stringWithUTF8StringSel, file); Class NSFileManagerClass = objc_getClass("NSFileManager"); SEL defaultManagerSel = sel_registerName("defaultManager"); @@ -931,8 +931,8 @@ static int delete_soft(const char *file, const char **error_message) id nsurl = ((id(*)(Class, SEL, id))objc_msgSend)(NSURLClass, fileURLWithPathSel, pathString); SEL trashItemAtURLSel = sel_registerName("trashItemAtURL:resultingItemURL:error:"); - BOOL deleteSuccessful = ((BOOL(*)(id, SEL, id, id, id))objc_msgSend)( - fileManager, trashItemAtURLSel, nsurl, nil, nil); + BOOL deleteSuccessful = (( + BOOL(*)(id, SEL, id, id, id))objc_msgSend)(fileManager, trashItemAtURLSel, nsurl, nil, nil); if (deleteSuccessful) { ret = 0; diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c index 0a213fa8696..6e3846e59c6 100644 --- a/source/blender/blenlib/intern/math_base_inline.c +++ b/source/blender/blenlib/intern/math_base_inline.c @@ -807,9 +807,9 @@ MINLINE unsigned char unit_float_to_uchar_clamp(float val) MINLINE unsigned short unit_float_to_ushort_clamp(float val) { - return (unsigned short)((val >= 1.0f - 0.5f / 65535) ? - 65535 : - (val <= 0.0f) ? 0 : (val * 65535.0f + 0.5f)); + return (unsigned short)((val >= 1.0f - 0.5f / 65535) ? 65535 : + (val <= 0.0f) ? 0 : + (val * 65535.0f + 0.5f)); } #define unit_float_to_ushort_clamp(val) \ ((CHECK_TYPE_INLINE(val, float)), unit_float_to_ushort_clamp(val)) diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index da97e697f2f..14eb78648e0 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -685,10 +685,12 @@ static void blackbody_temperature_to_rgb(float rgb[3], float t) rgb[2] = 0.0f; } else { - int i = (t >= 6365.0f) ? - 5 : - (t >= 3315.0f) ? 4 : - (t >= 1902.0f) ? 3 : (t >= 1449.0f) ? 2 : (t >= 1167.0f) ? 1 : 0; + int i = (t >= 6365.0f) ? 5 : + (t >= 3315.0f) ? 4 : + (t >= 1902.0f) ? 3 : + (t >= 1449.0f) ? 2 : + (t >= 1167.0f) ? 1 : + 0; const float *r = blackbody_table_r[i]; const float *g = blackbody_table_g[i]; |