summaryrefslogtreecommitdiff
path: root/src/supplemental
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-12-27 17:36:24 -0800
committerGarrett D'Amore <garrett@damore.org>2017-12-27 17:36:24 -0800
commit1fc48dc4a67503c65a040606bc00a4cac7210f13 (patch)
tree4ea220a46b4223d75bd08405df354ff5b368018c /src/supplemental
parent5ff3d3d3ab82be4b2171e06f1def9cdddaef4115 (diff)
downloadnng-1fc48dc4a67503c65a040606bc00a4cac7210f13.tar.gz
nng-1fc48dc4a67503c65a040606bc00a4cac7210f13.tar.bz2
nng-1fc48dc4a67503c65a040606bc00a4cac7210f13.zip
Compilation fixes for Windows.
Diffstat (limited to 'src/supplemental')
-rw-r--r--src/supplemental/http/http_msg.c15
-rw-r--r--src/supplemental/http/server.c5
-rw-r--r--src/supplemental/websocket/websocket.c11
3 files changed, 14 insertions, 17 deletions
diff --git a/src/supplemental/http/http_msg.c b/src/supplemental/http/http_msg.c
index 8b3c6a7c..ff931240 100644
--- a/src/supplemental/http/http_msg.c
+++ b/src/supplemental/http/http_msg.c
@@ -145,7 +145,7 @@ http_del_header(nni_list *hdrs, const char *key)
{
http_header *h;
NNI_LIST_FOREACH (hdrs, h) {
- if (strcasecmp(key, h->name) == 0) {
+ if (nni_strcasecmp(key, h->name) == 0) {
nni_list_remove(hdrs, h);
nni_strfree(h->name);
nni_free(h->value, strlen(h->value) + 1);
@@ -173,7 +173,7 @@ http_set_header(nni_list *hdrs, const char *key, const char *val)
{
http_header *h;
NNI_LIST_FOREACH (hdrs, h) {
- if (strcasecmp(key, h->name) == 0) {
+ if (nni_strcasecmp(key, h->name) == 0) {
char * news;
size_t len = strlen(val) + 1;
if ((news = nni_alloc(len)) == NULL) {
@@ -220,7 +220,7 @@ http_add_header(nni_list *hdrs, const char *key, const char *val)
{
http_header *h;
NNI_LIST_FOREACH (hdrs, h) {
- if (strcasecmp(key, h->name) == 0) {
+ if (nni_strcasecmp(key, h->name) == 0) {
char * news;
size_t len = strlen(h->value) + strlen(val) + 3;
if ((news = nni_alloc(len)) == NULL) {
@@ -267,7 +267,7 @@ http_get_header(nni_list *hdrs, const char *key)
{
http_header *h;
NNI_LIST_FOREACH (hdrs, h) {
- if (strcasecmp(h->name, key) == 0) {
+ if (nni_strcasecmp(h->name, key) == 0) {
return (h->value);
}
}
@@ -407,10 +407,9 @@ nni_http_res_alloc_data(nni_http_res *res, size_t size)
static int
http_parse_header(nni_list *hdrs, void *line)
{
- http_header *h;
- char * key = line;
- char * val;
- char * end;
+ char *key = line;
+ char *val;
+ char *end;
// Find separation between key and value
if ((val = strchr(key, ':')) == NULL) {
diff --git a/src/supplemental/http/server.c b/src/supplemental/http/server.c
index 0a132975..4a46bf44 100644
--- a/src/supplemental/http/server.c
+++ b/src/supplemental/http/server.c
@@ -289,7 +289,6 @@ http_sconn_rxdone(void *arg)
char * uri;
size_t urisz;
char * path;
- char * tmp;
bool badmeth = false;
if ((rv = nni_aio_result(aio)) != 0) {
@@ -819,7 +818,7 @@ http_server_add_handler(void **hp, nni_http_server *s, nni_http_handler *hh,
// matches.) Note that a wild card host matches both.
NNI_LIST_FOREACH (&s->handlers, h2) {
if ((h2->h_host != NULL) && (h->h_host != NULL) &&
- (strcasecmp(h2->h_host, h->h_host) != 0)) {
+ (nni_strcasecmp(h2->h_host, h->h_host) != 0)) {
// Hosts don't match, so we are safe.
continue;
}
@@ -916,7 +915,7 @@ http_lookup_type(const char *path)
if (l2 > l1) {
continue;
}
- if (strcasecmp(&path[l1 - l2], content_map[i].ext) == 0) {
+ if (nni_strcasecmp(&path[l1 - l2], content_map[i].ext) == 0) {
return (content_map[i].typ);
}
}
diff --git a/src/supplemental/websocket/websocket.c b/src/supplemental/websocket/websocket.c
index 53e4af8c..06e1c70a 100644
--- a/src/supplemental/websocket/websocket.c
+++ b/src/supplemental/websocket/websocket.c
@@ -237,7 +237,7 @@ ws_mask_frame(ws_frame *frame)
}
r = nni_random();
NNI_PUT32(frame->mask, r);
- for (int i = 0; i < frame->len; i++) {
+ for (size_t i = 0; i < frame->len; i++) {
frame->buf[i] ^= frame->mask[i % 4];
}
memcpy(frame->head + frame->hlen, frame->mask, 4);
@@ -253,7 +253,7 @@ ws_unmask_frame(ws_frame *frame)
if (!frame->masked) {
return;
}
- for (int i = 0; i < frame->len; i++) {
+ for (size_t i = 0; i < frame->len; i++) {
frame->buf[i] ^= frame->mask[i % 4];
}
frame->hlen -= 4;
@@ -1651,8 +1651,7 @@ nni_ws_listener_accept(nni_ws_listener *l, nni_aio *aio)
void
nni_ws_listener_close(nni_ws_listener *l)
{
- nni_aio *aio;
- nni_ws * ws;
+ nni_ws *ws;
nni_mtx_lock(&l->mtx);
if (l->closed) {
nni_mtx_unlock(&l->mtx);
@@ -2012,7 +2011,7 @@ ws_set_header(nni_list *l, const char *n, const char *v)
}
NNI_LIST_FOREACH (l, hdr) {
- if (strcasecmp(hdr->name, n) == 0) {
+ if (nni_strcasecmp(hdr->name, n) == 0) {
nni_strfree(hdr->value);
hdr->value = nv;
return (0);
@@ -2023,7 +2022,7 @@ ws_set_header(nni_list *l, const char *n, const char *v)
nni_strfree(nv);
return (NNG_ENOMEM);
}
- if ((hdr->name = strdup(n)) == NULL) {
+ if ((hdr->name = nni_strdup(n)) == NULL) {
nni_strfree(nv);
NNI_FREE_STRUCT(hdr);
return (NNG_ENOMEM);