Debian Codegraph @

debian/patches/0001-c-types-be.patch

raw
1 From d4e0572418e51f03cf0611f260be03c80c497ff5 Mon Sep 17 00:00:00 2001
2 From: Yuri Konotopov <[email protected]>
3 Date: Fri, 28 Aug 2026 07:50:09 +0000
4 Subject: [PATCH 1/5] Fixed C types handling on big endian platforms
5
6 Signed-off-by: Yuri Konotopov <[email protected]>
7
8 Forwarded: https://github.com/mosquito/caio/pull/76
9 ---
10 caio/linux_aio.c | 13 ++++++++-----
11 caio/thread_aio.c | 13 +++++++------
12 2 files changed, 15 insertions(+), 11 deletions(-)
13
14 diff --git a/caio/linux_aio.c b/caio/linux_aio.c
15 index 5f7911b..f610d83 100644
16 --- a/caio/linux_aio.c
17 +++ b/caio/linux_aio.c
18 @@ -257,8 +257,9 @@ static PyObject* AIOContext_repr(AIOContext *self) {
19 return NULL;
20 }
21 return PyUnicode_FromFormat(
22 - "<%s as %p: max_requests=%i, ctx=%lli>",
23 - Py_TYPE(self)->tp_name, self, self->max_requests, self->ctx
24 + "<%s as %p: max_requests=%u, ctx=%llu>",
25 + Py_TYPE(self)->tp_name, self, self->max_requests,
26 + (unsigned long long) self->ctx
27 );
28 }
29
30 @@ -628,7 +629,7 @@ static PyMemberDef AIOContext_members[] = {
31 },
32 {
33 "max_requests",
34 - T_USHORT,
35 + T_UINT,
36 offsetof(AIOContext, max_requests),
37 READONLY,
38 "max requests"
39 @@ -744,9 +745,11 @@ static PyObject* AIOOperation_repr(AIOOperation *self) {
40 }
41
42 return PyUnicode_FromFormat(
43 - "<%s at %p: mode=\"%s\", fd=%i, offset=%i, buffer=%p>",
44 + "<%s at %p: mode=\"%s\", fd=%u, offset=%lld, buffer=%p>",
45 Py_TYPE(self)->tp_name, self, mode,
46 - self->iocb.aio_fildes, self->iocb.aio_offset, self->iocb.aio_buf
47 + self->iocb.aio_fildes,
48 + (long long) self->iocb.aio_offset,
49 + (void *)(uintptr_t) self->iocb.aio_buf
50 );
51 }
52
53 diff --git a/caio/thread_aio.c b/caio/thread_aio.c
54 index 1e47338..3666c96 100644
55 --- a/caio/thread_aio.c
56 +++ b/caio/thread_aio.c
57 @@ -47,7 +47,7 @@ typedef struct {
58 PyObject_HEAD
59 threadpool_t* pool;
60 uint16_t max_requests;
61 - uint8_t pool_size;
62 + uint16_t pool_size;
63 PyObject* weakreflist;
64 } AIOContext;
65
66 @@ -153,6 +153,7 @@ AIOContext_init(AIOContext *self, PyObject *args, PyObject *kwds)
67
68 self->pool = NULL;
69 self->max_requests = 0;
70 + self->pool_size = 0;
71
72 if (!PyArg_ParseTupleAndKeywords(
73 args, kwds, "|HH", kwlist,
74 @@ -205,9 +206,9 @@ static PyObject* AIOContext_repr(AIOContext *self) {
75 return NULL;
76 }
77 return PyUnicode_FromFormat(
78 - "<%s as %p: max_requests=%i, pool_size=%i, ctx=%lli>",
79 + "<%s as %p: max_requests=%u, pool_size=%u, ctx=%p>",
80 Py_TYPE(self)->tp_name, self, self->max_requests,
81 - self->pool_size, self->pool
82 + self->pool_size, (void *) self->pool
83 );
84 }
85
86 @@ -456,7 +457,7 @@ static PyObject* AIOContext_close(
87 static PyMemberDef AIOContext_members[] = {
88 {
89 "pool_size",
90 - T_INT,
91 + T_USHORT,
92 offsetof(AIOContext, pool_size),
93 READONLY,
94 "pool_size"
95 @@ -581,9 +582,9 @@ static PyObject* AIOOperation_repr(AIOOperation *self) {
96 }
97
98 return PyUnicode_FromFormat(
99 - "<%s at %p: mode=\"%s\", fd=%i, offset=%i, result=%i, buffer=%p>",
100 + "<%s at %p: mode=\"%s\", fd=%u, offset=%lld, result=%d, buffer=%p>",
101 Py_TYPE(self)->tp_name, self, mode,
102 - self->fileno, self->offset, self->result, self->buf
103 + self->fileno, (long long) self->offset, self->result, self->buf
104 );
105 }
106
107 --
108 2.55.0
109