Use pointer-sign warning in cmake und fix many of them.
parent
0ec334c887
commit
dfb1db14d7
|
@ -12,7 +12,7 @@ typedef enum {
|
|||
} server_state;
|
||||
|
||||
struct server_socket {
|
||||
guint refcount;
|
||||
gint refcount;
|
||||
server *srv;
|
||||
ev_io watcher;
|
||||
sockaddr_t local_addr;
|
||||
|
|
|
@ -51,7 +51,7 @@ struct filters {
|
|||
};
|
||||
|
||||
struct vrequest_ref {
|
||||
guint refcount;
|
||||
gint refcount;
|
||||
vrequest *vr; /* This is only accesible by the worker thread the vrequest belongs to, and it may be NULL if the vrequest is already reset */
|
||||
};
|
||||
|
||||
|
|
|
@ -336,7 +336,7 @@ ADD_EXECUTABLE(lighttpd
|
|||
SET(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} lighttpd)
|
||||
|
||||
IF(BUILD_EXTRA_WARNINGS)
|
||||
SET(WARN_FLAGS "-g -O2 -g2 -Wall -Wmissing-declarations -Wdeclaration-after-statement -Wno-pointer-sign -Wcast-align -Winline -Wsign-compare -Wnested-externs -Wpointer-arith -Wl,--as-needed")
|
||||
SET(WARN_FLAGS "-g -O2 -g2 -Wall -Wmissing-declarations -Wdeclaration-after-statement -Wcast-align -Winline -Wsign-compare -Wnested-externs -Wpointer-arith -Wl,--as-needed")
|
||||
# -Werror -Wbad-function-cast -Wmissing-prototypes
|
||||
ELSE(BUILD_EXTRA_WARNINGS)
|
||||
SET(WARN_FLAGS "")
|
||||
|
|
10
src/chunk.c
10
src/chunk.c
|
@ -148,7 +148,7 @@ read_chunk:
|
|||
length = we_have;
|
||||
g_byte_array_set_size(c->mem, length);
|
||||
}
|
||||
*data_start = c->mem->data;
|
||||
*data_start = (char*) c->mem->data;
|
||||
*data_len = length;
|
||||
break;
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ handler_t chunkiter_read_mmap(struct vrequest *vr, chunkiter iter, off_t start,
|
|||
*data_len = length;
|
||||
break;
|
||||
case MEM_CHUNK:
|
||||
*data_start = c->mem->data + c->offset + start;
|
||||
*data_start = (char*) c->mem->data + c->offset + start;
|
||||
*data_len = length;
|
||||
break;
|
||||
case FILE_CHUNK:
|
||||
|
@ -612,13 +612,13 @@ goffset chunkqueue_steal_len(chunkqueue *out, chunkqueue *in, goffset length) {
|
|||
case STRING_CHUNK: /* change type to MEM_CHUNK, as we copy it anyway */
|
||||
cnew->type = MEM_CHUNK;
|
||||
cnew->mem = g_byte_array_sized_new(length);
|
||||
g_byte_array_append(cnew->mem, c->str->str + c->offset, length);
|
||||
g_byte_array_append(cnew->mem, (guint8*) c->str->str + c->offset, length);
|
||||
memoutbytes += length;
|
||||
break;
|
||||
case MEM_CHUNK:
|
||||
cnew->type = MEM_CHUNK;
|
||||
cnew->mem = g_byte_array_sized_new(length);
|
||||
g_byte_array_append(cnew->mem, c->mem->data + c->offset, length);
|
||||
g_byte_array_append(cnew->mem, (guint8*) c->mem->data + c->offset, length);
|
||||
memoutbytes += length;
|
||||
break;
|
||||
case FILE_CHUNK:
|
||||
|
@ -801,7 +801,7 @@ gboolean chunkqueue_extract_to_bytearr(vrequest *vr, chunkqueue *cq, goffset len
|
|||
gchar *buf;
|
||||
off_t we_have;
|
||||
if (HANDLER_GO_ON != chunkiter_read(vr, ci, coff, len, &buf, &we_have)) goto error;
|
||||
g_byte_array_append(dest, buf, we_have);
|
||||
g_byte_array_append(dest, (guint8*) buf, we_have);
|
||||
coff += we_have;
|
||||
len -= we_have;
|
||||
if (len <= 0) return TRUE;
|
||||
|
|
|
@ -19,7 +19,7 @@ static void http_chunk_append_len(chunkqueue *cq, size_t len) {
|
|||
a->data[j] = (len & 0xf) + (((len & 0xf) <= 9) ? '0' : 'a' - 10);
|
||||
len >>= 4;
|
||||
}
|
||||
g_byte_array_append(a, CONST_STR_LEN("\r\n"));
|
||||
g_byte_array_append(a, (guint*) CONST_STR_LEN("\r\n"));
|
||||
|
||||
chunkqueue_append_bytearr(cq, a);
|
||||
}
|
||||
|
|
|
@ -207,9 +207,7 @@ static handler_t cache_etag_filter_miss(vrequest *vr, filter *f) {
|
|||
|
||||
static GString* createFileName(vrequest *vr, GString *path, http_header *etagheader) {
|
||||
GString *file = g_string_sized_new(255);
|
||||
gchar* etag_base64 = g_base64_encode(
|
||||
etagheader->data->str + (etagheader->keylen + 2),
|
||||
etagheader->data->len - (etagheader->keylen + 2));
|
||||
gchar* etag_base64 = g_base64_encode((guchar*) HEADER_VALUE_LEN(etagheader));
|
||||
g_string_append_len(file, GSTR_LEN(path));
|
||||
g_string_append_len(file, GSTR_LEN(vr->request.uri.path));
|
||||
g_string_append_len(file, CONST_STR_LEN("-"));
|
||||
|
|
|
@ -209,11 +209,11 @@ static void fastcgi_connection_free(fastcgi_connection *fcon) {
|
|||
static const gchar __padding[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
static void append_padding(GByteArray *a, guint8 padlen) {
|
||||
g_byte_array_append(a, __padding, padlen);
|
||||
g_byte_array_append(a, (guint8*) __padding, padlen);
|
||||
}
|
||||
|
||||
static void l_byte_array_append_c(GByteArray *a, char c) {
|
||||
g_byte_array_append(a, &c, 1);
|
||||
g_byte_array_append(a, (guint8*) &c, 1);
|
||||
}
|
||||
|
||||
/* returns padding length */
|
||||
|
@ -227,9 +227,9 @@ static guint8 stream_build_fcgi_record(GByteArray *buf, guint8 type, guint16 req
|
|||
l_byte_array_append_c(buf, FCGI_VERSION_1);
|
||||
l_byte_array_append_c(buf, type);
|
||||
w = htons(requestid);
|
||||
g_byte_array_append(buf, (const gchar*) &w, sizeof(w));
|
||||
g_byte_array_append(buf, (const guint8*) &w, sizeof(w));
|
||||
w = htons(datalen);
|
||||
g_byte_array_append(buf, (const gchar*) &w, sizeof(w));
|
||||
g_byte_array_append(buf, (const guint8*) &w, sizeof(w));
|
||||
l_byte_array_append_c(buf, padlen);
|
||||
l_byte_array_append_c(buf, 0);
|
||||
return padlen;
|
||||
|
@ -248,7 +248,7 @@ static void stream_send_data(chunkqueue *out, guint8 type, guint16 requestid, co
|
|||
guint16 tosend = (datalen > G_MAXUINT16) ? G_MAXUINT16 : datalen;
|
||||
guint8 padlen = stream_send_fcgi_record(out, type, requestid, tosend);
|
||||
GByteArray *tmpa = g_byte_array_sized_new(tosend + padlen);
|
||||
g_byte_array_append(tmpa, data, tosend);
|
||||
g_byte_array_append(tmpa, (const guint8*) data, tosend);
|
||||
append_padding(tmpa, padlen);
|
||||
chunkqueue_append_bytearr(out, tmpa);
|
||||
data += tosend;
|
||||
|
@ -259,7 +259,7 @@ static void stream_send_data(chunkqueue *out, guint8 type, guint16 requestid, co
|
|||
/* kills the data */
|
||||
static void stream_send_bytearr(chunkqueue *out, guint8 type, guint16 requestid, GByteArray *data) {
|
||||
if (data->len > G_MAXUINT16) {
|
||||
stream_send_data(out, type, requestid, data->data, data->len);
|
||||
stream_send_data(out, type, requestid, (const gchar*) data->data, data->len);
|
||||
g_byte_array_free(data, TRUE);
|
||||
} else {
|
||||
guint8 padlen = stream_send_fcgi_record(out, type, requestid, data->len);
|
||||
|
@ -286,17 +286,17 @@ static gboolean _append_ba_len(GByteArray *a, size_t len) {
|
|||
if (len > G_MAXINT32) return FALSE;
|
||||
if (len > 127) {
|
||||
guint32 i = htonl(len | (1 << 31));
|
||||
g_byte_array_append(a, (const gchar*) &i, sizeof(i));
|
||||
g_byte_array_append(a, (const guint8*) &i, sizeof(i));
|
||||
} else {
|
||||
l_byte_array_append_c(a, (char) len);
|
||||
l_byte_array_append_c(a, (guint8) len);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean append_key_value_pair(GByteArray *a, const gchar *key, size_t keylen, const gchar *val, size_t valuelen) {
|
||||
if (!_append_ba_len(a, keylen) || !_append_ba_len(a, valuelen)) return FALSE;
|
||||
g_byte_array_append(a, key, keylen);
|
||||
g_byte_array_append(a, val, valuelen);
|
||||
g_byte_array_append(a, (const guint8*) key, keylen);
|
||||
g_byte_array_append(a, (const guint8*) val, valuelen);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -308,7 +308,7 @@ static void fastcgi_send_begin(fastcgi_connection *fcon) {
|
|||
|
||||
stream_build_fcgi_record(buf, FCGI_BEGIN_REQUEST, fcon->requestid, 8);
|
||||
w = htons(FCGI_RESPONDER);
|
||||
g_byte_array_append(buf, (const char*) &w, sizeof(w));
|
||||
g_byte_array_append(buf, (const guint8*) &w, sizeof(w));
|
||||
l_byte_array_append_c(buf, 0); /* TODO: FCGI_KEEP_CONN */
|
||||
append_padding(buf, 5);
|
||||
chunkqueue_append_bytearr(fcon->fcgi_out, buf);
|
||||
|
|
Loading…
Reference in New Issue