aports/community/drawpile/fix-cast-32-bit.patch

37 lines
1.1 KiB
Diff

Fix -Werror=pointer-to-int-cast error on 32-bit architectures.
```
/home/build/aports/community/drawpile/src/Drawpile-2.2.1/src/drawdance/libcommon/dpcommon/threading_pthread.c:
In function 'DP_thread_current_id':
/home/build/aports/community/drawpile/src/Drawpile-2.2.1/src/drawdance/libcommon/dpcommon/threading_pthread.c:237:12:
error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
237 | return (DP_ThreadId)pthread_self();
| ^
```
--- a/src/drawdance/libcommon/dpcommon/perf.c
+++ b/src/drawdance/libcommon/dpcommon/perf.c
@@ -39,6 +39,9 @@
# include "time.h"
#endif
+// For DP_THREAD_ID_FMT
+#include <inttypes.h>
+
#define INITIAL_CAPACITY 64
#define DETAIL_LENGTH 256
--- a/src/drawdance/libcommon/dpcommon/threading.h
+++ b/src/drawdance/libcommon/dpcommon/threading.h
@@ -36,8 +36,9 @@
typedef void * DP_ThreadId;
# define DP_THREAD_ID_FMT "p"
#else
-typedef unsigned long long DP_ThreadId;
-# define DP_THREAD_ID_FMT "llu"
+#include <inttypes.h>
+typedef uintptr_t DP_ThreadId;
+# define DP_THREAD_ID_FMT PRIxPTR
#endif
typedef struct DP_Mutex DP_Mutex;