summaryrefslogtreecommitdiff
path: root/devel/libscsi/patches/patch-ac
blob: 15201ecbf6950a6edeea4b2822ed7a28319a1e39 (plain)
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
$NetBSD: patch-ac,v 1.2 1998/08/07 10:40:25 agc Exp $

--- scsi.c.orig	Sat Jun 20 02:30:03 1998
+++ scsi.c	Sat Jun 20 03:00:07 1998
@@ -353,2 +353,11 @@
 
+static int wrap_do_buff_decode(u_char *databuf, size_t len,
+void (*arg_put)(void *, int , void *, int, char *), void *puthook,
+char *fmt, ...)
+{
+	va_list ap;
+	va_start(ap,fmt);
+	return do_buff_decode(databuf,len,arg_put,puthook,fmt,ap);
+}
+
 int scsireq_decode(scsireq_t *scsireq, char *fmt, ...)
@@ -364,5 +373,4 @@
 {
-	va_list ap = (va_list)0;
-	return do_buff_decode(scsireq->databuf, (size_t)scsireq->datalen,
-	 arg_put, puthook, fmt, ap);
+	return wrap_do_buff_decode(scsireq->databuf, (size_t)scsireq->datalen,
+	 arg_put, puthook, fmt);
 }
@@ -379,4 +387,3 @@
 {
-	va_list ap = (va_list)0;
-	return do_buff_decode(buff, len, arg_put, puthook, fmt, ap);
+	return wrap_do_buff_decode(buff, len, arg_put, puthook, fmt);
 }
@@ -752,2 +759,10 @@
 
+static int wrap_do_encode(u_char *buff, size_t vec_max, size_t *used,
+int (*arg_get)(void *, char *), void *gethook, char *fmt, ...)
+{
+	va_list ap;
+	va_start(ap,fmt);
+	return do_encode(buff,vec_max,used,arg_get,gethook,fmt,ap);
+}
+
 /* XXX: Should be a constant in scsiio.h
@@ -760,3 +775,3 @@
 {
-	int cmdlen;
+	size_t cmdlen;
 	va_list ap;
@@ -800,4 +815,3 @@
 {
-	int cmdlen;
-	va_list ap = (va_list) 0;
+	size_t cmdlen;
 
@@ -826,4 +840,4 @@
 
- 	if (do_encode(scsireq->cmd, CMD_BUFLEN, &cmdlen, arg_get, gethook,
-	cmd_spec, ap) == -1)
+ 	if (wrap_do_encode(scsireq->cmd, CMD_BUFLEN, &cmdlen, arg_get, gethook,
+	cmd_spec) == -1)
  		return 0;
@@ -851,5 +865,4 @@
 {
-	va_list ap = (va_list)0;
-	return do_encode(buff, len, 0,
-	arg_get, gethook, fmt, ap);
+	return wrap_do_encode(buff, len, 0,
+	arg_get, gethook, fmt);
 }
@@ -859,5 +872,4 @@
 {
-	va_list ap = (va_list)0;
-	return do_encode(scsireq->databuf, scsireq->datalen, 0,
-	arg_get, gethook, fmt, ap);
+	return wrap_do_encode(scsireq->databuf, scsireq->datalen, 0,
+	arg_get, gethook, fmt);
 }