1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

semmle: fix warnings

They're all cosmetic or minor js stuff.

Add related shield.io icons to README.
This commit is contained in:
Andy Green 2019-09-19 10:15:56 +01:00
parent f9f6bb66fe
commit 6a6f365ce7
26 changed files with 43 additions and 42 deletions

View file

@ -1,4 +1,4 @@
[![Travis Build Status](https://travis-ci.org/warmcat/libwebsockets.svg)](https://travis-ci.org/warmcat/libwebsockets) [![Appveyor Build status](https://ci.appveyor.com/api/projects/status/qfasji8mnfnd2r8t?svg=true)](https://ci.appveyor.com/project/lws-team/libwebsockets) [![Coverity Scan Build Status](https://scan.coverity.com/projects/3576/badge.svg)](https://scan.coverity.com/projects/3576) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2266/badge)](https://bestpractices.coreinfrastructure.org/projects/2266) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/144fb195a83046e484a75c8b4c6cfc99)](https://www.codacy.com/app/lws-team/libwebsockets?utm_source=github.com&utm_medium=referral&utm_content=warmcat/libwebsockets&utm_campaign=Badge_Grade)
[![Travis Build Status](https://travis-ci.org/warmcat/libwebsockets.svg)](https://travis-ci.org/warmcat/libwebsockets) [![Appveyor Build status](https://ci.appveyor.com/api/projects/status/qfasji8mnfnd2r8t?svg=true)](https://ci.appveyor.com/project/lws-team/libwebsockets) [![Coverity Scan Build Status](https://scan.coverity.com/projects/3576/badge.svg)](https://scan.coverity.com/projects/3576) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2266/badge)](https://bestpractices.coreinfrastructure.org/projects/2266) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/144fb195a83046e484a75c8b4c6cfc99)](https://www.codacy.com/app/lws-team/libwebsockets?utm_source=github.com&utm_medium=referral&utm_content=warmcat/libwebsockets&utm_campaign=Badge_Grade) [![Total alerts](https://img.shields.io/lgtm/alerts/g/warmcat/libwebsockets.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/warmcat/libwebsockets/alerts/) [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/warmcat/libwebsockets.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/warmcat/libwebsockets/context:cpp) [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/warmcat/libwebsockets.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/warmcat/libwebsockets/context:javascript)
# Libwebsockets

View file

@ -22,6 +22,9 @@
* IN THE SOFTWARE.
*/
#if !defined(__LWS_PRIVATE_LIB_CORE_H__)
#define __LWS_PRIVATE_LIB_CORE_H__
#include "lws_config.h"
#include "lws_config_private.h"
@ -633,3 +636,5 @@ lws_context_destroy2(struct lws_context *context);
#ifdef __cplusplus
};
#endif
#endif

View file

@ -22,6 +22,9 @@
* IN THE SOFTWARE.
*/
#if !defined(__LWS_PRIVATE_LIB_MISC_LWSAC_H__)
#define __LWS_PRIVATE_LIB_MISC_LWSAC_H__
#if !defined(LWS_PLAT_OPTEE)
#include <sys/stat.h>
#endif
@ -53,3 +56,4 @@ struct cached_file_info {
time_t last_confirm;
};
#endif
#endif

View file

@ -394,8 +394,7 @@ lws_token_from_index(struct lws *wsi, int index, const char **arg, int *len,
return -1;
}
if (index < (int)LWS_ARRAY_SIZE(static_token) ||
index >= (int)LWS_ARRAY_SIZE(static_token) + dyn->used_entries) {
if (index >= (int)LWS_ARRAY_SIZE(static_token) + dyn->used_entries) {
lwsl_info(" %s: adjusted index %d >= %d\n", __func__, index,
dyn->used_entries);
lws_h2_goaway(wsi, H2_ERR_COMPRESSION_ERROR,

View file

@ -457,13 +457,11 @@ lws_h2_settings(struct lws *wsi, struct http2_settings *settings,
}
#if defined(LWS_AMAZON_RTOS) || defined(LWS_AMAZON_LINUX)
//FIXME: Workaround for FIRMWARE-4632 until cloud-side issue is fixed.
if (b == 0x7fffffff) {
b = 65535;
lwsl_info("init window size 0x7fffffff\n");
break;
}
//FIXME: end of FIRMWARE-4632 workaround
#endif
/*

View file

@ -24,6 +24,9 @@
* gencrypto openssl-specific helper declarations
*/
#if !defined(__LWS_PRIVATE_LIB_TLS_OPENSSL_H__)
#define __LWS_PRIVATE_LIB_TLS_OPENSSL_H__
/*
* one of these per different client context
* cc_owner is in lws_context.lws_context_tls
@ -54,3 +57,6 @@ lws_gencrypto_openssl_hash_to_EVP_MD(enum lws_genhash_types hash_type);
#if !defined(LWS_HAVE_BN_bn2binpad)
int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen);
#endif
#endif

View file

@ -36,7 +36,7 @@ function new_ws(urlpath, protocol)
document.addEventListener("DOMContentLoaded", function() {
ws = new_ws(get_appropriate_ws_url(""), "lws-minimal-proxy");
var ws = new_ws(get_appropriate_ws_url(""), "lws-minimal-proxy");
try {
ws.onopen = function() {
document.getElementById("r").disabled = 0;

View file

@ -74,7 +74,7 @@
}
function clear_errors() {
var t = document.getElementById("ongoing");
var n, t = document.getElementById("ongoing");
for (n = 0; n < t.rows.length; n++)
if (t.rows[n].cells[0].classList.contains("err"))
@ -154,8 +154,7 @@
}
function upl_button(e) {
var fi = document.getElementById("file"),
da = document.getElementById("da");
var fi = document.getElementById("file");
clear_errors();
e.preventDefault();

View file

@ -28,8 +28,8 @@
function san(s)
{
s.replace("<", "!");
s.replace("%", "!");
s.replace(/</g, "!");
s.replace(/%/g, "!");
return s;
}
@ -46,24 +46,19 @@
};
xhr.onload = function(e) {
var jj, n, m, s = "", x, lic = 0, hl, re;
var jj, n, m, s = "", lic = 0;
var sr = document.getElementById("searchresults");
var ac = document.getElementById("acomplete");
var inp = document.getElementById("lws_fts");
sr.style.width = (parseInt(sr.parentNode.offsetWidth, 10) - 88) + "px";
sr.style.opacity = "1";
inp.blur();
hl = document.getElementById("lws_fts").value;
re = new RegExp(hl, "gi");
// console.log(xhr.responseText);
jj = JSON.parse(xhr.responseText);
if (jj.fp) {
lic = jj.fp.length;
for (n = 0; n < lic; n++) {
var q;
s += "<div class='filepath'>" + jj.fp[n].path + "</div>";
@ -129,7 +124,7 @@
xhr.setRequestHeader("cache-control", "max-age=0");
};
xhr.onload = function(e) {
var jj, n, s = "", x, lic = 0;
var jj, n, s = "", lic = 0;
var inp = document.getElementById("lws_fts");
var ac = document.getElementById("acomplete");

View file

@ -18,5 +18,4 @@ document.addEventListener("DOMContentLoaded", function() {
if (transport_protocol == "h2")
document.getElementById("transport").innerHTML = "<img src=\"/http2.png\">";
}
}, false);

View file

@ -244,7 +244,7 @@ var lwsgs_email_check = '0';
function lwsgs_rupdate()
{
var en_register = 1, en_forgot = 0;
var en_register = 1, en_forgot = 0, op;
if (document.getElementById('rpassword').value ==
document.getElementById('password2').value) {
@ -335,7 +335,7 @@ function lwsgs_rupdate()
function lwsgs_cupdate()
{
var en_change = 1, en_forgot = 1, pwok = 1;
var en_change = 1, en_forgot = 1, pwok = 1, op;
if (lwsgs_auth & 8) {
document.getElementById('ccurpw').style.display = "none";

View file

@ -1,6 +1,6 @@
document.addEventListener("DOMContentLoaded", function() {
var head = 0, tail = 0, ring = new Array();
var head = 0, tail = 0, ring = new Array(), es;
es = new EventSource("/sse/sourcename");
try {

View file

@ -1,6 +1,6 @@
document.addEventListener("DOMContentLoaded", function() {
var head = 0, tail = 0, ring = new Array();
var head = 0, tail = 0, ring = new Array(), es;
es = new EventSource("/sse/sourcename");
try {

View file

@ -18,5 +18,5 @@ document.addEventListener("DOMContentLoaded", function() {
if (transport_protocol == "h2")
document.getElementById("transport").innerHTML = "<img src=\"/http2.png\">";
}
}, false);

View file

@ -18,5 +18,4 @@ document.addEventListener("DOMContentLoaded", function() {
if (transport_protocol == "h2")
document.getElementById("transport").innerHTML = "<img src=\"/http2.png\">";
}
}, false);
}, false);

View file

@ -35,7 +35,7 @@ function new_ws(urlpath, protocol)
document.addEventListener("DOMContentLoaded", function() {
subscriber_ws = new_ws(get_appropriate_ws_url(""), "lws-minimal-broker");
var subscriber_ws = new_ws(get_appropriate_ws_url(""), "lws-minimal-broker");
try {
subscriber_ws.onopen = function() {
document.getElementById("b").disabled = 0;
@ -55,7 +55,7 @@ document.addEventListener("DOMContentLoaded", function() {
alert("<p>Error " + exception);
}
publisher_ws = new_ws(get_appropriate_ws_url("/publisher"), "lws-minimal-broker");
var publisher_ws = new_ws(get_appropriate_ws_url("/publisher"), "lws-minimal-broker");
try {
publisher_ws.onopen = function() {
document.getElementById("m").disabled = 0;

View file

@ -35,7 +35,7 @@ function new_ws(urlpath, protocol)
document.addEventListener("DOMContentLoaded", function() {
ws = new_ws(get_appropriate_ws_url(""), "lws-minimal-pmd-bulk");
var ws = new_ws(get_appropriate_ws_url(""), "lws-minimal-pmd-bulk");
try {
ws.onopen = function() {
document.getElementById("r").disabled = 0;

View file

@ -35,7 +35,7 @@ function new_ws(urlpath, protocol)
document.addEventListener("DOMContentLoaded", function() {
ws = new_ws(get_appropriate_ws_url(""), "lws-minimal");
var ws = new_ws(get_appropriate_ws_url(""), "lws-minimal");
try {
ws.onopen = function() {
document.getElementById("m").disabled = 0;

View file

@ -34,7 +34,7 @@ function new_ws(urlpath, protocol)
document.addEventListener("DOMContentLoaded", function() {
ws = new_ws(get_appropriate_ws_url(""), "lws-minimal");
var ws = new_ws(get_appropriate_ws_url(""), "lws-minimal");
try {
ws.onopen = function() {
document.getElementById("m").disabled = 0;

View file

@ -40,7 +40,7 @@ document.addEventListener("DOMContentLoaded", function() {
for (n = 0; n < 8; n++) {
ws = new_ws(get_appropriate_ws_url(""), "lws-minimal");
var ws = new_ws(get_appropriate_ws_url(""), "lws-minimal");
wsa.push(ws);
try {
ws.onopen = function() {

View file

@ -36,7 +36,7 @@ function new_ws(urlpath, protocol)
document.addEventListener("DOMContentLoaded", function() {
ws = new_ws(get_appropriate_ws_url(""), "lws-minimal");
var ws = new_ws(get_appropriate_ws_url(""), "lws-minimal");
try {
ws.onopen = function() {
document.getElementById("r").disabled = 0;

View file

@ -36,7 +36,7 @@ function new_ws(urlpath, protocol)
document.addEventListener("DOMContentLoaded", function() {
ws = new_ws(get_appropriate_ws_url(""), "lws-minimal");
var ws = new_ws(get_appropriate_ws_url(""), "lws-minimal");
try {
ws.onopen = function() {
document.getElementById("r").disabled = 0;

View file

@ -35,7 +35,7 @@ function new_ws(urlpath, protocol)
document.addEventListener("DOMContentLoaded", function() {
ws = new_ws(get_appropriate_ws_url(""), "lws-minimal");
var ws = new_ws(get_appropriate_ws_url(""), "lws-minimal");
try {
ws.onopen = function() {
document.getElementById("m").disabled = 0;

View file

@ -74,7 +74,7 @@
}
function clear_errors() {
var t = document.getElementById("ongoing");
var n, t = document.getElementById("ongoing");
for (n = 0; n < t.rows.length; n++)
if (t.rows[n].cells[0].classList.contains("err"))
@ -154,8 +154,7 @@
}
function upl_button(e) {
var fi = document.getElementById("file"),
da = document.getElementById("da");
var fi = document.getElementById("file");
clear_errors();
e.preventDefault();

View file

@ -244,7 +244,7 @@ var lwsgs_email_check = '0';
function lwsgs_rupdate()
{
var en_register = 1, en_forgot = 0;
var en_register = 1, en_forgot = 0, op;
if (document.getElementById('rpassword').value ==
document.getElementById('password2').value) {
@ -335,7 +335,7 @@ function lwsgs_rupdate()
function lwsgs_cupdate()
{
var en_change = 1, en_forgot = 1, pwok = 1;
var en_change = 1, en_forgot = 1, pwok = 1, op;
if (lwsgs_auth & 8) {
document.getElementById('ccurpw').style.display = "none";

View file

@ -29,8 +29,6 @@ function humanize(s)
return s;
}
var pos = 0;
function get_appropriate_ws_url()
{
var pcol;