File: 0001-buffer-fix-gcc15-incompatible-pointer-types.patch

package info (click to toggle)
dq 20250201-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,412 kB
  • sloc: ansic: 13,644; python: 651; makefile: 382; sh: 336
file content (94 lines) | stat: -rw-r--r-- 3,058 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
From 833450ac5bbfa0d59a7b2297fdeee64dd546ae49 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Moj=C5=BE=C3=AD=C5=A1?= <jan.mojzis@gmail.com>
Date: Tue, 18 Feb 2025 18:27:58 +0100
Subject: [PATCH] buffer: fix gcc15 incompatible-pointer-types
Origin: https://github.com/janmojzis/dq/commit/833450ac5bbfa0d59a7b2297fdeee64dd546ae49
Forwarded: not-needed

---
 buffer.c       | 2 +-
 buffer.h       | 6 +++---
 buffer_put.c   | 4 ++--
 buffer_write.c | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/buffer.c b/buffer.c
index 846377a..e37384e 100644
--- a/buffer.c
+++ b/buffer.c
@@ -1,6 +1,6 @@
 #include "buffer.h"
 
-void buffer_init(buffer *s, long long (*op)(), int fd, char *buf, long long len) {
+void buffer_init(buffer *s, long long (*op)(int, char *, long long), int fd, char *buf, long long len) {
 
     s->x  = buf;
     s->fd = fd;
diff --git a/buffer.h b/buffer.h
index a1539ac..3cf7d48 100644
--- a/buffer.h
+++ b/buffer.h
@@ -6,7 +6,7 @@ typedef struct buffer {
     long long p;
     long long n;
     int fd;
-    long long (*op)();
+    long long (*op)(int, char *, long long);
 } buffer;
 
 #define BUFFER_INIT(op, fd, buf, len) { (buf), 0, (len), (fd), (op) }
@@ -14,7 +14,7 @@ typedef struct buffer {
 #define BUFFER_OUTSIZE 8192
 #define BUFFER_ERRSIZE 256
 
-extern void buffer_init(buffer *, long long (*op)(), int, char *, long long);
+extern void buffer_init(buffer *, long long (*op)(int, char *, long long), int, char *, long long);
 
 extern int buffer_flush(buffer *);
 extern int buffer_putalign(buffer *, const char *, long long);
@@ -49,7 +49,7 @@ extern void buffer_seek(buffer *, long long);
 extern int buffer_copy(buffer *,buffer *);
 
 extern long long buffer_unixread(int, char *, long long);
-extern long long buffer_unixwrite(int, const char *, long long);
+extern long long buffer_unixwrite(int, char *, long long);
 
 #define buffer_PEEK(s) ( (s)->x + (s)->n )
 #define buffer_SEEK(s, len) ( ( (s)->p -= (len) ) , ( (s)->n += (len) ) )
diff --git a/buffer_put.c b/buffer_put.c
index 81df976..81badd9 100644
--- a/buffer_put.c
+++ b/buffer_put.c
@@ -3,14 +3,14 @@
 #include "byte.h"
 #include "buffer.h"
 
-static int allwrite(long long (*op)(int, const char *, long long), int fd, const char *buf, long long len) {
+static int allwrite(long long (*op)(int, char *, long long), int fd, const char *buf, long long len) {
 
     long long w;
 
     if (!buf || len < 0) { errno = EINVAL; return -1; }
 
     while (len > 0) {
-        w = op(fd, buf, len);
+        w = op(fd, (char *)buf, len);
         if (w == -1) {
             if (errno == EINTR) continue;
             if (errno == EAGAIN) continue;
diff --git a/buffer_write.c b/buffer_write.c
index bea27b5..98f9db4 100644
--- a/buffer_write.c
+++ b/buffer_write.c
@@ -1,7 +1,7 @@
 #include "writeall.h"
 #include "buffer.h"
 
-long long buffer_unixwrite(int fd, const char *x, long long xlen) {
+long long buffer_unixwrite(int fd, char *x, long long xlen) {
 
     if (writeall(fd, x, xlen) == -1) return -1;
     return xlen;
-- 
2.39.5