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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
|
From: Lars Brinkhoff <lars@nocrew.org>
Date: Tue, 12 Jan 2016 08:43:15 +0100
Subject: Fix most warnings.
Applied-Upstream: commit:914b372d806b525d2b8fa091ee8ebf8c6d29175b
---
base64.c | 4 ++--
htc.c | 1 +
http.c | 12 ++++++------
tunnel.c | 26 +++++++++++++++-----------
4 files changed, 24 insertions(+), 19 deletions(-)
diff --git a/base64.c b/base64.c
index fd37608..f5bcb53 100644
--- a/base64.c
+++ b/base64.c
@@ -41,7 +41,7 @@ encode_base64 (const void *data, size_t length, char **code)
if (length == 0)
return 0;
- end = (char *)data + length - 3;
+ end = (unsigned char *)data + length - 3;
buf = malloc (4 * ((length + 2) / 3) + 1);
if (buf == NULL)
@@ -88,6 +88,6 @@ encode_base64 (const void *data, size_t length, char **code)
*buf = 0;
- *code = buf - n;
+ *code = (char *)buf - n;
return n;
}
diff --git a/htc.c b/htc.c
index 62a0d6c..2fdd301 100644
--- a/htc.c
+++ b/htc.c
@@ -8,6 +8,7 @@ two-way data path tunneled in HTTP requests.
*/
#include <stdio.h>
+#include <time.h>
#include <stdlib.h>
#include <unistd_.h>
#include <signal.h>
diff --git a/http.c b/http.c
index f640f5d..ec153b7 100644
--- a/http.c
+++ b/http.c
@@ -42,7 +42,7 @@ http_method (int fd, Http_destination *dest,
if (length >= 0)
{
- sprintf (str, "%d", length);
+ sprintf (str, "%ld", length);
http_add_header (&request->header, "Content-Length", str);
}
@@ -190,9 +190,9 @@ http_method_to_string (Http_method method)
}
static ssize_t
-read_until (int fd, int ch, unsigned char **data)
+read_until (int fd, int ch, char **data)
{
- unsigned char *buf, *buf2;
+ char *buf, *buf2;
ssize_t n, len, buf_size;
*data = NULL;
@@ -290,7 +290,7 @@ static ssize_t
parse_header (int fd, Http_header **header)
{
unsigned char buf[2];
- unsigned char *data;
+ char *data;
Http_header *h;
size_t len;
ssize_t n;
@@ -461,7 +461,7 @@ ssize_t
http_parse_response (int fd, Http_response **response_)
{
Http_response *response;
- unsigned char *data;
+ char *data;
size_t len;
ssize_t n;
@@ -626,7 +626,7 @@ ssize_t
http_parse_request (int fd, Http_request **request_)
{
Http_request *request;
- unsigned char *data;
+ char *data;
size_t len;
ssize_t n;
diff --git a/tunnel.c b/tunnel.c
index 6e5fc9b..370bfc0 100644
--- a/tunnel.c
+++ b/tunnel.c
@@ -140,7 +140,8 @@ static int
tunnel_in_setsockopts (int fd)
{
#ifdef SO_RCVLOWAT
- int i, n;
+ socklen_t n;
+ int i;
i = 1;
if (setsockopt (fd,
@@ -150,7 +151,7 @@ tunnel_in_setsockopts (int fd)
sizeof i) == -1)
{
log_debug ("tunnel_in_setsockopts: non-fatal SO_RCVLOWAT error: %s",
- strerror (errno));
+ strerror (errno));
}
n = sizeof i;
getsockopt (fd,
@@ -169,7 +170,8 @@ tunnel_out_setsockopts (int fd)
{
#ifdef SO_SNDLOWAT
{
- int i, n;
+ socklen_t n;
+ int i;
i = 1;
if (setsockopt (fd,
@@ -179,8 +181,8 @@ tunnel_out_setsockopts (int fd)
sizeof i) == -1)
{
log_debug ("tunnel_out_setsockopts: "
- "non-fatal SO_SNDLOWAT error: %s",
- strerror (errno));
+ "non-fatal SO_SNDLOWAT error: %s",
+ strerror (errno));
}
n = sizeof i;
getsockopt (fd,
@@ -195,7 +197,7 @@ tunnel_out_setsockopts (int fd)
#ifdef SO_LINGER
{
struct linger l;
- int n;
+ socklen_t n;
l.l_onoff = 1;
l.l_linger = 20 * 100; /* linger for 20 seconds */
@@ -222,7 +224,8 @@ tunnel_out_setsockopts (int fd)
#ifdef TCP_NODELAY
{
int tcp = get_proto_number ("tcp");
- int i, n;
+ socklen_t n;
+ int i;
if (tcp != -1)
{
@@ -274,7 +277,8 @@ tunnel_out_setsockopts (int fd)
#ifdef SO_KEEPALIVE
{
- int i, n;
+ socklen_t n;
+ int i;
i = 1;
if (setsockopt (fd,
@@ -796,7 +800,7 @@ tunnel_close (Tunnel *tunnel)
static int
tunnel_read_request (Tunnel *tunnel, enum tunnel_request *request,
- unsigned char *buf, size_t *length)
+ char *buf, size_t *length)
{
Request req;
Length len;
@@ -1083,7 +1087,7 @@ tunnel_accept (Tunnel *tunnel)
Http_request *request;
struct pollfd p;
ssize_t m;
- int len;
+ socklen_t len;
int n;
int s;
@@ -1171,7 +1175,7 @@ tunnel_accept (Tunnel *tunnel)
/* "Last-Modified: %s\r\n" */
/* "ETag: %s\r\n" */
/* "Accept-Ranges: %s\r\n" */
-"Content-Length: %d\r\n"
+"Content-Length: %lu\r\n"
"Connection: close\r\n"
"Pragma: no-cache\r\n"
"Cache-Control: no-cache, no-store, must-revalidate\r\n"
|