mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-04-18 20:16:51 +02:00
71 lines
2.7 KiB
Diff
71 lines
2.7 KiB
Diff
Fix -Wimplicit-function-declaration and -Wincompatible-pointer-type error with
|
|
gcc 14.
|
|
|
|
```
|
|
getopt.c: In function '_getopt_initialize':
|
|
getopt.c:354:54: error: implicit declaration of function 'getpid' [-Wimplicit-function-declaration]
|
|
354 | sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ());
|
|
| ^~~~~~
|
|
getopt.c:359:31: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
|
|
359 | nonoption_flags_len = strlen (nonoption_flags);
|
|
| ^~~~~~
|
|
getopt.c:104:1: note: include '<string.h>' or provide a declaration of 'strlen'
|
|
103 | #include "getopt.h"
|
|
+++ |+#include <string.h>
|
|
```
|
|
|
|
```
|
|
xsane-save.c: In function 'open_socket':
|
|
xsane-save.c:7531:26: error: passing argument 2 of 'connect' from incompatible pointer type [-Wincompatible-pointer-types]
|
|
7531 | if (connect(fd_socket, &sin, sizeof(sin)))
|
|
| ^~~~
|
|
| |
|
|
| struct sockaddr_in *
|
|
In file included from /usr/include/fortify/sys/socket.h:23,
|
|
from xsane-save.c:36:
|
|
/usr/include/sys/socket.h:386:19: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_in *'
|
|
386 | int connect (int, const struct sockaddr *, socklen_t);
|
|
| ^~~~~~~~~~~~~~~~~~~~~~~
|
|
```
|
|
|
|
```
|
|
xsane.c: In function 'xsane_device_dialog':
|
|
xsane.c:4949:5: error: implicit declaration of function 'bind_textdomain_codeset'; did you mean 'bindtextdomain__'? [-Wimplicit-function-declaration]
|
|
4949 | bind_textdomain_codeset(xsane.backend_translation, "UTF-8");
|
|
| ^~~~~~~~~~~~~~~~~~~~~~~
|
|
| bindtextdomain__
|
|
```
|
|
|
|
--- a/lib/getopt.c
|
|
+++ b/lib/getopt.c
|
|
@@ -39,6 +39,8 @@
|
|
#endif
|
|
|
|
#include <stdio.h>
|
|
+#include <string.h> /* for strlen, strcmp */
|
|
+#include <unistd.h> /* for getpid */
|
|
|
|
/* Comment out all this code if we are using the GNU C Library, and are not
|
|
actually compiling the library itself. This code is part of the GNU C
|
|
--- a/src/xsane-save.c
|
|
+++ b/src/xsane-save.c
|
|
@@ -7528,7 +7536,7 @@
|
|
sin.sin_family = AF_INET;
|
|
memcpy(&sin.sin_addr, he->h_addr_list[0], he->h_length);
|
|
|
|
- if (connect(fd_socket, &sin, sizeof(sin)))
|
|
+ if (connect(fd_socket, (struct sockaddr *)&sin, sizeof(sin)))
|
|
{
|
|
DBG(DBG_error, "open_socket: Could not connect with port %d of socket: %s\n", ntohs(sin.sin_port), strerror(errno));
|
|
return -1;
|
|
--- a/src/xsane.c
|
|
+++ b/src/xsane.c
|
|
@@ -50,6 +50,8 @@
|
|
|
|
/* ---------------------------------------------------------------------------------------------------------------------- */
|
|
|
|
+char *bind_textdomain_codeset(const char *, const char *);
|
|
+
|
|
struct option long_options[] =
|
|
{
|
|
{"help", no_argument, 0, 'h'},
|