per vhost options struct explicitly const
authorAndy Green <andy@warmcat.com>
Sun, 1 May 2016 22:01:59 +0000 (06:01 +0800)
committerAndy Green <andy@warmcat.com>
Sun, 1 May 2016 22:01:59 +0000 (06:01 +0800)
Signed-off-by: Andy Green <andy@warmcat.com>
lib/context.c
lib/libwebsockets.c
lib/libwebsockets.h
lib/private-libwebsockets.h
plugins/protocol_lws_server_status.c

index 41b2fba6d569629b10a3e1a29a22410b42034dfe..ae84c1f7c55cb5c0554743859e0c28068d0a22ab 100644 (file)
@@ -92,10 +92,10 @@ lws_protocol_vh_priv_get(struct lws_vhost *vhost, const struct lws_protocols *pr
        return vhost->protocol_vh_privs[n];
 }
 
-static struct lws_protocol_vhost_options *
+static const struct lws_protocol_vhost_options *
 lws_vhost_protocol_options(struct lws_vhost *vh, const char *name)
 {
-       struct lws_protocol_vhost_options *pvo = vh->pvo;
+       const struct lws_protocol_vhost_options *pvo = vh->pvo;
 
        while (pvo) {
                // lwsl_notice("%s: '%s' '%s'\n", __func__, pvo->name, name);
@@ -111,7 +111,7 @@ int
 lws_protocol_init(struct lws_context *context)
 {
        struct lws_vhost *vh = context->vhost_list;
-       struct lws_protocol_vhost_options *pvo;
+       const struct lws_protocol_vhost_options *pvo;
        struct lws wsi;
        int n;
 
@@ -143,7 +143,8 @@ lws_protocol_init(struct lws_context *context)
                         * protocol ptrs so lws_get_context(wsi) etc can work
                         */
                        vh->protocols[n].callback(&wsi,
-                               LWS_CALLBACK_PROTOCOL_INIT, NULL, pvo, 0);
+                               LWS_CALLBACK_PROTOCOL_INIT, NULL,
+                               (void *)pvo, 0);
                }
 
                vh = vh->vhost_next;
index 6f86d1c6bc05ff4b8c923e2b6966bb34943e5a19..b34430bf61459837b395019a27f848d3afbf1348 100644 (file)
@@ -1726,7 +1726,7 @@ lws_create_basic_wsi(struct lws_context *context, int tsi)
 
 LWS_VISIBLE LWS_EXTERN int
 lws_cgi(struct lws *wsi, const char * const *exec_array, int script_uri_path_len,
-       int timeout_secs, struct lws_protocol_vhost_options *mp_cgienv)
+       int timeout_secs, const struct lws_protocol_vhost_options *mp_cgienv)
 {
        struct lws_context_per_thread *pt = &wsi->context->pt[(int)wsi->tsi];
        char *env_array[30], cgi_path[400], e[1024], *p = e,
index 41c4c9065ff495af12cae4ec0374ee2ef8267450..1f6934614dcfd99a9297bfc5934eb572337db054 100644 (file)
@@ -1372,8 +1372,8 @@ lws_set_extension_option(struct lws *wsi, const char *ext_name,
                         const char *opt_name, const char *opt_val);
 
 struct lws_protocol_vhost_options {
-       struct lws_protocol_vhost_options *next;
-       struct lws_protocol_vhost_options *options;
+       const struct lws_protocol_vhost_options *next;
+       const struct lws_protocol_vhost_options *options;
        const char *name;
        const char *value;
 };
@@ -1384,7 +1384,7 @@ struct lws_http_mount {
        const char *origin; /* path to be mounted, eg, "/var/www/warmcat.com" */
        const char *def; /* default target, eg, "index.html" */
 
-       struct lws_protocol_vhost_options *cgienv;
+       const struct lws_protocol_vhost_options *cgienv;
 
        int cgi_timeout;
        int cache_max_age;
@@ -1526,7 +1526,7 @@ struct lws_context_creation_info {
        const char *ecdh_curve;                         /* VH */
        const char *vhost_name;                         /* VH */
        const char *plugins_dir;                        /* context */
-       struct lws_protocol_vhost_options *pvo;         /* VH */
+       const struct lws_protocol_vhost_options *pvo;   /* VH */
        int keepalive_timeout;                          /* VH */
        const char *log_filepath;                       /* VH */
        const struct lws_http_mount *mounts;            /* VH */
@@ -2091,7 +2091,7 @@ struct lws_cgi_args {
 LWS_VISIBLE LWS_EXTERN int
 lws_cgi(struct lws *wsi, const char * const *exec_array,
        int script_uri_path_len, int timeout_secs,
-       struct lws_protocol_vhost_options *mp_cgienv);
+       const struct lws_protocol_vhost_options *mp_cgienv);
 
 LWS_VISIBLE LWS_EXTERN int
 lws_cgi_write_split_stdout_headers(struct lws *wsi);
index 16f435da97c525b390bda93580824981557fc3ee..91f4d7578e69fde5aed24f530c4fe8c88ad243df 100644 (file)
@@ -649,7 +649,7 @@ struct lws_vhost {
        const char *iface;
        const struct lws_protocols *protocols;
        void **protocol_vh_privs;
-       struct lws_protocol_vhost_options *pvo;
+       const struct lws_protocol_vhost_options *pvo;
        struct lws **same_vh_protocol_list;
 #ifdef LWS_OPENSSL_SUPPORT
        SSL_CTX *ssl_ctx;
index b93017454c89be09353f1c77436a6547f37720cb..b41a719a0e1bfe812d65bd625bf67b0d9dec2bee 100644 (file)
@@ -62,8 +62,8 @@ static int
 callback_lws_server_status(struct lws *wsi, enum lws_callback_reasons reason,
                           void *user, void *in, size_t len)
 {
-       struct lws_protocol_vhost_options *pvo =
-                       (struct lws_protocol_vhost_options *)in;
+       const struct lws_protocol_vhost_options *pvo =
+                       (const struct lws_protocol_vhost_options *)in;
        int m, period = 1000;
 
        switch (reason) {