projects/aports·blob master · refs

219 lines · 7.0 KiB

1Patch-Source: https://rt.cpan.org/Public/Bug/Display.html?id=158680
2---
3Fix building with GCC 15
4
5GCC 15 defaults to ISO C23 which changed a meaning of an empty argument list
6from unspecified arguments to no arguments.
7
8This patch fixes that and also warnings about deprecated K&R syntax.
9
10CPAN RT#158680
11https://bugzilla.redhat.com/show_bug.cgi?id=2341029
12
13--- a/Digest/global.h
14+++ b/Digest/global.h
15@@ -3,11 +3,11 @@
16
17 /* PROTOTYPES should be set to one if and only if the compiler supports
18 function argument prototyping.
19-The following makes PROTOTYPES default to 0 if it has not already
20+The following makes PROTOTYPES default to 1 if it has not already
21 been defined with C compiler flags.
22 */
23 #ifndef PROTOTYPES
24-#define PROTOTYPES 0
25+#define PROTOTYPES 1
26 #endif
27
28 /* POINTER defines a generic pointer type */
29--- a/Digest/md4c.c
30+++ b/Digest/md4c.c
31@@ -81,8 +81,7 @@ static unsigned char PADDING[64] = {
32
33 /* MD4 initialization. Begins an MD4 operation, writing a new context.
34 */
35-void RsyncMD4Init (context)
36-RsyncMD4_CTX *context; /* context */
37+void RsyncMD4Init (RsyncMD4_CTX *context)
38 {
39 context->count[0] = context->count[1] = 0;
40
41@@ -99,10 +98,7 @@ RsyncMD4_CTX *context;
42 operation, processing another message block, and updating the
43 context.
44 */
45-void RsyncMD4Update (context, input, inputLen)
46-RsyncMD4_CTX *context; /* context */
47-unsigned char *input; /* input block */
48-unsigned int inputLen; /* length of input block */
49+void RsyncMD4Update (RsyncMD4_CTX *context, unsigned char *input, unsigned int inputLen)
50 {
51 unsigned int i, index, partLen;
52
53@@ -140,9 +136,7 @@ unsigned int inputLen;
54 /* MD4 finalization. Ends an MD4 message-digest operation, writing the
55 the message digest and zeroizing the context.
56 */
57-void RsyncMD4Final (digest, context)
58-unsigned char digest[16]; /* message digest */
59-RsyncMD4_CTX *context; /* context */
60+void RsyncMD4Final (unsigned char digest[16], RsyncMD4_CTX *context)
61 {
62 unsigned char bits[8];
63 unsigned int index, padLen;
64@@ -179,9 +173,7 @@ RsyncMD4_CTX *context;
65 * If context->rsyncMD4Bug is clear we correctly implement md4 (rsync
66 * protocol >= 27).
67 */
68-void RsyncMD4FinalRsync (digest, context)
69-unsigned char digest[16]; /* message digest */
70-RsyncMD4_CTX *context; /* context */
71+void RsyncMD4FinalRsync (unsigned char digest[16], RsyncMD4_CTX *context)
72 {
73 unsigned char bits[8];
74 unsigned int index, padLen;
75@@ -212,9 +204,7 @@ RsyncMD4_CTX *context;
76
77 /* MD4 basic transformation. Transforms state based on block.
78 */
79-static void RsyncMD4Transform (state, block)
80-UINT4 state[4];
81-unsigned char block[64];
82+static void RsyncMD4Transform (UINT4 state[4], unsigned char block[64])
83 {
84 UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
85
86@@ -287,10 +277,7 @@ unsigned char block[64];
87 /* Encodes input (UINT4) into output (unsigned char). Assumes len is
88 a multiple of 4.
89 */
90-void RsyncMD4Encode (output, input, len)
91-unsigned char *output;
92-UINT4 *input;
93-unsigned int len;
94+void RsyncMD4Encode (unsigned char *output, UINT4 *input, unsigned int len)
95 {
96 unsigned int i, j;
97
98@@ -305,11 +292,7 @@ unsigned int len;
99 /* Decodes input (unsigned char) into output (UINT4). Assumes len is
100 a multiple of 4.
101 */
102-void RsyncMD4Decode (output, input, len)
103-
104-UINT4 *output;
105-unsigned char *input;
106-unsigned int len;
107+void RsyncMD4Decode (UINT4 *output, unsigned char *input, unsigned int len)
108 {
109 unsigned int i, j;
110
111@@ -320,10 +303,7 @@ unsigned int len;
112
113 /* Note: Replace "for loop" with standard memcpy if possible.
114 */
115-static void RsyncMD4_memcpy (output, input, len)
116-POINTER output;
117-POINTER input;
118-unsigned int len;
119+static void RsyncMD4_memcpy (POINTER output, POINTER input, unsigned int len)
120 {
121 unsigned int i;
122
123@@ -333,10 +313,7 @@ unsigned int len;
124
125 /* Note: Replace "for loop" with standard memset if possible.
126 */
127-static void RsyncMD4_memset (output, value, len)
128-POINTER output;
129-int value;
130-unsigned int len;
131+static void RsyncMD4_memset (POINTER output, int value, unsigned int len)
132 {
133 unsigned int i;
134
135--- a/FileList/flist.c
136+++ b/FileList/flist.c
137@@ -861,7 +861,7 @@ void clean_flist(struct file_list *flist
138 return;
139
140 qsort(flist->files, flist->count,
141- sizeof flist->files[0], (int (*)())file_compare);
142+ sizeof flist->files[0], (int (*)(const void*, const void *))file_compare);
143
144 for (i = no_dups? 0 : flist->count; i < flist->count; i++) {
145 if (flist->files[i]->basename) {
146@@ -1166,7 +1166,7 @@ char *sanitize_path(char *dest, const ch
147 return dest;
148 }
149
150-void out_of_memory(char *str)
151+void out_of_memory(const char *str)
152 {
153 fprintf(stderr, "ERROR: File::RsyncP out of memory in %s\n", str);
154 exit(1);
155--- a/FileList/hlink.c
156+++ b/FileList/hlink.c
157@@ -127,7 +127,7 @@ void init_hard_links(struct file_list *f
158 }
159
160 qsort(hlink_list, hlink_count,
161- sizeof hlink_list[0], (int (*)()) hlink_compare);
162+ sizeof hlink_list[0], (int (*)(const void *, const void *)) hlink_compare);
163
164 if (!hlink_count) {
165 free(hlink_list);
166--- a/FileList/pool_alloc.c
167+++ b/FileList/pool_alloc.c
168@@ -9,7 +9,7 @@ struct alloc_pool
169 struct pool_extent *live; /* current extent for
170 * allocations */
171 struct pool_extent *free; /* unfreed extent list */
172- void (*bomb)();
173+ void (*bomb)(const char *);
174 /* function to call if
175 * malloc fails */
176 int flags;
177@@ -45,7 +45,7 @@ struct align_test {
178
179 alloc_pool_t
180 pool_create(size_t size, size_t quantum,
181- void (*bomb)(char *), int flags)
182+ void (*bomb)(const char *), int flags)
183 {
184 struct alloc_pool *pool;
185
186@@ -95,7 +95,7 @@ pool_destroy(alloc_pool_t p)
187 }
188
189 void *
190-pool_alloc(alloc_pool_t p, size_t len, char *bomb)
191+pool_alloc(alloc_pool_t p, size_t len, const char *bomb)
192 {
193 struct alloc_pool *pool = (struct alloc_pool *) p;
194 if (!pool)
195--- a/FileList/pool_alloc.h
196+++ b/FileList/pool_alloc.h
197@@ -7,9 +7,9 @@
198
199 typedef void *alloc_pool_t;
200
201-alloc_pool_t pool_create(size_t size, size_t quantum, void (*bomb)(char *), int flags);
202+alloc_pool_t pool_create(size_t size, size_t quantum, void (*bomb)(const char *), int flags);
203 void pool_destroy(alloc_pool_t pool);
204-void *pool_alloc(alloc_pool_t pool, size_t size, char *bomb);
205+void *pool_alloc(alloc_pool_t pool, size_t size, const char *bomb);
206 void pool_free(alloc_pool_t pool, size_t size, void *addr);
207
208 #define pool_talloc(pool, type, count, bomb) \
209--- a/FileList/proto.h
210+++ b/FileList/proto.h
211@@ -229,7 +229,7 @@ void set_nonblocking(int fd);
212 void set_blocking(int fd);
213 int fd_pair(int fd[2]);
214 void print_child_argv(char **cmd);
215-void out_of_memory(char *str);
216+void out_of_memory(const char *str);
217 void overflow(char *str);
218 int set_modtime(char *fname, time_t modtime);
219 int create_directory_path(char *fname, int base_umask);