mbed3 align to recent changes
Signed-off-by: Andy Green <andy.green@linaro.org>
diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c
index ac502b2..2ac1762 100644
--- a/lib/libwebsockets.c
+++ b/lib/libwebsockets.c
@@ -786,7 +786,6 @@
return 0;
}
-#if LWS_POSIX
LWS_VISIBLE void lwsl_emit_stderr(int level, const char *line)
{
unsigned long long now;
@@ -806,7 +805,6 @@
fprintf(stderr, "%s%s", buf, line);
}
-#endif
LWS_VISIBLE void _lws_logv(int filter, const char *format, va_list vl)
{
diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h
index 195309f..bfc28e3 100644
--- a/lib/libwebsockets.h
+++ b/lib/libwebsockets.h
@@ -185,14 +185,15 @@
#else /* NOT WIN32 */
#include <unistd.h>
-#define LWS_INVALID_FILE -1
#define LWS_O_RDONLY O_RDONLY
#ifndef MBED_OPERATORS
#include <poll.h>
#include <netdb.h>
+#define LWS_INVALID_FILE -1
#else
#define getdtablesize() (20)
+#define LWS_INVALID_FILE NULL
#endif
#if defined(__GNUC__)
@@ -1362,23 +1363,23 @@
unsigned char *end);
LWS_VISIBLE LWS_EXTERN int
lws_finalize_http_header(struct lws_context *context,
- struct lws *wsi,
- unsigned char **p,
- unsigned char *end);
+ struct lws *wsi,
+ unsigned char **p,
+ unsigned char *end);
LWS_VISIBLE LWS_EXTERN int
lws_add_http_header_by_token(struct lws_context *context,
- struct lws *wsi,
- enum lws_token_indexes token,
- const unsigned char *value,
- int length,
- unsigned char **p,
- unsigned char *end);
+ struct lws *wsi,
+ enum lws_token_indexes token,
+ const unsigned char *value,
+ int length,
+ unsigned char **p,
+ unsigned char *end);
LWS_VISIBLE LWS_EXTERN int
lws_add_http_header_content_length(struct lws_context *context,
- struct lws *wsi,
- unsigned long content_length,
- unsigned char **p,
- unsigned char *end);
+ struct lws *wsi,
+ unsigned long content_length,
+ unsigned char **p,
+ unsigned char *end);
LWS_VISIBLE LWS_EXTERN int
lws_add_http_header_status(struct lws_context *context, struct lws *wsi,
unsigned int code, unsigned char **p,
diff --git a/lib/lws-plat-mbed3.c b/lib/lws-plat-mbed3.c
index 64a17cb..6d00fea 100644
--- a/lib/lws-plat-mbed3.c
+++ b/lib/lws-plat-mbed3.c
@@ -12,12 +12,13 @@
return 0;
}
-LWS_VISIBLE int lws_get_random(struct lws_context *context,
- void *buf, int len)
+LWS_VISIBLE int lws_get_random(struct lws_context *context, void *buf, int len)
{
- (void)context;
int n = len;
unsigned char *b = (unsigned char *)buf;
+
+ (void)context;
+
while (n--)
b[n]= rand();
return len;
@@ -166,7 +167,7 @@
(void)filename;
(void)filelen;
(void)flags;
- return -1;
+ return NULL;
}
static int
@@ -180,7 +181,7 @@
unsigned long
_lws_plat_file_seek_cur(struct lws *wsi, lws_filefd_type fd, long offset)
{
- (void)wsi
+ (void)wsi;
(void)fd;
(void)offset;
@@ -189,7 +190,7 @@
static int
_lws_plat_file_read(struct lws *wsi, lws_filefd_type fd, unsigned long *amount,
- unsigned char* buf, unsigned long* len)
+ unsigned char *buf, unsigned long len)
{
(void)wsi;
(void)amount;
@@ -202,7 +203,7 @@
static int
_lws_plat_file_write(struct lws *wsi, lws_filefd_type fd, unsigned long *amount,
- unsigned char* buf, unsigned long len)
+ unsigned char *buf, unsigned long len)
{
(void)wsi;
(void)amount;
@@ -217,6 +218,8 @@
lws_plat_init(struct lws_context *context,
struct lws_context_creation_info *info)
{
+ (void)info;
+
context->fops.open = _lws_plat_file_open;
context->fops.close = _lws_plat_file_close;
context->fops.seek_cur = _lws_plat_file_seek_cur;
diff --git a/lib/lws-plat-mbed3.cpp b/lib/lws-plat-mbed3.cpp
index 826cb71..70a76e0 100644
--- a/lib/lws-plat-mbed3.cpp
+++ b/lib/lws-plat-mbed3.cpp
@@ -216,7 +216,7 @@
}
extern "C" LWS_VISIBLE struct lws *
-wsi_from_fd(struct lws_context *context, lws_sockfd_type fd)
+wsi_from_fd(const struct lws_context *context, lws_sockfd_type fd)
{
lws_conn *conn = (lws_conn *)fd;
(void)context;
diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h
index 8e53c1c..f6f0f26 100644
--- a/lib/private-libwebsockets.h
+++ b/lib/private-libwebsockets.h
@@ -950,7 +950,7 @@
#if defined(_WIN32) || defined(MBED_OPERATORS)
LWS_EXTERN struct lws *
-wsi_from_fd(struct lws_context *context, lws_sockfd_type fd);
+wsi_from_fd(const struct lws_context *context, lws_sockfd_type fd);
LWS_EXTERN int
insert_wsi(struct lws_context *context, struct lws *wsi);