Debian Codegraph @

thirdparty/vhacd/patches/0002-fpermissive-fix.patch

raw
1 diff --git a/thirdparty/vhacd/inc/btScalar.h b/thirdparty/vhacd/inc/btScalar.h
2 index 404bcbcfe1..db00a3c428 100644
3 --- a/thirdparty/vhacd/inc/btScalar.h
4 +++ b/thirdparty/vhacd/inc/btScalar.h
5 @@ -537,6 +537,27 @@ struct btTypedObject {
6 }
7 };
8
9 +// Cherry-picked from Bullet 2.88 to fix GH-27926
10 +///align a pointer to the provided alignment, upwards
11 +template <typename T>
12 +T *btAlignPointer(T *unalignedPtr, size_t alignment)
13 +{
14 + struct btConvertPointerSizeT
15 + {
16 + union {
17 + T *ptr;
18 + size_t integer;
19 + };
20 + };
21 + btConvertPointerSizeT converter;
22 +
23 + const size_t bit_mask = ~(alignment - 1);
24 + converter.ptr = unalignedPtr;
25 + converter.integer += alignment - 1;
26 + converter.integer &= bit_mask;
27 + return converter.ptr;
28 +}
29 +
30 }; // namespace VHACD
31
32 #endif //BT_SCALAR_H
33 diff --git a/thirdparty/vhacd/src/btAlignedAllocator.cpp b/thirdparty/vhacd/src/btAlignedAllocator.cpp
34 index bbb8baa107..4d7f4b1b2f 100644
35 --- a/thirdparty/vhacd/src/btAlignedAllocator.cpp
36 +++ b/thirdparty/vhacd/src/btAlignedAllocator.cpp
37 @@ -70,8 +70,10 @@ static inline void* btAlignedAllocDefault(size_t size, int32_t alignment)
38
39 real = (char*)sAllocFunc(size + sizeof(void*) + (alignment - 1));
40 if (real) {
41 - offset = (alignment - (unsigned long)(real + sizeof(void*))) & (alignment - 1);
42 - ret = (void*)((real + sizeof(void*)) + offset);
43 + // Synced with Bullet 2.88 to fix GH-27926
44 + //offset = (alignment - (unsigned long)(real + sizeof(void*))) & (alignment - 1);
45 + //ret = (void*)((real + sizeof(void*)) + offset);
46 + ret = btAlignPointer(real + sizeof(void *), alignment);
47 *((void**)(ret)-1) = (void*)(real);
48 }
49 else {