void-packages/srcpkgs/pilot-link/patches/fix-linuxusb_return_types.patch
Đoàn Trần Công Danh 49cb564d14 srcpkgs/p*: convert patches to -Np1
* par is kept at -Np0

```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.-][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.-][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

50 lines
1.7 KiB
Diff

--- a/libpisock/linuxusb.c 2006-10-12 16:21:22.000000000 +0200
+++ b/libpisock/linuxusb.c 2016-12-20 14:17:56.216661746 +0100
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/socket.h>
#include "pi-debug.h"
#include "pi-source.h"
@@ -48,8 +48,8 @@
static int u_open(pi_socket_t *ps, struct pi_sockaddr *addr, size_t addrlen);
static int u_close(pi_socket_t *ps);
-static int u_write(pi_socket_t *ps, unsigned char *buf, size_t len, int flags);
-static int u_read(pi_socket_t *ps, pi_buffer_t *buf, size_t len, int flags);
+static ssize_t u_write(pi_socket_t *ps, PI_CONST unsigned char *buf, size_t len, int flags);
+static ssize_t u_read(pi_socket_t *ps, pi_buffer_t *buf, size_t len, int flags);
static int u_poll(pi_socket_t *ps, int timeout);
static int u_flush(pi_socket_t *ps, int flags);
@@ -188,7 +188,7 @@
* Returns: Nothing
*
***********************************************************************/
-static int
-u_write(pi_socket_t *ps, unsigned char *buf, size_t len, int flags)
+static ssize_t
+u_write(pi_socket_t *ps, PI_CONST unsigned char *buf, size_t len, int flags)
{
int total,
@@ -243,7 +243,7 @@
* Returns: number of bytes read
*
***********************************************************************/
-static int
+static ssize_t
u_read_buf (pi_socket_t *ps, pi_buffer_t *buf, size_t len, int flags)
{
struct pi_usb_data *data = (struct pi_usb_data *)ps->device->data;
@@ -281,7 +281,7 @@
* Returns: number of bytes read or negative otherwise
*
***********************************************************************/
-static int
+static ssize_t
u_read(pi_socket_t *ps, pi_buffer_t *buf, size_t len, int flags)
{
ssize_t rbuf = 0,