|
@@ -1981,8 +1981,8 @@ mg_fopen(const struct mg_connection *conn,
|
|
|
* some fields like size and modification date with values */
|
|
|
found = mg_stat(conn, path, &(filep->stat));
|
|
|
|
|
|
- /* TODO: if found=false, only call fopen if the file should
|
|
|
- * be created. If it should only be read, fail early. */
|
|
|
+/* TODO: if found=false, only call fopen if the file should
|
|
|
+ * be created. If it should only be read, fail early. */
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
{
|
|
@@ -2004,7 +2004,7 @@ mg_fopen(const struct mg_connection *conn,
|
|
|
}
|
|
|
|
|
|
/* file is on disk */
|
|
|
- return (filep->access.fp != NULL);
|
|
|
+ return (filep->access.fp != NULL);
|
|
|
|
|
|
} else {
|
|
|
if (open_file_in_memory(conn, path, filep)) {
|
|
@@ -9775,7 +9775,8 @@ handle_websocket_request(struct mg_connection *conn,
|
|
|
/* Step 2.1 check and select subprotocol */
|
|
|
const char *protocol = mg_get_header(conn, "Sec-WebSocket-Protocol");
|
|
|
if (protocol && subprotocols) {
|
|
|
- int len, idx;
|
|
|
+ int idx;
|
|
|
+ unsigned long len;
|
|
|
const char *sep, *curSubProtocol,
|
|
|
*acceptedWebSocketSubprotocol = NULL;
|
|
|
|
|
@@ -9784,15 +9785,15 @@ handle_websocket_request(struct mg_connection *conn,
|
|
|
do {
|
|
|
sep = strchr(protocol, ',');
|
|
|
curSubProtocol = protocol;
|
|
|
- len = sep ? (int)(sep - protocol) : strlen(protocol);
|
|
|
+ len = sep ? (unsigned long)(sep - protocol) : strlen(protocol);
|
|
|
protocol = sep ? sep + 1 : NULL;
|
|
|
|
|
|
|
|
|
for (idx = 0; idx < subprotocols->nb_subprotocols; idx++) {
|
|
|
- if (strlen(subprotocols->subprotocols[idx]) == len
|
|
|
- && strncmp(curSubProtocol,
|
|
|
- subprotocols->subprotocols[idx],
|
|
|
- len) == 0) {
|
|
|
+ if ((strlen(subprotocols->subprotocols[idx]) == len)
|
|
|
+ && (strncmp(curSubProtocol,
|
|
|
+ subprotocols->subprotocols[idx],
|
|
|
+ len) == 0)) {
|
|
|
acceptedWebSocketSubprotocol =
|
|
|
subprotocols->subprotocols[idx];
|
|
|
break;
|