summaryrefslogtreecommitdiff
path: root/core/os
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-04-05 13:40:26 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-04-06 14:34:37 +0300
commitf851c4aa330e1064a66db50be62db2466f4fb768 (patch)
tree70f3bd487e91feb4ca777dba214a09b17041da97 /core/os
parent72407a9cfbd4f58102972c0910429f3ab7006f07 (diff)
Fix some issues found by cppcheck.
Diffstat (limited to 'core/os')
-rw-r--r--core/os/pool_allocator.cpp4
-rw-r--r--core/os/pool_allocator.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/core/os/pool_allocator.cpp b/core/os/pool_allocator.cpp
index 190617f967..f622e2c7c5 100644
--- a/core/os/pool_allocator.cpp
+++ b/core/os/pool_allocator.cpp
@@ -149,7 +149,7 @@ void PoolAllocator::compact_up(int p_from) {
}
}
-bool PoolAllocator::find_entry_index(EntryIndicesPos *p_map_pos, Entry *p_entry) {
+bool PoolAllocator::find_entry_index(EntryIndicesPos *p_map_pos, const Entry *p_entry) {
EntryArrayPos entry_pos = entry_max;
for (int i = 0; i < entry_count; i++) {
@@ -424,7 +424,7 @@ bool PoolAllocator::is_locked(ID p_mem) const {
}
mt_lock();
- const Entry *e = ((PoolAllocator *)(this))->get_entry(p_mem);
+ const Entry *e = const_cast<PoolAllocator *>(this)->get_entry(p_mem);
if (!e) {
mt_unlock();
ERR_PRINT("!e");
diff --git a/core/os/pool_allocator.h b/core/os/pool_allocator.h
index 0919a024e2..27a936ed78 100644
--- a/core/os/pool_allocator.h
+++ b/core/os/pool_allocator.h
@@ -108,7 +108,7 @@ private:
void compact_up(int p_from = 0);
bool get_free_entry(EntryArrayPos *p_pos);
bool find_hole(EntryArrayPos *p_pos, int p_for_size);
- bool find_entry_index(EntryIndicesPos *p_map_pos, Entry *p_entry);
+ bool find_entry_index(EntryIndicesPos *p_map_pos, const Entry *p_entry);
Entry *get_entry(ID p_mem);
const Entry *get_entry(ID p_mem) const;