aports/main/swish-e/gcc15.patch
mio 525ea2482b main/swish-e: fix build with gcc 15
Fix type mismatch errors.

```
sys.h:39:7: warning: conflicting types for built-in function 'strchr'; expected
'char *(const char *, int)' [-Wbuiltin-declaration-mismatch]
   39 | char *strchr(), *strrchr();
      |       ^~~~~~
sys.h:31:1: note: 'strchr' is declared in header '<string.h>'
   30 | #include "acconfig.h"
  +++ |+#include <string.h>
```

```
html.c: In function 'parsetag':
html.c:611:18: error: assignment to 'char * (*)(void)' from incompatible
pointer type 'char * (*)(const char *, const char *)' [-Wincompatible-pointer-types]
  611 |         f_strstr = strstr;
      |                  ^
In file included from /usr/include/fortify/string.h:23,
                 from swish.h:82,
                 from html.c:50:
/usr/include/string.h:51:7: note: 'strstr' declared here
   51 | char *strstr (const char *, const char *);
      |       ^~~~~~
html.c:613:18: error: assignment to 'char * (*)(void)' from incompatible
pointer type 'char * (*)(char *, char *)' [-Wincompatible-pointer-types]
  613 |         f_strstr = lstrstr;
      |                  ^
In file included from html.c:52:
swstring.h:40:7: note: 'lstrstr' declared here
   40 | char *lstrstr (char *, char *);
      |       ^~~~~~~
html.c:672:17: error: too many arguments to function 'f_strstr'; expected 0, have 2
  672 |             if (f_strstr(tag, endtag))
      |                 ^~~~~~~~ ~~~
html.c:707:22: error: too many arguments to function 'f_strstr'; expected 0, have 2
  707 |             else if (f_strstr(tag, begintag))
      |                      ^~~~~~~~ ~~~
```
2025-08-01 03:12:11 +00:00

61 lines
1.7 KiB
Diff

diff -ruN a/src/html.c b/src/html.c
--- a/src/html.c 2009-04-05 01:58:32.000000000 +0000
+++ b/src/html.c 2025-07-31 20:19:39.520000000 +0000
@@ -603,7 +603,7 @@
char *begintag;
char *endtag;
char *newbuf;
- char *(*f_strstr) ();
+ char *(*f_strstr) (const char *, const char *);
diff -ruN a/src/swstring.c b/src/swstring.c
--- a/src/swstring.c 2009-04-05 01:58:32.000000000 +0000
+++ b/src/swstring.c 2025-07-31 20:33:52.860000000 +0000
@@ -66,7 +66,7 @@
/* Case-insensitive strstr(). */
/* Jose Ruiz 02/2001 Faster one */
-char *lstrstr(char *s, char *t)
+char *lstrstr(const char *s, const char *t)
{
int lens;
int lent;
@@ -79,9 +79,9 @@
if (tolower((int) ((unsigned char) *s)) == first)
{
if (lent == 1)
- return s;
+ return (char *) s;
if (strncasecmp(s + 1, t + 1, lent - 1) == 0)
- return s;
+ return (char *) s;
}
}
return NULL;
diff -ruN a/src/swstring.h b/src/swstring.h
--- a/src/swstring.h 2009-04-05 01:58:32.000000000 +0000
+++ b/src/swstring.h 2025-07-31 20:20:03.330000000 +0000
@@ -37,7 +37,7 @@
#define CASE_SENSITIVE_ON 1
#define CASE_SENSITIVE_OFF 0
-char *lstrstr (char *, char *);
+char *lstrstr (const char *, const char *);
char *getconfvalue (char *, char *);
int isoksuffix (char *filename, struct swline *rulelist);
char *replace (char *, char *, char *);
diff -ruN a/src/sys.h b/src/sys.h
--- a/src/sys.h 2009-04-05 01:58:32.000000000 +0000
+++ b/src/sys.h 2025-07-31 19:58:53.320000000 +0000
@@ -29,7 +29,7 @@
#include "acconfig.h"
-#ifdef STDC_HEADERS
+#ifdef HAVE_STRING_H
# include <string.h>
#else
# ifndef HAVE_STRCHR