mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
libwebsockets.h: clean out some boilerplate better put in core/private.h
https://github.com/warmcat/libwebsockets/issues/1370
This commit is contained in:
parent
aa03468740
commit
5260a49e3b
51 changed files with 119 additions and 124 deletions
|
@ -1483,7 +1483,7 @@ lws_vfs_select_fops(const struct lws_plat_file_ops *fops, const char *vfs_path,
|
|||
pf = fops->next;
|
||||
while (pf) {
|
||||
n = 0;
|
||||
while (n < (int)ARRAY_SIZE(pf->fi) && pf->fi[n].sig) {
|
||||
while (n < (int)LWS_ARRAY_SIZE(pf->fi) && pf->fi[n].sig) {
|
||||
if (p >= vfs_path + pf->fi[n].len)
|
||||
if (!strncmp(p - (pf->fi[n].len - 1),
|
||||
pf->fi[n].sig,
|
||||
|
@ -1976,14 +1976,14 @@ LWS_VISIBLE void lwsl_emit_stderr(int level, const char *line)
|
|||
{
|
||||
char buf[50];
|
||||
static char tty = 3;
|
||||
int n, m = ARRAY_SIZE(colours) - 1;
|
||||
int n, m = LWS_ARRAY_SIZE(colours) - 1;
|
||||
|
||||
if (!tty)
|
||||
tty = isatty(2) | 2;
|
||||
lwsl_timestamp(level, buf, sizeof(buf));
|
||||
|
||||
if (tty == 3) {
|
||||
n = 1 << (ARRAY_SIZE(colours) - 1);
|
||||
n = 1 << (LWS_ARRAY_SIZE(colours) - 1);
|
||||
while (n) {
|
||||
if (level & n)
|
||||
break;
|
||||
|
|
|
@ -351,7 +351,15 @@ extern "C" {
|
|||
|
||||
#define LWS_H2_RX_SCRATCH_SIZE 512
|
||||
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
// Visual studio older than 2015 and WIN_CE has only _stricmp
|
||||
#if (defined(_MSC_VER) && _MSC_VER < 1900) || defined(_WIN32_WCE)
|
||||
#define strcasecmp _stricmp
|
||||
#elif !defined(__MINGW32__)
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
#define getdtablesize() 30000
|
||||
#endif
|
||||
|
||||
/*
|
||||
* All lws_tls...() functions must return this type, converting the
|
||||
|
|
|
@ -720,7 +720,7 @@ elops_destroy_pt_uv(struct lws_context *context, int tsi)
|
|||
if (!pt->event_loop_foreign) {
|
||||
uv_signal_stop(&pt->w_sigint.uv.watcher);
|
||||
|
||||
ns = ARRAY_SIZE(sigs);
|
||||
ns = LWS_ARRAY_SIZE(sigs);
|
||||
if (lws_check_opt(context->options,
|
||||
LWS_SERVER_OPTION_UV_NO_SIGSEGV_SIGFPE_SPIN))
|
||||
ns = 2;
|
||||
|
@ -781,13 +781,13 @@ elops_init_pt_uv(struct lws_context *context, void *_loop, int tsi)
|
|||
LWS_UV_REFCOUNT_STATIC_HANDLE_NEW(&pt->uv.idle, context);
|
||||
|
||||
|
||||
ns = ARRAY_SIZE(sigs);
|
||||
ns = LWS_ARRAY_SIZE(sigs);
|
||||
if (lws_check_opt(context->options,
|
||||
LWS_SERVER_OPTION_UV_NO_SIGSEGV_SIGFPE_SPIN))
|
||||
ns = 2;
|
||||
|
||||
if (!pt->event_loop_foreign) {
|
||||
assert(ns <= (int)ARRAY_SIZE(pt->uv.signals));
|
||||
assert(ns <= (int)LWS_ARRAY_SIZE(pt->uv.signals));
|
||||
for (n = 0; n < ns; n++) {
|
||||
uv_signal_init(loop, &pt->uv.signals[n]);
|
||||
LWS_UV_REFCOUNT_STATIC_HANDLE_NEW(&pt->uv.signals[n],
|
||||
|
|
|
@ -66,14 +66,6 @@ typedef unsigned long long lws_intptr_t;
|
|||
#define O_RDONLY _O_RDONLY
|
||||
#endif
|
||||
|
||||
// Visual studio older than 2015 and WIN_CE has only _stricmp
|
||||
#if (defined(_MSC_VER) && _MSC_VER < 1900) || defined(_WIN32_WCE)
|
||||
#define strcasecmp _stricmp
|
||||
#elif !defined(__MINGW32__)
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
#define getdtablesize() 30000
|
||||
|
||||
#define LWS_INLINE __inline
|
||||
#define LWS_VISIBLE
|
||||
#define LWS_WARN_UNUSED_RESULT
|
||||
|
@ -460,9 +452,6 @@ lwsl_visible(int level);
|
|||
#endif
|
||||
|
||||
struct lws;
|
||||
#ifndef ARRAY_SIZE
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||
#endif
|
||||
|
||||
typedef int64_t lws_usec_t;
|
||||
|
||||
|
@ -7068,9 +7057,6 @@ lws_email_destroy(struct lws_email *email);
|
|||
//@{
|
||||
struct lejp_ctx;
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
#define ARRAY_SIZE(_x) (sizeof(_x) / sizeof(_x[0]))
|
||||
#endif
|
||||
#define LWS_ARRAY_SIZE(_x) (sizeof(_x) / sizeof(_x[0]))
|
||||
#define LEJP_FLAG_WS_KEEP 64
|
||||
#define LEJP_FLAG_WS_COMMENTLINE 32
|
||||
|
|
|
@ -135,7 +135,7 @@ lws_jwk_import(struct lws_jwk *s, const char *in, size_t len)
|
|||
cbs.b64 = b64;
|
||||
cbs.b64max = b64max;
|
||||
cbs.pos = 0;
|
||||
lejp_construct(&jctx, cb_jwk, &cbs, jwk_tok, ARRAY_SIZE(jwk_tok));
|
||||
lejp_construct(&jctx, cb_jwk, &cbs, jwk_tok, LWS_ARRAY_SIZE(jwk_tok));
|
||||
m = (int)(signed char)lejp_parse(&jctx, (uint8_t *)in, len);
|
||||
lejp_destruct(&jctx);
|
||||
|
||||
|
|
|
@ -273,7 +273,7 @@ lws_jws_confirm_sig(const char *in, size_t len, struct lws_jwk *jwk)
|
|||
|
||||
args.alg[0] = '\0';
|
||||
args.is_rsa = 0;
|
||||
lejp_construct(&jctx, cb_hdr, &args, jhdr_tok, ARRAY_SIZE(jhdr_tok));
|
||||
lejp_construct(&jctx, cb_hdr, &args, jhdr_tok, LWS_ARRAY_SIZE(jhdr_tok));
|
||||
m = (int)(signed char)lejp_parse(&jctx, (uint8_t *)buf, n);
|
||||
lejp_destruct(&jctx);
|
||||
if (m < 0) {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
*/
|
||||
|
||||
#include <libwebsockets.h>
|
||||
#include "core/private.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -30,7 +31,7 @@
|
|||
* \param callback: your user callback which will received parsed tokens
|
||||
* \param user: optional user data pointer untouched by lejp
|
||||
* \param paths: your array of name elements you are interested in
|
||||
* \param count_paths: ARRAY_SIZE() of @paths
|
||||
* \param count_paths: LWS_ARRAY_SIZE() of @paths
|
||||
*
|
||||
* Prepares your context struct for use with lejp
|
||||
*/
|
||||
|
@ -417,7 +418,7 @@ lejp_parse(struct lejp_ctx *ctx, const unsigned char *json, int len)
|
|||
goto reject;
|
||||
}
|
||||
ctx->i[ctx->ipos++] = 0;
|
||||
if (ctx->ipos > ARRAY_SIZE(ctx->i)) {
|
||||
if (ctx->ipos > LWS_ARRAY_SIZE(ctx->i)) {
|
||||
ret = LEJP_REJECT_MP_DELIM_ISTACK;
|
||||
goto reject;
|
||||
}
|
||||
|
@ -722,7 +723,7 @@ add_stack_level:
|
|||
|
||||
ctx->st[ctx->sp].p = ctx->ppos;
|
||||
ctx->st[ctx->sp].i = ctx->ipos;
|
||||
if (++ctx->sp == ARRAY_SIZE(ctx->st)) {
|
||||
if (++ctx->sp == LWS_ARRAY_SIZE(ctx->st)) {
|
||||
ret = LEJP_REJECT_STACK_OVERFLOW;
|
||||
goto reject;
|
||||
}
|
||||
|
|
|
@ -1068,7 +1068,7 @@ end_scan()
|
|||
uint16_t count_ap_records;
|
||||
int n, m;
|
||||
|
||||
count_ap_records = ARRAY_SIZE(ap_records);
|
||||
count_ap_records = LWS_ARRAY_SIZE(ap_records);
|
||||
if (esp_wifi_scan_get_ap_records(&count_ap_records, ap_records)) {
|
||||
lwsl_err("%s: failed\n", __func__);
|
||||
return;
|
||||
|
@ -1292,7 +1292,7 @@ esp_err_t lws_esp32_event_passthru(void *ctx, system_event_t *event)
|
|||
|
||||
mdns_service_add(lws_esp32.group,
|
||||
"_lwsgrmem", "_tcp", 443, txta,
|
||||
ARRAY_SIZE(txta));
|
||||
LWS_ARRAY_SIZE(txta));
|
||||
|
||||
mem = lws_esp32.first;
|
||||
while (mem) {
|
||||
|
|
|
@ -645,7 +645,7 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
|
|||
lws_fop_fd_t fop_fd;
|
||||
LARGE_INTEGER llFileSize = {0};
|
||||
|
||||
MultiByteToWideChar(CP_UTF8, 0, filename, -1, buf, ARRAY_SIZE(buf));
|
||||
MultiByteToWideChar(CP_UTF8, 0, filename, -1, buf, LWS_ARRAY_SIZE(buf));
|
||||
if (((*flags) & 7) == _O_RDONLY) {
|
||||
ret = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ,
|
||||
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
|
|
@ -221,7 +221,7 @@ lws_cgi(struct lws *wsi, const char * const *exec_array, int script_uri_path_len
|
|||
};
|
||||
|
||||
if (script_uri_path_len >= 0)
|
||||
for (m = 0; m < (int)ARRAY_SIZE(meths); m++)
|
||||
for (m = 0; m < (int)LWS_ARRAY_SIZE(meths); m++)
|
||||
if (lws_hdr_total_length(wsi, meths[m]) >=
|
||||
script_uri_path_len) {
|
||||
uritok = meths[m];
|
||||
|
|
|
@ -219,7 +219,7 @@ static int lws_frag_start(struct lws *wsi, int hdr_token_idx)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (ah->nfrag >= ARRAY_SIZE(ah->frag_index)) {
|
||||
if (ah->nfrag >= LWS_ARRAY_SIZE(ah->frag_index)) {
|
||||
lwsl_err("%s: frag index %d too big\n", __func__, ah->nfrag);
|
||||
return 1;
|
||||
}
|
||||
|
@ -375,8 +375,8 @@ lws_token_from_index(struct lws *wsi, int index, const char **arg, int *len,
|
|||
if (index < 0)
|
||||
return -1;
|
||||
|
||||
if (index < (int)ARRAY_SIZE(static_token)) {
|
||||
if (arg && index < (int)ARRAY_SIZE(http2_canned)) {
|
||||
if (index < (int)LWS_ARRAY_SIZE(static_token)) {
|
||||
if (arg && index < (int)LWS_ARRAY_SIZE(http2_canned)) {
|
||||
*arg = http2_canned[index];
|
||||
*len = (int)strlen(http2_canned[index]);
|
||||
}
|
||||
|
@ -391,8 +391,8 @@ lws_token_from_index(struct lws *wsi, int index, const char **arg, int *len,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (index < (int)ARRAY_SIZE(static_token) ||
|
||||
index >= (int)ARRAY_SIZE(static_token) + dyn->used_entries) {
|
||||
if (index < (int)LWS_ARRAY_SIZE(static_token) ||
|
||||
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,
|
||||
|
@ -400,7 +400,7 @@ lws_token_from_index(struct lws *wsi, int index, const char **arg, int *len,
|
|||
return -1;
|
||||
}
|
||||
|
||||
index -= (int)ARRAY_SIZE(static_token);
|
||||
index -= (int)LWS_ARRAY_SIZE(static_token);
|
||||
index = (dyn->pos - 1 - index) % dyn->num_entries;
|
||||
if (index < 0)
|
||||
index += dyn->num_entries;
|
||||
|
@ -435,7 +435,7 @@ lws_h2_dynamic_table_dump(struct lws *wsi)
|
|||
lwsl_header("Dump dyn table for nwsi %p (%d / %d members, pos = %d, "
|
||||
"start index %d, virt used %d / %d)\n", nwsi,
|
||||
dyn->used_entries, dyn->num_entries, dyn->pos,
|
||||
(uint32_t)ARRAY_SIZE(static_token),
|
||||
(uint32_t)LWS_ARRAY_SIZE(static_token),
|
||||
dyn->virtual_payload_usage, dyn->virtual_payload_max);
|
||||
|
||||
for (n = 0; n < dyn->used_entries; n++) {
|
||||
|
@ -448,7 +448,7 @@ lws_h2_dynamic_table_dump(struct lws *wsi)
|
|||
else
|
||||
p = "(ignored)";
|
||||
lwsl_header(" %3d: tok %s: (len %d) val '%s'\n",
|
||||
(int)(n + ARRAY_SIZE(static_token)), p,
|
||||
(int)(n + LWS_ARRAY_SIZE(static_token)), p,
|
||||
dyn->entries[m].hdr_len, dyn->entries[m].value ?
|
||||
dyn->entries[m].value : "null");
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ lws_dynamic_token_insert(struct lws *wsi, int hdr_len,
|
|||
dyn->virtual_payload_usage += hdr_len + len;
|
||||
|
||||
lwsl_info("%s: index %ld: lws_hdr_index 0x%x, hdr len %d, '%s' len %d\n",
|
||||
__func__, (long)ARRAY_SIZE(static_token),
|
||||
__func__, (long)LWS_ARRAY_SIZE(static_token),
|
||||
lws_hdr_index, hdr_len, dyn->entries[new_index].value ?
|
||||
dyn->entries[new_index].value : "null", len);
|
||||
|
||||
|
@ -726,7 +726,7 @@ lws_hpack_use_idx_hdr(struct lws *wsi, int idx, int known_token)
|
|||
if (arg)
|
||||
p = arg;
|
||||
|
||||
if (idx < (int)ARRAY_SIZE(http2_canned))
|
||||
if (idx < (int)LWS_ARRAY_SIZE(http2_canned))
|
||||
p = http2_canned[idx];
|
||||
|
||||
if (lws_frag_start(wsi, tok))
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define ARRAY_SIZE(n) (sizeof(n) / sizeof(n[0]))
|
||||
#define LWS_ARRAY_SIZE(n) (sizeof(n) / sizeof(n[0]))
|
||||
|
||||
struct huf {
|
||||
unsigned int code;
|
||||
|
@ -340,7 +340,7 @@ int main(void)
|
|||
int fails = 0;
|
||||
|
||||
m = 0;
|
||||
while (m < ARRAY_SIZE(state)) {
|
||||
while (m < LWS_ARRAY_SIZE(state)) {
|
||||
for (j = 0; j < PARALLEL; j++) {
|
||||
state[m].state[j] = 0xffff;
|
||||
state[m].terminal = 0;
|
||||
|
@ -348,7 +348,7 @@ int main(void)
|
|||
m++;
|
||||
}
|
||||
|
||||
while (n < ARRAY_SIZE(huf_literal)) {
|
||||
while (n < LWS_ARRAY_SIZE(huf_literal)) {
|
||||
|
||||
m = 0;
|
||||
walk = 0;
|
||||
|
@ -474,7 +474,7 @@ again:
|
|||
* Try to parse every legal input string
|
||||
*/
|
||||
|
||||
for (n = 0; n < ARRAY_SIZE(huf_literal); n++) {
|
||||
for (n = 0; n < LWS_ARRAY_SIZE(huf_literal); n++) {
|
||||
walk = 0;
|
||||
m = 0;
|
||||
y = -1;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
const unsigned char *
|
||||
lws_token_to_string(enum lws_token_indexes token)
|
||||
{
|
||||
if ((unsigned int)token >= ARRAY_SIZE(set))
|
||||
if ((unsigned int)token >= LWS_ARRAY_SIZE(set))
|
||||
return NULL;
|
||||
|
||||
return (unsigned char *)set[token];
|
||||
|
@ -215,9 +215,9 @@ lws_add_http_header_status(struct lws *wsi, unsigned int _code,
|
|||
if (lwsi_role_h2(wsi) || lwsi_role_h2_ENCAPSULATION(wsi))
|
||||
return lws_add_http2_header_status(wsi, code, p, end);
|
||||
#endif
|
||||
if (code >= 400 && code < (400 + ARRAY_SIZE(err400)))
|
||||
if (code >= 400 && code < (400 + LWS_ARRAY_SIZE(err400)))
|
||||
description = err400[code - 400];
|
||||
if (code >= 500 && code < (500 + ARRAY_SIZE(err500)))
|
||||
if (code >= 500 && code < (500 + LWS_ARRAY_SIZE(err500)))
|
||||
description = err500[code - 500];
|
||||
|
||||
if (code == 100)
|
||||
|
@ -230,7 +230,7 @@ lws_add_http_header_status(struct lws *wsi, unsigned int _code,
|
|||
if (code >= 300 && code < 400)
|
||||
description = "Redirect";
|
||||
|
||||
if (wsi->http.request_version < ARRAY_SIZE(hver))
|
||||
if (wsi->http.request_version < LWS_ARRAY_SIZE(hver))
|
||||
p1 = hver[wsi->http.request_version];
|
||||
else
|
||||
p1 = hver[0];
|
||||
|
|
|
@ -225,7 +225,7 @@ arg_to_bool(const char *s)
|
|||
if (n)
|
||||
return 1;
|
||||
|
||||
for (n = 0; n < (int)ARRAY_SIZE(on); n++)
|
||||
for (n = 0; n < (int)LWS_ARRAY_SIZE(on); n++)
|
||||
if (!strcasecmp(s, on[n]))
|
||||
return 1;
|
||||
|
||||
|
@ -502,7 +502,7 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
|
|||
if (a->last)
|
||||
a->last->mount_next = m;
|
||||
|
||||
for (n = 0; n < (int)ARRAY_SIZE(mount_protocols); n++)
|
||||
for (n = 0; n < (int)LWS_ARRAY_SIZE(mount_protocols); n++)
|
||||
if (!strncmp(a->m.origin, mount_protocols[n],
|
||||
strlen(mount_protocols[n]))) {
|
||||
lwsl_info("----%s\n", a->m.origin);
|
||||
|
@ -512,7 +512,7 @@ lejp_vhosts_cb(struct lejp_ctx *ctx, char reason)
|
|||
break;
|
||||
}
|
||||
|
||||
if (n == (int)ARRAY_SIZE(mount_protocols)) {
|
||||
if (n == (int)LWS_ARRAY_SIZE(mount_protocols)) {
|
||||
lwsl_err("unsupported protocol:// %s\n", a->m.origin);
|
||||
return 1;
|
||||
}
|
||||
|
@ -927,11 +927,11 @@ lwsws_get_config_globals(struct lws_context_creation_info *info, const char *d,
|
|||
|
||||
lws_snprintf(dd, sizeof(dd) - 1, "%s/conf", d);
|
||||
if (lwsws_get_config(&a, dd, paths_global,
|
||||
ARRAY_SIZE(paths_global), lejp_globals_cb) > 1)
|
||||
LWS_ARRAY_SIZE(paths_global), lejp_globals_cb) > 1)
|
||||
return 1;
|
||||
lws_snprintf(dd, sizeof(dd) - 1, "%s/conf.d", d);
|
||||
if (lwsws_get_config_d(&a, dd, paths_global,
|
||||
ARRAY_SIZE(paths_global), lejp_globals_cb) > 1)
|
||||
LWS_ARRAY_SIZE(paths_global), lejp_globals_cb) > 1)
|
||||
return 1;
|
||||
|
||||
a.plugin_dirs[a.count_plugin_dirs] = NULL;
|
||||
|
@ -962,11 +962,11 @@ lwsws_get_config_vhosts(struct lws_context *context,
|
|||
|
||||
lws_snprintf(dd, sizeof(dd) - 1, "%s/conf", d);
|
||||
if (lwsws_get_config(&a, dd, paths_vhosts,
|
||||
ARRAY_SIZE(paths_vhosts), lejp_vhosts_cb) > 1)
|
||||
LWS_ARRAY_SIZE(paths_vhosts), lejp_vhosts_cb) > 1)
|
||||
return 1;
|
||||
lws_snprintf(dd, sizeof(dd) - 1, "%s/conf.d", d);
|
||||
if (lwsws_get_config_d(&a, dd, paths_vhosts,
|
||||
ARRAY_SIZE(paths_vhosts), lejp_vhosts_cb) > 1)
|
||||
LWS_ARRAY_SIZE(paths_vhosts), lejp_vhosts_cb) > 1)
|
||||
return 1;
|
||||
|
||||
*cs = a.p;
|
||||
|
|
|
@ -263,7 +263,7 @@ retry_as_first:
|
|||
c =*in;
|
||||
if (c >= 'A' && c <= 'Z')
|
||||
c += 'a' - 'A';
|
||||
for (n = 0; n < (int)ARRAY_SIZE(mp_hdr); n++)
|
||||
for (n = 0; n < (int)LWS_ARRAY_SIZE(mp_hdr); n++)
|
||||
if (c == mp_hdr[n][s->mp]) {
|
||||
m++;
|
||||
hit = n;
|
||||
|
|
|
@ -563,7 +563,7 @@ int LWS_WARN_UNUSED_RESULT
|
|||
lws_hdr_simple_create(struct lws *wsi, enum lws_token_indexes h, const char *s)
|
||||
{
|
||||
wsi->http.ah->nfrag++;
|
||||
if (wsi->http.ah->nfrag == ARRAY_SIZE(wsi->http.ah->frags)) {
|
||||
if (wsi->http.ah->nfrag == LWS_ARRAY_SIZE(wsi->http.ah->frags)) {
|
||||
lwsl_warn("More hdr frags than we can deal with, dropping\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -682,7 +682,7 @@ lws_parse_urldecode(struct lws *wsi, uint8_t *_c)
|
|||
/* link to next fragment */
|
||||
ah->frags[ah->nfrag].nfrag = ah->nfrag + 1;
|
||||
ah->nfrag++;
|
||||
if (ah->nfrag >= ARRAY_SIZE(ah->frags))
|
||||
if (ah->nfrag >= LWS_ARRAY_SIZE(ah->frags))
|
||||
goto excessive;
|
||||
/* start next fragment after the & */
|
||||
ah->post_literal_equal = 0;
|
||||
|
@ -785,7 +785,7 @@ lws_parse_urldecode(struct lws *wsi, uint8_t *_c)
|
|||
|
||||
/* move to using WSI_TOKEN_HTTP_URI_ARGS */
|
||||
ah->nfrag++;
|
||||
if (ah->nfrag >= ARRAY_SIZE(ah->frags))
|
||||
if (ah->nfrag >= LWS_ARRAY_SIZE(ah->frags))
|
||||
goto excessive;
|
||||
ah->frags[ah->nfrag].offset = ++ah->pos;
|
||||
ah->frags[ah->nfrag].len = 0;
|
||||
|
@ -850,10 +850,10 @@ lws_parse(struct lws *wsi, unsigned char *buf, int *len)
|
|||
c == ' ')
|
||||
break;
|
||||
|
||||
for (m = 0; m < ARRAY_SIZE(methods); m++)
|
||||
for (m = 0; m < LWS_ARRAY_SIZE(methods); m++)
|
||||
if (ah->parser_state == methods[m])
|
||||
break;
|
||||
if (m == ARRAY_SIZE(methods))
|
||||
if (m == LWS_ARRAY_SIZE(methods))
|
||||
/* it was not any of the methods */
|
||||
goto check_eol;
|
||||
|
||||
|
@ -981,7 +981,7 @@ nope:
|
|||
if (ah->lextable_pos < 0 && lwsi_role_h1(wsi) &&
|
||||
lwsi_role_server(wsi)) {
|
||||
/* this is not a header we know about */
|
||||
for (m = 0; m < ARRAY_SIZE(methods); m++)
|
||||
for (m = 0; m < LWS_ARRAY_SIZE(methods); m++)
|
||||
if (ah->frag_index[methods[m]]) {
|
||||
/*
|
||||
* already had the method, no idea what
|
||||
|
@ -994,7 +994,7 @@ nope:
|
|||
* hm it's an unknown http method from a client in fact,
|
||||
* it cannot be valid http
|
||||
*/
|
||||
if (m == ARRAY_SIZE(methods)) {
|
||||
if (m == LWS_ARRAY_SIZE(methods)) {
|
||||
/*
|
||||
* are we set up to accept raw in these cases?
|
||||
*/
|
||||
|
@ -1023,7 +1023,7 @@ nope:
|
|||
lextable[ah->lextable_pos + 1];
|
||||
|
||||
lwsl_parser("known hdr %d\n", n);
|
||||
for (m = 0; m < ARRAY_SIZE(methods); m++)
|
||||
for (m = 0; m < LWS_ARRAY_SIZE(methods); m++)
|
||||
if (n == methods[m] &&
|
||||
ah->frag_index[methods[m]]) {
|
||||
lwsl_warn("Duplicated method\n");
|
||||
|
@ -1059,7 +1059,7 @@ nope:
|
|||
start_fragment:
|
||||
ah->nfrag++;
|
||||
excessive:
|
||||
if (ah->nfrag == ARRAY_SIZE(ah->frags)) {
|
||||
if (ah->nfrag == LWS_ARRAY_SIZE(ah->frags)) {
|
||||
lwsl_warn("More hdr frags than we can deal with\n");
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -823,7 +823,7 @@ lws_http_get_uri_and_method(struct lws *wsi, char **puri_ptr, int *puri_len)
|
|||
{
|
||||
int n, count = 0;
|
||||
|
||||
for (n = 0; n < (int)ARRAY_SIZE(methods); n++)
|
||||
for (n = 0; n < (int)LWS_ARRAY_SIZE(methods); n++)
|
||||
if (lws_hdr_total_length(wsi, methods[n]))
|
||||
count++;
|
||||
if (!count) {
|
||||
|
@ -838,7 +838,7 @@ lws_http_get_uri_and_method(struct lws *wsi, char **puri_ptr, int *puri_len)
|
|||
return -1;
|
||||
}
|
||||
|
||||
for (n = 0; n < (int)ARRAY_SIZE(methods); n++)
|
||||
for (n = 0; n < (int)LWS_ARRAY_SIZE(methods); n++)
|
||||
if (lws_hdr_total_length(wsi, methods[n])) {
|
||||
*puri_ptr = lws_hdr_simple_ptr(wsi, methods[n]);
|
||||
*puri_len = lws_hdr_total_length(wsi, methods[n]);
|
||||
|
@ -868,7 +868,7 @@ lws_http_action(struct lws *wsi)
|
|||
};
|
||||
|
||||
meth = lws_http_get_uri_and_method(wsi, &uri_ptr, &uri_len);
|
||||
if (meth < 0 || meth >= (int)ARRAY_SIZE(method_names))
|
||||
if (meth < 0 || meth >= (int)LWS_ARRAY_SIZE(method_names))
|
||||
goto bail_nuke_ah;
|
||||
|
||||
/* we insist on absolute paths */
|
||||
|
|
|
@ -83,12 +83,12 @@ lws_extension_callback_pm_deflate(struct lws_context *context,
|
|||
if (!oa->option_name)
|
||||
break;
|
||||
lwsl_ext("%s: named option set: %s\n", __func__, oa->option_name);
|
||||
for (n = 0; n < (int)ARRAY_SIZE(lws_ext_pm_deflate_options); n++)
|
||||
for (n = 0; n < (int)LWS_ARRAY_SIZE(lws_ext_pm_deflate_options); n++)
|
||||
if (!strcmp(lws_ext_pm_deflate_options[n].name,
|
||||
oa->option_name))
|
||||
break;
|
||||
|
||||
if (n == (int)ARRAY_SIZE(lws_ext_pm_deflate_options))
|
||||
if (n == (int)LWS_ARRAY_SIZE(lws_ext_pm_deflate_options))
|
||||
break;
|
||||
oa->option_index = n;
|
||||
|
||||
|
|
|
@ -631,7 +631,7 @@ lws_tls_acme_sni_csr_create(struct lws_context *context, const char *elements[],
|
|||
|
||||
/* subject must be formatted like "C=TW,O=warmcat,CN=myserver" */
|
||||
|
||||
for (n = 0; n < (int)ARRAY_SIZE(x5); n++) {
|
||||
for (n = 0; n < (int)LWS_ARRAY_SIZE(x5); n++) {
|
||||
if (p != subject)
|
||||
*p++ = ',';
|
||||
if (elements[n])
|
||||
|
|
|
@ -183,7 +183,7 @@ reload_handler(int signum)
|
|||
fprintf(stderr, "root process receives reload\n");
|
||||
if (!do_reload) {
|
||||
fprintf(stderr, "passing HUP to child processes\n");
|
||||
for (m = 0; m < (int)ARRAY_SIZE(pids); m++)
|
||||
for (m = 0; m < (int)LWS_ARRAY_SIZE(pids); m++)
|
||||
if (pids[m])
|
||||
kill(pids[m], SIGHUP);
|
||||
sleep(1);
|
||||
|
@ -196,7 +196,7 @@ reload_handler(int signum)
|
|||
fprintf(stderr, "master process waiting 2s...\n");
|
||||
sleep(2); /* give children a chance to deal with the signal */
|
||||
fprintf(stderr, "killing service processes\n");
|
||||
for (m = 0; m < (int)ARRAY_SIZE(pids); m++)
|
||||
for (m = 0; m < (int)LWS_ARRAY_SIZE(pids); m++)
|
||||
if (pids[m])
|
||||
kill(pids[m], SIGTERM);
|
||||
exit(0);
|
||||
|
@ -254,7 +254,7 @@ int main(int argc, char **argv)
|
|||
break;
|
||||
/* old */
|
||||
if (n > 0)
|
||||
for (m = 0; m < (int)ARRAY_SIZE(pids); m++)
|
||||
for (m = 0; m < (int)LWS_ARRAY_SIZE(pids); m++)
|
||||
if (!pids[m]) {
|
||||
// fprintf(stderr, "added child pid %d\n", n);
|
||||
pids[m] = n;
|
||||
|
@ -266,7 +266,7 @@ int main(int argc, char **argv)
|
|||
|
||||
n = waitpid(-1, &status, WNOHANG);
|
||||
if (n > 0)
|
||||
for (m = 0; m < (int)ARRAY_SIZE(pids); m++)
|
||||
for (m = 0; m < (int)LWS_ARRAY_SIZE(pids); m++)
|
||||
if (pids[m] == n) {
|
||||
// fprintf(stderr, "reaped child pid %d\n", pids[m]);
|
||||
pids[m] = 0;
|
||||
|
|
|
@ -264,7 +264,7 @@ init_protocol_minimal(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user,
|
|||
|
||||
/* we just dump the decoded things to the log */
|
||||
|
||||
for (n = 0; n < (int)ARRAY_SIZE(param_names); n++) {
|
||||
for (n = 0; n < (int)LWS_ARRAY_SIZE(param_names); n++) {
|
||||
val = lws_get_urlarg_by_name(wsi, param_names[n],
|
||||
(char *)buf, sizeof(buf));
|
||||
if (!val)
|
||||
|
|
|
@ -125,7 +125,7 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user,
|
|||
|
||||
if (!pss->spa) {
|
||||
pss->spa = lws_spa_create(wsi, param_names,
|
||||
ARRAY_SIZE(param_names), 1024,
|
||||
LWS_ARRAY_SIZE(param_names), 1024,
|
||||
file_upload_cb, pss);
|
||||
if (!pss->spa)
|
||||
return -1;
|
||||
|
@ -145,7 +145,7 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user,
|
|||
|
||||
/* we just dump the decoded things to the log */
|
||||
|
||||
for (n = 0; n < (int)ARRAY_SIZE(param_names); n++) {
|
||||
for (n = 0; n < (int)LWS_ARRAY_SIZE(param_names); n++) {
|
||||
if (!lws_spa_get_string(pss->spa, n))
|
||||
lwsl_user("%s: undefined\n", param_names[n]);
|
||||
else
|
||||
|
|
|
@ -69,7 +69,7 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user,
|
|||
|
||||
if (!pss->spa) {
|
||||
pss->spa = lws_spa_create(wsi, param_names,
|
||||
ARRAY_SIZE(param_names), 1024,
|
||||
LWS_ARRAY_SIZE(param_names), 1024,
|
||||
NULL, NULL); /* no file upload */
|
||||
if (!pss->spa)
|
||||
return -1;
|
||||
|
@ -89,7 +89,7 @@ callback_http(struct lws *wsi, enum lws_callback_reasons reason, void *user,
|
|||
|
||||
/* we just dump the decoded things to the log */
|
||||
|
||||
for (n = 0; n < (int)ARRAY_SIZE(param_names); n++) {
|
||||
for (n = 0; n < (int)LWS_ARRAY_SIZE(param_names); n++) {
|
||||
if (!lws_spa_get_string(pss->spa, n))
|
||||
lwsl_user("%s: undefined\n", param_names[n]);
|
||||
else
|
||||
|
|
|
@ -294,7 +294,7 @@ init_protocol_minimal_client_echo(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ init_protocol_minimal_pmd_bulk(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ init_protocol_minimal(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ init_protocol_minimal_server_echo(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -241,7 +241,7 @@ init_protocol_minimal_pmd_bulk(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ init_protocol_minimal(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -299,7 +299,7 @@ init_protocol_minimal(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -303,7 +303,7 @@ init_protocol_minimal(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ init_protocol_minimal(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ init_protocol_example_standalone(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -585,7 +585,7 @@ callback_acme_client(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
memcpy(start, pvo->value, n);
|
||||
p += n;
|
||||
|
||||
for (m = 0; m < (int)ARRAY_SIZE(pvo_names); m++)
|
||||
for (m = 0; m < (int)LWS_ARRAY_SIZE(pvo_names); m++)
|
||||
if (!strcmp(pvo->name, pvo_names[m]))
|
||||
vhd->pvop[m] = start;
|
||||
|
||||
|
@ -593,7 +593,7 @@ callback_acme_client(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
}
|
||||
|
||||
n = 0;
|
||||
for (m = 0; m < (int)ARRAY_SIZE(pvo_names); m++)
|
||||
for (m = 0; m < (int)LWS_ARRAY_SIZE(pvo_names); m++)
|
||||
if (!vhd->pvop[m] && m >= LWS_TLS_REQ_ELEMENT_COMMON_NAME) {
|
||||
lwsl_notice("%s: require pvo '%s'\n", __func__,
|
||||
pvo_names[m]);
|
||||
|
@ -669,7 +669,7 @@ callback_acme_client(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
if (vhd->vhost != caa->vh)
|
||||
return 1;
|
||||
|
||||
for (n = 0; n < (int)ARRAY_SIZE(vhd->pvop);n++)
|
||||
for (n = 0; n < (int)LWS_ARRAY_SIZE(vhd->pvop);n++)
|
||||
if (caa->element_overrides[n])
|
||||
vhd->pvop_active[n] = caa->element_overrides[n];
|
||||
else
|
||||
|
@ -720,19 +720,19 @@ callback_acme_client(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
switch (ac->state) {
|
||||
case ACME_STATE_DIRECTORY:
|
||||
lejp_construct(&ac->jctx, cb_dir, vhd, jdir_tok,
|
||||
ARRAY_SIZE(jdir_tok));
|
||||
LWS_ARRAY_SIZE(jdir_tok));
|
||||
break;
|
||||
case ACME_STATE_NEW_REG:
|
||||
break;
|
||||
case ACME_STATE_NEW_AUTH:
|
||||
lejp_construct(&ac->jctx, cb_authz, ac, jauthz_tok,
|
||||
ARRAY_SIZE(jauthz_tok));
|
||||
LWS_ARRAY_SIZE(jauthz_tok));
|
||||
break;
|
||||
|
||||
case ACME_STATE_POLLING:
|
||||
case ACME_STATE_ACCEPT_CHALL:
|
||||
lejp_construct(&ac->jctx, cb_chac, ac, jchac_tok,
|
||||
ARRAY_SIZE(jchac_tok));
|
||||
LWS_ARRAY_SIZE(jchac_tok));
|
||||
break;
|
||||
|
||||
case ACME_STATE_POLLING_CSR:
|
||||
|
@ -1598,7 +1598,7 @@ init_protocol_lws_acme_client(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -553,7 +553,7 @@ callback_generic_sessions(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
a.wsi = wsi;
|
||||
|
||||
pss->phs.vars = vars;
|
||||
pss->phs.count_vars = ARRAY_SIZE(vars);
|
||||
pss->phs.count_vars = LWS_ARRAY_SIZE(vars);
|
||||
pss->phs.replace = lwsgs_subst;
|
||||
pss->phs.data = &a;
|
||||
|
||||
|
@ -568,7 +568,7 @@ callback_generic_sessions(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
|
||||
if (!pss->spa) {
|
||||
pss->spa = lws_spa_create(wsi, param_names,
|
||||
ARRAY_SIZE(param_names), 1024,
|
||||
LWS_ARRAY_SIZE(param_names), 1024,
|
||||
NULL, NULL);
|
||||
if (!pss->spa)
|
||||
return -1;
|
||||
|
@ -901,7 +901,7 @@ init_protocol_generic_sessions(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -294,7 +294,7 @@ callback_messageboard(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
break;
|
||||
if (!pss->spa) {
|
||||
pss->spa = lws_spa_create(wsi, param_names,
|
||||
ARRAY_SIZE(param_names),
|
||||
LWS_ARRAY_SIZE(param_names),
|
||||
MAX_MSG_LEN + 1024, NULL, NULL);
|
||||
if (!pss->spa)
|
||||
return -1;
|
||||
|
@ -408,7 +408,7 @@ init_protocol_lws_messageboard(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -380,7 +380,7 @@ init_protocol_lws_table_dirlisting(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ init_protocol_client_loopback_test(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ init_protocol_dumb_increment(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ callback_esplws_ota(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
lws_set_timeout(wsi, PENDING_TIMEOUT_HTTP_CONTENT, 30);
|
||||
if (!pss->spa) {
|
||||
pss->spa = lws_spa_create(wsi, ota_param_names,
|
||||
ARRAY_SIZE(ota_param_names), 4096,
|
||||
LWS_ARRAY_SIZE(ota_param_names), 4096,
|
||||
ota_file_upload_cb, pss);
|
||||
if (!pss->spa)
|
||||
return -1;
|
||||
|
|
|
@ -347,10 +347,10 @@ scan_finished(uint16_t count, wifi_ap_record_t *recs, void *v)
|
|||
|
||||
vhd->scan_ongoing = 0;
|
||||
|
||||
if (count < ARRAY_SIZE(vhd->ap_records))
|
||||
if (count < LWS_ARRAY_SIZE(vhd->ap_records))
|
||||
vhd->count_ap_records = count;
|
||||
else
|
||||
vhd->count_ap_records = ARRAY_SIZE(vhd->ap_records);
|
||||
vhd->count_ap_records = LWS_ARRAY_SIZE(vhd->ap_records);
|
||||
|
||||
memcpy(vhd->ap_records, recs, vhd->count_ap_records * sizeof(*recs));
|
||||
|
||||
|
@ -826,7 +826,7 @@ issue:
|
|||
|
||||
lwsl_notice("si %d\n", si);
|
||||
|
||||
for (n = 0; n < ARRAY_SIZE(store_json); n++) {
|
||||
for (n = 0; n < LWS_ARRAY_SIZE(store_json); n++) {
|
||||
if (esplws_simple_arg(p, sizeof(p), in, store_json[n].j))
|
||||
continue;
|
||||
|
||||
|
@ -1020,7 +1020,7 @@ start_le:
|
|||
/* create the POST argument parser if not already existing */
|
||||
if (!pss->spa) {
|
||||
pss->spa = lws_spa_create(wsi, param_names,
|
||||
ARRAY_SIZE(param_names), 1024,
|
||||
LWS_ARRAY_SIZE(param_names), 1024,
|
||||
file_upload_cb, pss);
|
||||
if (!pss->spa)
|
||||
return -1;
|
||||
|
@ -1039,7 +1039,7 @@ start_le:
|
|||
/* call to inform no more payload data coming */
|
||||
lws_spa_finalize(pss->spa);
|
||||
|
||||
for (n = 0; n < ARRAY_SIZE(param_names); n++)
|
||||
for (n = 0; n < LWS_ARRAY_SIZE(param_names); n++)
|
||||
if (lws_spa_get_string(pss->spa, n))
|
||||
lwsl_notice(" Param %s: %s\n", param_names[n],
|
||||
lws_spa_get_string(pss->spa, n));
|
||||
|
|
|
@ -482,7 +482,7 @@ init_protocol_lws_mirror(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ init_protocol_lws_raw_test(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ init_protocol_lws_server_status(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -462,7 +462,7 @@ init_protocol_lws_sshd_demo(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ init_protocol_lws_status(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ callback_post_demo(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
/* create the POST argument parser if not already existing */
|
||||
if (!pss->spa) {
|
||||
pss->spa = lws_spa_create(wsi, param_names,
|
||||
ARRAY_SIZE(param_names), 1024,
|
||||
LWS_ARRAY_SIZE(param_names), 1024,
|
||||
file_upload_cb, pss);
|
||||
if (!pss->spa)
|
||||
return -1;
|
||||
|
@ -151,7 +151,7 @@ callback_post_demo(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
"<html><body><h1>Form results (after urldecoding)</h1>"
|
||||
"<table><tr><td>Name</td><td>Length</td><td>Value</td></tr>");
|
||||
|
||||
for (n = 0; n < (int)ARRAY_SIZE(param_names); n++) {
|
||||
for (n = 0; n < (int)LWS_ARRAY_SIZE(param_names); n++) {
|
||||
if (!lws_spa_get_string(pss->spa, n))
|
||||
p += lws_snprintf((char *)p, end - p,
|
||||
"<tr><td><b>%s</b></td><td>0</td><td>NULL</td></tr>",
|
||||
|
@ -260,7 +260,7 @@ init_protocol_post_demo(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols;
|
||||
c->count_protocols = ARRAY_SIZE(protocols);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -2588,7 +2588,7 @@ init_protocol_lws_ssh_base(struct lws_context *context,
|
|||
}
|
||||
|
||||
c->protocols = protocols_sshd;
|
||||
c->count_protocols = ARRAY_SIZE(protocols_sshd);
|
||||
c->count_protocols = LWS_ARRAY_SIZE(protocols_sshd);
|
||||
c->extensions = NULL;
|
||||
c->count_extensions = 0;
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ callback_dumb_increment(struct lws *wsi, enum lws_callback_reasons reason,
|
|||
wsi_mirror = NULL;
|
||||
}
|
||||
|
||||
for (n = 0; n < (int)ARRAY_SIZE(wsi_multi); n++)
|
||||
for (n = 0; n < (int)LWS_ARRAY_SIZE(wsi_multi); n++)
|
||||
if (wsi == wsi_multi[n]) {
|
||||
sprintf(which_wsi, "multi %d", n);
|
||||
which = which_wsi;
|
||||
|
@ -786,7 +786,7 @@ int main(int argc, char **argv)
|
|||
while (!force_exit) {
|
||||
|
||||
if (do_multi) {
|
||||
for (n = 0; n < (int)ARRAY_SIZE(wsi_multi); n++) {
|
||||
for (n = 0; n < (int)LWS_ARRAY_SIZE(wsi_multi); n++) {
|
||||
if (!wsi_multi[n] && ratelimit_connects(&rl_multi[n], 2u)) {
|
||||
lwsl_notice("dumb %d: connecting\n", n);
|
||||
i.protocol = protocols[PROTOCOL_DUMB_INCREMENT].name;
|
||||
|
|
|
@ -92,7 +92,7 @@ main(int argc, char *argv[])
|
|||
lwsl_notice("libwebsockets-test-lejp (C) 2017 - 2018 andy@warmcat.com\n");
|
||||
lwsl_notice(" usage: cat my.json | libwebsockets-test-lejp\n\n");
|
||||
|
||||
lejp_construct(&ctx, cb, NULL, tok, ARRAY_SIZE(tok));
|
||||
lejp_construct(&ctx, cb, NULL, tok, LWS_ARRAY_SIZE(tok));
|
||||
|
||||
fd = 0;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue