You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-cvs@httpd.apache.org by jo...@apache.org on 2005/01/23 22:02:57 UTC
svn commit: r126241 - in httpd/apreq/branches/multi-env-unstable: . env env/c-modules/apreq_access_test env/c-modules/apreq_big_request_test env/c-modules/apreq_cookie_test env/c-modules/apreq_output_filter_test env/c-modules/apreq_redirect_test env/c-modules/apreq_request_test src t
Author: joes
Date: Sun Jan 23 13:02:55 2005
New Revision: 126241
URL: http://svn.apache.org/viewcvs?view=rev&rev=126241
Log:
New gcc warning flags and associated fixes.
Submitted by: Max Kellermann
Reviewed by: joes
Modified:
httpd/apreq/branches/multi-env-unstable/acinclude.m4
httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_access_test/mod_apreq_access_test.c
httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_big_request_test/mod_apreq_big_request_test.c
httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_cookie_test/mod_apreq_cookie_test.c
httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_output_filter_test/mod_apreq_output_filter_test.c
httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_redirect_test/mod_apreq_redirect_test.c
httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_request_test/mod_apreq_request_test.c
httpd/apreq/branches/multi-env-unstable/env/mod_apreq.c
httpd/apreq/branches/multi-env-unstable/src/apreq.c
httpd/apreq/branches/multi-env-unstable/src/apreq.h
httpd/apreq/branches/multi-env-unstable/src/apreq_cookie.c
httpd/apreq/branches/multi-env-unstable/src/apreq_env.c
httpd/apreq/branches/multi-env-unstable/src/apreq_params.c
httpd/apreq/branches/multi-env-unstable/src/apreq_params.h
httpd/apreq/branches/multi-env-unstable/src/apreq_parsers.c
httpd/apreq/branches/multi-env-unstable/t/CuTest.c
httpd/apreq/branches/multi-env-unstable/t/CuTest.h
httpd/apreq/branches/multi-env-unstable/t/cookie.c
httpd/apreq/branches/multi-env-unstable/t/params.c
httpd/apreq/branches/multi-env-unstable/t/parsers.c
httpd/apreq/branches/multi-env-unstable/t/performance.c
httpd/apreq/branches/multi-env-unstable/t/tables.c
httpd/apreq/branches/multi-env-unstable/t/testall.c
Modified: httpd/apreq/branches/multi-env-unstable/acinclude.m4
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/acinclude.m4?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/acinclude.m4&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/acinclude.m4&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/acinclude.m4 (original)
+++ httpd/apreq/branches/multi-env-unstable/acinclude.m4 Sun Jan 23 13:02:55 2005
@@ -142,7 +142,12 @@
fi
if test "x$USE_MAINTAINER_MODE" != "xno"; then
- CPPFLAGS="$CPPFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Werror"
+ CPPFLAGS="$CPPFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations"
+ # -Werror temporarily removed until the next patch is applied
+ if test "$GCC" = "yes"; then
+ CPPFLAGS="$CPPFLAGS -Wwrite-strings -Wcast-qual -Wfloat-equal -Wshadow -Wpointer-arith -Wbad-function-cast -Wsign-compare -Waggregate-return -Wmissing-noreturn -Wmissing-format-attribute -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wdisabled-optimization -Wno-long-long -Wendif-labels -Wcast-align -Wpacked"
+ # -Wdeclaration-after-statement is only supported on gcc 3.4+
+ fi
fi
if test "x$CPPFLAGS" = "x"; then
Modified: httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_access_test/mod_apreq_access_test.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_access_test/mod_apreq_access_test.c?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_access_test/mod_apreq_access_test.c&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_access_test/mod_apreq_access_test.c&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_access_test/mod_apreq_access_test.c (original)
+++ httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_access_test/mod_apreq_access_test.c Sun Jan 23 13:02:55 2005
@@ -14,6 +14,7 @@
** limitations under the License.
*/
+#ifdef CONFIG_FOR_HTTPD_TEST
#if CONFIG_FOR_HTTPD_TEST
<Location /apreq_access_test>
@@ -22,6 +23,7 @@
</Location>
#endif
+#endif
#define APACHE_HTTPD_TEST_ACCESS_CHECKER apreq_access_checker
#define APACHE_HTTPD_TEST_COMMANDS access_cmds
@@ -33,7 +35,7 @@
#include "httpd.h"
#include "apr_strings.h"
-module AP_MODULE_DECLARE_DATA apreq_access_test_module;
+extern module AP_MODULE_DECLARE_DATA apreq_access_test_module;
struct access_test_cfg {
apr_pool_t *pool;
@@ -50,7 +52,7 @@
static const command_rec access_cmds[] =
{
AP_INIT_TAKE1("TestAccess", access_config, NULL, OR_LIMIT, "'param'"),
- {NULL}
+ { .name = NULL }
};
static void *create_access_config(apr_pool_t *p, char *dummy)
Modified: httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_big_request_test/mod_apreq_big_request_test.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_big_request_test/mod_apreq_big_request_test.c?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_big_request_test/mod_apreq_big_request_test.c&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_big_request_test/mod_apreq_big_request_test.c&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_big_request_test/mod_apreq_big_request_test.c (original)
+++ httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_big_request_test/mod_apreq_big_request_test.c Sun Jan 23 13:02:55 2005
@@ -14,12 +14,14 @@
** limitations under the License.
*/
+#ifdef CONFIG_FOR_HTTPD_TEST
#if CONFIG_FOR_HTTPD_TEST
<Location /apreq_big_request_test>
SetHandler apreq_big_request_test
</Location>
+#endif
#endif
#define APACHE_HTTPD_TEST_HANDLER apreq_big_request_test_handler
Modified: httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_cookie_test/mod_apreq_cookie_test.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_cookie_test/mod_apreq_cookie_test.c?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_cookie_test/mod_apreq_cookie_test.c&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_cookie_test/mod_apreq_cookie_test.c&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_cookie_test/mod_apreq_cookie_test.c (original)
+++ httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_cookie_test/mod_apreq_cookie_test.c Sun Jan 23 13:02:55 2005
@@ -14,12 +14,14 @@
** limitations under the License.
*/
+#ifdef CONFIG_FOR_HTTPD_TEST
#if CONFIG_FOR_HTTPD_TEST
<Location /apreq_cookie_test>
SetHandler apreq_cookie_test
</Location>
+#endif
#endif
#define APACHE_HTTPD_TEST_HANDLER apreq_cookie_test_handler
Modified: httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_output_filter_test/mod_apreq_output_filter_test.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_output_filter_test/mod_apreq_output_filter_test.c?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_output_filter_test/mod_apreq_output_filter_test.c&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_output_filter_test/mod_apreq_output_filter_test.c&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_output_filter_test/mod_apreq_output_filter_test.c (original)
+++ httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_output_filter_test/mod_apreq_output_filter_test.c Sun Jan 23 13:02:55 2005
@@ -14,12 +14,14 @@
** limitations under the License.
*/
+#ifdef CONFIG_FOR_HTTPD_TEST
#if CONFIG_FOR_HTTPD_TEST
<Location />
AddOutputFilter APREQ_OUTPUT_FILTER html
</Location>
+#endif
#endif
#include "apache_httpd_test.h"
Modified: httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_redirect_test/mod_apreq_redirect_test.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_redirect_test/mod_apreq_redirect_test.c?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_redirect_test/mod_apreq_redirect_test.c&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_redirect_test/mod_apreq_redirect_test.c&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_redirect_test/mod_apreq_redirect_test.c (original)
+++ httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_redirect_test/mod_apreq_redirect_test.c Sun Jan 23 13:02:55 2005
@@ -14,6 +14,7 @@
** limitations under the License.
*/
+#ifdef CONFIG_FOR_HTTPD_TEST
#if CONFIG_FOR_HTTPD_TEST
<Location /apreq_redirect_test>
@@ -21,6 +22,7 @@
SetHandler apreq_redirect_test
</Location>
+#endif
#endif
#define APACHE_HTTPD_TEST_HANDLER apreq_redirect_test_handler
Modified: httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_request_test/mod_apreq_request_test.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_request_test/mod_apreq_request_test.c?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_request_test/mod_apreq_request_test.c&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_request_test/mod_apreq_request_test.c&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_request_test/mod_apreq_request_test.c (original)
+++ httpd/apreq/branches/multi-env-unstable/env/c-modules/apreq_request_test/mod_apreq_request_test.c Sun Jan 23 13:02:55 2005
@@ -14,6 +14,7 @@
** limitations under the License.
*/
+#ifdef CONFIG_FOR_HTTPD_TEST
#if CONFIG_FOR_HTTPD_TEST
<Location /apreq_request_test>
@@ -21,6 +22,7 @@
SetHandler apreq_request_test
</Location>
+#endif
#endif
#define APACHE_HTTPD_TEST_HANDLER apreq_request_test_handler
Modified: httpd/apreq/branches/multi-env-unstable/env/mod_apreq.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/env/mod_apreq.c?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/env/mod_apreq.c&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/env/mod_apreq.c&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/env/mod_apreq.c (original)
+++ httpd/apreq/branches/multi-env-unstable/env/mod_apreq.c Sun Jan 23 13:02:55 2005
@@ -78,7 +78,7 @@
};
static const char filter_name[] = "APREQ";
-module AP_MODULE_DECLARE_DATA apreq_module;
+extern module AP_MODULE_DECLARE_DATA apreq_module;
/**
* @defgroup mod_apreq Apache 2.X Filter Module
@@ -783,7 +783,7 @@
"Maximum amount of data that will be fed into a parser."),
AP_INIT_TAKE1("APREQ_MaxBrigade", apreq_set_max_brigade, NULL, OR_ALL,
"Maximum in-memory bytes a brigade may use."),
- {NULL}
+ { .name = NULL }
};
/** @} */
Modified: httpd/apreq/branches/multi-env-unstable/src/apreq.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/src/apreq.c?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/src/apreq.c&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/src/apreq.c&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/src/apreq.c (original)
+++ httpd/apreq/branches/multi-env-unstable/src/apreq.c Sun Jan 23 13:02:55 2005
@@ -30,6 +30,8 @@
const apr_size_t vlen)
{
apreq_value_t *v = apr_palloc(p, vlen + nlen + 1 + sizeof *v);
+ char *writable_name;
+
if (v == NULL)
return NULL;
@@ -37,9 +39,9 @@
memcpy(v->data, val, vlen);
v->data[vlen] = 0;
- v->name = v->data + vlen + 1;
- memcpy((char *)v->name, name, nlen);
- ((char *)v->name)[nlen] = 0;
+ v->name = writable_name = v->data + vlen + 1;
+ memcpy(writable_name, name, nlen);
+ writable_name[nlen] = 0;
v->flags = 0;
return v;
@@ -67,8 +69,7 @@
const apr_array_header_t *arr)
{
apreq_value_t *a = *(apreq_value_t **)(arr->elts);
- apreq_value_t *v = apreq_char_to_value(
- apreq_join(p, ", ", arr, APREQ_JOIN_AS_IS) );
+ apreq_value_t *v = apreq_char_to_value(apreq_deconst(apreq_join(p, ", ", arr, APREQ_JOIN_AS_IS)));
if (arr->nelts > 0)
v->name = a->name;
return v;
@@ -380,13 +381,13 @@
return -1;
if (s == (const char *)d) { /* optimize for src = dest case */
- for ( ; s < end; ++s) {
- if (*s == '%' || *s == '+')
+ for ( ; d < end; ++d) {
+ if (*d == '%' || *d == '+')
break;
- else if (*s == 0)
- return s - (const char *)d;
+ else if (*d == 0)
+ return (const char*)d - s;
}
- d = (char *)s;
+ s = (const char *)d;
}
switch (url_decode(d, &dlen, s, &slen)) {
Modified: httpd/apreq/branches/multi-env-unstable/src/apreq.h
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/src/apreq.h?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/src/apreq.h&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/src/apreq.h&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/src/apreq.h (original)
+++ httpd/apreq/branches/multi-env-unstable/src/apreq.h Sun Jan 23 13:02:55 2005
@@ -86,7 +86,20 @@
*/
#define apreq_char_to_value(ptr) apreq_attr_to_type(apreq_value_t, data, ptr)
-#define apreq_strtoval(ptr) apreq_char_to_value(ptr)
+
+/** convert a const pointer into a non-const. WARNING: this is
+ dangerous. Use only if you really know what you're doing. Only for
+ Dirty Hacks (TM) */
+static APR_INLINE void *apreq_deconst(const void *p) {
+ /* go around the gcc warning */
+ /* FIXME: does this work on all platforms? */
+ long v = (long)p;
+ return (void*)v;
+}
+
+static APR_INLINE apreq_value_t *apreq_strtoval(const char *name) {
+ return (apreq_value_t*)apreq_char_to_value(apreq_deconst(name));
+}
/**
* Computes the length of the string, but unlike strlen(),
@@ -365,14 +378,14 @@
* @param p Setaside buckets into this pool.
*/
-#define APREQ_BRIGADE_SETASIDE(bb,p) do { \
- apr_bucket *e; \
- for (e = APR_BRIGADE_FIRST(bb); e != APR_BRIGADE_SENTINEL(bb); \
- e = APR_BUCKET_NEXT(e)) \
- { \
- apr_bucket_setaside(e, p); \
- } \
-} while (0)
+static APR_INLINE void APREQ_BRIGADE_SETASIDE(apr_bucket_brigade *bb, apr_pool_t *p) {
+ apr_bucket *e;
+ for (e = APR_BRIGADE_FIRST(bb); e != APR_BRIGADE_SENTINEL(bb);
+ e = APR_BUCKET_NEXT(e))
+ {
+ apr_bucket_setaside(e, p);
+ }
+}
/**
Modified: httpd/apreq/branches/multi-env-unstable/src/apreq_cookie.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/src/apreq_cookie.c?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/src/apreq_cookie.c&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/src/apreq_cookie.c&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/src/apreq_cookie.c (original)
+++ httpd/apreq/branches/multi-env-unstable/src/apreq_cookie.c Sun Jan 23 13:02:55 2005
@@ -30,7 +30,7 @@
const char *val = apr_table_get(jar->cookies, name);
if (val == NULL)
return NULL;
- return apreq_value_to_cookie(apreq_char_to_value(val));
+ return apreq_value_to_cookie(apreq_char_to_value(apreq_deconst(val)));
}
APREQ_DECLARE(void) apreq_jar_add(apreq_jar_t *jar,
@@ -61,8 +61,7 @@
static int has_rfc_cookie(void *ctx, const char *key, const char *val)
{
- const apreq_cookie_t *c = apreq_value_to_cookie(
- apreq_char_to_value(val));
+ const apreq_cookie_t *c = apreq_value_to_cookie(apreq_char_to_value(apreq_deconst(val)));
return c->version == NETSCAPE; /* 0 -> non-netscape cookie found, stop.
1 -> not found, keep going. */
Modified: httpd/apreq/branches/multi-env-unstable/src/apreq_env.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/src/apreq_env.c?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/src/apreq_env.c&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/src/apreq_env.c&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/src/apreq_env.c (original)
+++ httpd/apreq/branches/multi-env-unstable/src/apreq_env.c Sun Jan 23 13:02:55 2005
@@ -22,7 +22,7 @@
#include "apr_file_io.h"
-static const apreq_env_t *apreq_env;
+extern const apreq_env_t *apreq_env;
extern void apreq_parser_initialize(void);
@@ -221,7 +221,6 @@
static apreq_jar_t *cgi_jar(void *env, apreq_jar_t *jar)
{
-
if (jar != NULL) {
apreq_jar_t *old_jar = ctx.jar;
ctx.jar = jar;
@@ -245,7 +244,7 @@
typedef struct {
- char *t_name;
+ const char *t_name;
int t_val;
} TRANS;
@@ -268,7 +267,8 @@
{
dP;
char buf[256];
- char *log_level_string, *remote_addr;
+ char *log_level_string, *ra;
+ const char *remote_addr;
unsigned log_level = APREQ_LOG_WARNING;
char date[APR_CTIME_LEN];
#ifndef WIN32
@@ -281,10 +281,12 @@
level &= APREQ_LOG_LEVELMASK;
- if (level > log_level)
+ if (level > (int)log_level)
return;
- if (apr_env_get(&remote_addr, "REMOTE_ADDR", p) != APR_SUCCESS)
+ if (apr_env_get(&ra, "REMOTE_ADDR", p) == APR_SUCCESS)
+ remote_addr = ra;
+ else
remote_addr = "address unavailable";
apr_ctime(date, apr_time_now());
@@ -448,6 +450,6 @@
static APREQ_ENV_MODULE(cgi, APREQ_MODULE_NAME,
APREQ_MODULE_MAGIC_NUMBER);
-static const apreq_env_t *apreq_env = &cgi_module;
+const apreq_env_t *apreq_env = &cgi_module;
/** @} */
Modified: httpd/apreq/branches/multi-env-unstable/src/apreq_params.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/src/apreq_params.c?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/src/apreq_params.c&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/src/apreq_params.c&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/src/apreq_params.c (original)
+++ httpd/apreq/branches/multi-env-unstable/src/apreq_params.c Sun Jan 23 13:02:55 2005
@@ -31,15 +31,17 @@
{
apreq_param_t *param = apr_palloc(p, nlen + vlen + 1 + sizeof *param);
apreq_value_t *v = ¶m->v;
+ char *writable_name;
param->info = NULL;
param->bb = NULL;
v->size = vlen;
memcpy(v->data, val, vlen);
v->data[vlen] = 0;
- v->name = v->data + vlen + 1;
- memcpy((char *)v->name, name, nlen);
- ((char *)v->name)[nlen] = 0;
+ writable_name = v->data + vlen + 1;
+ memcpy(writable_name, name, nlen);
+ writable_name[nlen] = 0;
+ v->name = writable_name;
return param;
}
Modified: httpd/apreq/branches/multi-env-unstable/src/apreq_params.h
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/src/apreq_params.h?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/src/apreq_params.h&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/src/apreq_params.h&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/src/apreq_params.h (original)
+++ httpd/apreq/branches/multi-env-unstable/src/apreq_params.h Sun Jan 23 13:02:55 2005
@@ -229,6 +229,9 @@
apreq_param_t *param, \
apr_bucket_brigade *bb
+typedef apr_status_t (*apreq_parser_function_t)(APREQ_PARSER_ARGS);
+typedef apr_status_t (*apreq_hook_function_t)(APREQ_HOOK_ARGS);
+
/**
* Declares a API parser.
*/
@@ -246,7 +249,7 @@
*
*/
struct apreq_hook_t {
- apr_status_t (*hook) (APREQ_HOOK_ARGS);
+ apreq_hook_function_t hook;
apreq_hook_t *next;
void *ctx;
};
@@ -256,7 +259,7 @@
*
*/
struct apreq_parser_t {
- apr_status_t (*parser) (APREQ_PARSER_ARGS);
+ apreq_parser_function_t parser;
const char *enctype;
apreq_hook_t *hook;
void *ctx;
@@ -352,7 +355,7 @@
APREQ_DECLARE(apreq_parser_t *)
apreq_make_parser(apr_pool_t *pool,
const char *enctype,
- apr_status_t (*parser) (APREQ_PARSER_ARGS),
+ apreq_parser_function_t parser,
apreq_hook_t *hook,
void *ctx);
@@ -367,7 +370,7 @@
*/
APREQ_DECLARE(apreq_hook_t *)
apreq_make_hook(apr_pool_t *pool,
- apr_status_t (*hook) (APREQ_HOOK_ARGS),
+ apreq_hook_function_t hook,
apreq_hook_t *next,
void *ctx);
@@ -413,7 +416,7 @@
*/
APREQ_DECLARE(void) apreq_register_parser(const char *enctype,
- apr_status_t (*parser) (APREQ_PARSER_ARGS));
+ apreq_parser_function_t parser);
/**
Modified: httpd/apreq/branches/multi-env-unstable/src/apreq_parsers.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/src/apreq_parsers.c?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/src/apreq_parsers.c&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/src/apreq_parsers.c&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/src/apreq_parsers.c (original)
+++ httpd/apreq/branches/multi-env-unstable/src/apreq_parsers.c Sun Jan 23 13:02:55 2005
@@ -48,7 +48,7 @@
APREQ_DECLARE(apreq_parser_t *)
apreq_make_parser(apr_pool_t *pool,
const char *enctype,
- apr_status_t (*parser) (APREQ_PARSER_ARGS),
+ apreq_parser_function_t parser,
apreq_hook_t *hook,
void *ctx)
{
@@ -62,7 +62,7 @@
APREQ_DECLARE(apreq_hook_t *)
apreq_make_hook(apr_pool_t *pool,
- apr_status_t (*hook) (APREQ_HOOK_ARGS),
+ apreq_hook_function_t hook,
apreq_hook_t *next,
void *ctx)
{
@@ -103,9 +103,9 @@
}
APREQ_DECLARE(void) apreq_register_parser(const char *enctype,
- apr_status_t (*parser) (APREQ_PARSER_ARGS))
+ apreq_parser_function_t parser)
{
- apr_status_t (**f) (APREQ_PARSER_ARGS) = NULL;
+ apreq_parser_function_t *f = NULL;
apreq_parser_initialize();
if (parser != NULL) {
f = apr_palloc(default_parser_pool, sizeof *f);
@@ -118,7 +118,7 @@
APREQ_DECLARE(apreq_parser_t *)apreq_parser(void *env, apreq_hook_t *hook)
{
- apr_status_t (**f) (APREQ_PARSER_ARGS);
+ apreq_parser_function_t *f;
apr_pool_t *pool = apreq_env_pool(env);
const char *type = apreq_env_content_type(env);
apr_ssize_t tlen;
@@ -154,6 +154,7 @@
apr_status_t s;
struct iovec vec[APREQ_NELTS];
apr_array_header_t arr;
+ char *writable_name;
arr.pool = pool;
arr.elt_size = sizeof(struct iovec);
@@ -164,7 +165,7 @@
param->bb = NULL;
param->info = NULL;
- v->name = v->data + vlen + 1;
+ v->name = writable_name = v->data + vlen + 1;
apr_brigade_partition(bb, nlen+1, &end);
@@ -177,13 +178,13 @@
return s;
iov = apr_array_push(&arr);
- iov->iov_base = (char *)data;
+ iov->iov_base = apreq_deconst(data);
iov->iov_len = dlen;
}
((struct iovec *)arr.elts)[arr.nelts - 1].iov_len--; /* drop '=' sign */
- s = apreq_decodev((char *)v->name, &v->size,
+ s = apreq_decodev(writable_name, &v->size,
(struct iovec *)arr.elts, arr.nelts);
if (s != APR_SUCCESS)
return s;
@@ -197,14 +198,14 @@
for (e = APR_BRIGADE_FIRST(bb); e != end; e = APR_BUCKET_NEXT(e)) {
apr_size_t dlen;
const char *data;
- struct iovec *vec;
+ struct iovec *iov;
s = apr_bucket_read(e, &data, &dlen, APR_BLOCK_READ);
if (s != APR_SUCCESS)
return s;
- vec = apr_array_push(&arr);
- vec->iov_base = (char *)data;
- vec->iov_len = dlen;
+ iov = apr_array_push(&arr);
+ iov->iov_base = apreq_deconst(data);
+ iov->iov_len = dlen;
}
if (end != APR_BRIGADE_SENTINEL(bb))
@@ -331,9 +332,10 @@
{
apr_pool_t *pool = apr_table_elts(t)->pool;
apreq_value_t *v = apr_palloc(pool, nlen + vlen + sizeof *v);
+ char *writable_name;
apr_size_t off;
- v->name = v->data + vlen;
+ v->name = writable_name = v->data + vlen;
/* copy name */
@@ -352,7 +354,7 @@
dlen = nlen - off;
}
- memcpy((char *)v->name + off, data, dlen);
+ memcpy(writable_name + off, data, dlen);
off += dlen;
apr_bucket_delete(f);
}
@@ -400,7 +402,7 @@
apr_bucket_delete(f);
}
- ((char *)v->name)[nlen] = 0;
+ writable_name[nlen] = 0;
/* remove trailing (CR)LF from value */
v->size = vlen - 1;
Modified: httpd/apreq/branches/multi-env-unstable/t/CuTest.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/t/CuTest.c?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/t/CuTest.c&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/t/CuTest.c&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/t/CuTest.c (original)
+++ httpd/apreq/branches/multi-env-unstable/t/CuTest.c Sun Jan 23 13:02:55 2005
@@ -135,7 +135,7 @@
* CuTest
*-------------------------------------------------------------------------*/
-void CuTestInit(CuTest* t, char* name, TestFunction function)
+void CuTestInit(CuTest* t, const char* name, TestFunction function)
{
t->name = CuStrCopy(name);
t->notimpl = 0;
@@ -146,7 +146,7 @@
t->jumpBuf = NULL;
}
-CuTest* CuTestNew(char* name, TestFunction function)
+CuTest* CuTestNew(const char* name, TestFunction function)
{
CuTest* tc = CU_ALLOC(CuTest);
CuTestInit(tc, name, function);
@@ -249,7 +249,7 @@
* CuSuite
*-------------------------------------------------------------------------*/
-void CuSuiteInit(CuSuite* testSuite, char *name)
+void CuSuiteInit(CuSuite* testSuite, const char *name)
{
testSuite->name = strdup(name);
testSuite->count = 0;
@@ -257,7 +257,7 @@
testSuite->notimplCount = 0;
}
-CuSuite* CuSuiteNew(char *name)
+CuSuite* CuSuiteNew(const char *name)
{
CuSuite* testSuite = CU_ALLOC(CuSuite);
CuSuiteInit(testSuite, name);
@@ -355,7 +355,7 @@
* CuSuiteList
*-------------------------------------------------------------------------*/
-CuSuiteList* CuSuiteListNew(char *name)
+CuSuiteList* CuSuiteListNew(const char *name)
{
CuSuiteList* testSuite = CU_ALLOC(CuSuiteList);
testSuite->name = strdup(name);
Modified: httpd/apreq/branches/multi-env-unstable/t/CuTest.h
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/t/CuTest.h?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/t/CuTest.h&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/t/CuTest.h&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/t/CuTest.h (original)
+++ httpd/apreq/branches/multi-env-unstable/t/CuTest.h Sun Jan 23 13:02:55 2005
@@ -58,7 +58,11 @@
void CuStringRead(CuString* str, char* path);
void CuStringAppend(CuString* str, const char* text);
void CuStringAppendChar(CuString* str, char ch);
-void CuStringAppendFormat(CuString* str, const char* format, ...);
+void CuStringAppendFormat(CuString* str, const char* format, ...)
+#ifdef __GNUC__
+ __attribute__((format(printf,2,3)))
+#endif
+ ;
void CuStringResize(CuString* str, int newSize);
/* CuTest */
@@ -79,8 +83,8 @@
};
void CuInit(int argc, char *argv[]);
-void CuTestInit(CuTest* t, char* name, TestFunction function);
-CuTest* CuTestNew(char* name, TestFunction function);
+void CuTestInit(CuTest* t, const char* name, TestFunction function);
+CuTest* CuTestNew(const char* name, TestFunction function);
void CuFail(CuTest* tc, const char* message);
void CuNotImpl(CuTest* tc, const char* message);
void CuAssert(CuTest* tc, const char* message, int condition);
@@ -111,8 +115,8 @@
} CuSuite;
-void CuSuiteInit(CuSuite* testSuite, char* name);
-CuSuite* CuSuiteNew(char* name);
+void CuSuiteInit(CuSuite* testSuite, const char* name);
+CuSuite* CuSuiteNew(const char* name);
void CuSuiteAdd(CuSuite* testSuite, CuTest *testCase);
void CuSuiteAddSuite(CuSuite* testSuite, CuSuite* testSuite2);
void CuSuiteRun(CuSuite* testSuite);
@@ -128,7 +132,7 @@
} CuSuiteList;
-CuSuiteList* CuSuiteListNew(char* name);
+CuSuiteList* CuSuiteListNew(const char* name);
void CuSuiteListAdd(CuSuiteList* testSuite, CuSuite *testCase);
void CuSuiteListRun(CuSuiteList* testSuite);
void CuSuiteListRunWithSummary(CuSuiteList* testSuite);
Modified: httpd/apreq/branches/multi-env-unstable/t/cookie.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/t/cookie.c?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/t/cookie.c&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/t/cookie.c&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/t/cookie.c (original)
+++ httpd/apreq/branches/multi-env-unstable/t/cookie.c Sun Jan 23 13:02:55 2005
@@ -15,10 +15,10 @@
*/
#include "apreq_env.h"
-#include "test_apreq.h"
#include "apreq.h"
#include "apreq_cookie.h"
#include "apr_strings.h"
+#include "test_apreq.h"
static apreq_jar_t *j = NULL;
@@ -112,10 +112,11 @@
static void ua_version(CuTest *tc)
{
apreq_cookie_version_t v;
+ char version[] = "$Version=\"1\"";
v = apreq_ua_cookie_version(NULL);
CuAssertIntEquals(tc, APREQ_COOKIE_VERSION_NETSCAPE, v);
- v = apreq_ua_cookie_version("$Version=\"1\"");
+ v = apreq_ua_cookie_version(version);
CuAssertIntEquals(tc, APREQ_COOKIE_VERSION_RFC, v);
}
Modified: httpd/apreq/branches/multi-env-unstable/t/params.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/t/params.c?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/t/params.c&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/t/params.c&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/t/params.c (original)
+++ httpd/apreq/branches/multi-env-unstable/t/params.c Sun Jan 23 13:02:55 2005
@@ -15,10 +15,10 @@
*/
#include "apreq_env.h"
-#include "test_apreq.h"
#include "apreq.h"
#include "apreq_params.h"
#include "apr_strings.h"
+#include "test_apreq.h"
static apreq_request_t *r = NULL;
@@ -177,10 +177,10 @@
apr_size_t exp_len, res_len, res_quote_len;
char *res = apr_palloc(p,24);
char *res_quote = apr_palloc(p,24);
- char *exp = apr_palloc(p,24);
+ const char *exp = apr_palloc(p,24);
int i;
- char * arr[] = {"cest", "\"cest", "ce\"st", "\"cest\""};
- char * arr_quote[] =
+ const char * arr[] = {"cest", "\"cest", "ce\"st", "\"cest\""};
+ const char * arr_quote[] =
{"\"cest\"", "\"\\\"cest\"", "\"ce\\\"st\"", "\"\\\"cest\\\"\""};
apr_size_t arr_len[] = {4, 5, 5, 6};
apr_size_t arr_quote_len[] = {6, 8, 8, 10};
Modified: httpd/apreq/branches/multi-env-unstable/t/parsers.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/t/parsers.c?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/t/parsers.c&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/t/parsers.c&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/t/parsers.c (original)
+++ httpd/apreq/branches/multi-env-unstable/t/parsers.c Sun Jan 23 13:02:55 2005
@@ -15,11 +15,11 @@
*/
#include "apreq_env.h"
-#include "test_apreq.h"
#include "apreq.h"
#include "apreq_params.h"
#include "apr_strings.h"
#include "apr_xml.h"
+#include "test_apreq.h"
#define CRLF "\015\012"
@@ -99,7 +99,6 @@
"--AaB03x--" CRLF;
-extern apr_bucket_brigade *bb;
extern apr_table_t *table;
static void locate_default_parsers(CuTest *tc)
@@ -138,6 +137,7 @@
apreq_request_t *req = apreq_request(APREQ_URL_ENCTYPE,"");
apr_status_t rv;
const char *enctype;
+ apr_bucket_brigade *bb;
CuAssertPtrNotNull(tc, req);
enctype = apreq_enctype(req->env);
@@ -195,6 +195,7 @@
for (i = 0; i <= strlen(form_data); ++i) {
const char *val;
+ char *val2;
apr_size_t len;
apr_table_t *t;
@@ -236,9 +237,9 @@
CuAssertStrEquals(tc, "file1.txt", val);
t = apreq_value_to_param(apreq_strtoval(val))->info;
bb = apreq_value_to_param(apreq_strtoval(val))->bb;
- apr_brigade_pflatten(bb, (char **)&val, &len, p);
+ apr_brigade_pflatten(bb, &val2, &len, p);
CuAssertIntEquals(tc,strlen("... contents of file1.txt ..." CRLF), len);
- CuAssertStrNEquals(tc,"... contents of file1.txt ..." CRLF, val, len);
+ CuAssertStrNEquals(tc,"... contents of file1.txt ..." CRLF, val2, len);
val = apr_table_get(t, "content-type");
CuAssertStrEquals(tc, "text/plain", val);
apr_brigade_cleanup(bb);
@@ -288,7 +289,7 @@
static void parse_generic(CuTest *tc)
{
- const char *val;
+ char *val;
apr_size_t vlen;
apr_status_t rv;
apreq_param_t *dummy;
@@ -310,7 +311,7 @@
CuAssertIntEquals(tc, APR_SUCCESS, rv);
dummy = *(apreq_param_t **)req->parser->ctx;
CuAssertPtrNotNull(tc, dummy);
- apr_brigade_pflatten(dummy->bb, (char **)&val, &vlen, p);
+ apr_brigade_pflatten(dummy->bb, &val, &vlen, p);
CuAssertIntEquals(tc, strlen(xml_data), vlen);
CuAssertStrNEquals(tc, xml_data, val, vlen);
@@ -353,6 +354,7 @@
char data[] = "...Binary data here...";
int dlen = strlen(data);
const char *val;
+ char *val2;
apr_size_t vlen;
apr_status_t rv;
int ns_map = 0;
@@ -384,9 +386,9 @@
val = apr_table_get(param->info, "Content-Length");
CuAssertStrEquals(tc, "400", val);
CuAssertPtrNotNull(tc, param->bb);
- apr_brigade_pflatten(param->bb, (char **)&val, &vlen, p);
+ apr_brigade_pflatten(param->bb, &val2, &vlen, p);
CuAssertIntEquals(tc, 400, vlen);
- CuAssertStrNEquals(tc,rel_data + 122, val, 400);
+ CuAssertStrNEquals(tc,rel_data + 122, val2, 400);
doc = *(apr_xml_doc **)xml_hook->ctx;
apr_xml_to_text(p, doc->root, APR_XML_X2T_FULL,
@@ -397,16 +399,16 @@
param = apreq_param(req, "<98...@example.com>");
CuAssertPtrNotNull(tc, param);
CuAssertPtrNotNull(tc, param->bb);
- apr_brigade_pflatten(param->bb, (char **)&val, &vlen, p);
+ apr_brigade_pflatten(param->bb, &val2, &vlen, p);
CuAssertIntEquals(tc, dlen, vlen);
- CuAssertStrNEquals(tc, data, val, vlen);
+ CuAssertStrNEquals(tc, data, val2, vlen);
param = apreq_param(req, "<98...@example.com>");
CuAssertPtrNotNull(tc, param);
CuAssertPtrNotNull(tc, param->bb);
- apr_brigade_pflatten(param->bb, (char **)&val, &vlen, p);
+ apr_brigade_pflatten(param->bb, &val2, &vlen, p);
CuAssertIntEquals(tc, dlen, vlen);
- CuAssertStrNEquals(tc, data, val, vlen);
+ CuAssertStrNEquals(tc, data, val2, vlen);
}
typedef struct {
@@ -418,6 +420,7 @@
static void parse_mixed(CuTest *tc)
{
const char *val;
+ char *val2;
apr_size_t vlen;
apr_status_t rv;
apreq_param_t *param;
@@ -450,9 +453,9 @@
CuAssertStrEquals(tc, "file1.txt", param->v.data);
CuAssertPtrNotNull(tc, param->bb);
- apr_brigade_pflatten(param->bb, (char **)&val, &vlen, p);
+ apr_brigade_pflatten(param->bb, &val2, &vlen, p);
CuAssertIntEquals(tc, strlen("... contents of file1.txt ..."), vlen);
- CuAssertStrNEquals(tc, "... contents of file1.txt ...", val, vlen);
+ CuAssertStrNEquals(tc, "... contents of file1.txt ...", val2, vlen);
arr = apr_table_elts(req->body);
CuAssertIntEquals(tc, 4, arr->nelts);
@@ -463,9 +466,9 @@
param = apreq_value_to_param(apreq_strtoval(elt->val));
CuAssertPtrNotNull(tc, param->bb);
- apr_brigade_pflatten(param->bb, (char **)&val, &vlen, p);
+ apr_brigade_pflatten(param->bb, &val2, &vlen, p);
CuAssertIntEquals(tc, strlen("...contents of file2.gif..."), vlen);
- CuAssertStrNEquals(tc, "...contents of file2.gif...", val, vlen);
+ CuAssertStrNEquals(tc, "...contents of file2.gif...", val2, vlen);
}
Modified: httpd/apreq/branches/multi-env-unstable/t/performance.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/t/performance.c?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/t/performance.c&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/t/performance.c&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/t/performance.c (original)
+++ httpd/apreq/branches/multi-env-unstable/t/performance.c Sun Jan 23 13:02:55 2005
@@ -17,10 +17,10 @@
#include "apr_time.h"
#include "apr_strings.h"
#include "apreq_env.h"
-#include "test_apreq.h"
#include "apreq.h"
#include "apreq_tables.h"
#include "apr_hash.h"
+#include "test_apreq.h"
#if APR_HAVE_STDIO_H
#include <stdio.h>
#endif
Modified: httpd/apreq/branches/multi-env-unstable/t/tables.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/t/tables.c?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/t/tables.c&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/t/tables.c&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/t/tables.c (original)
+++ httpd/apreq/branches/multi-env-unstable/t/tables.c Sun Jan 23 13:02:55 2005
@@ -15,9 +15,9 @@
*/
#include "apreq_env.h"
-#include "test_apreq.h"
#include "apreq.h"
#include "apreq_tables.h"
+#include "test_apreq.h"
#if APR_HAVE_STDIO_H
#include <stdio.h>
#endif
Modified: httpd/apreq/branches/multi-env-unstable/t/testall.c
Url: http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/t/testall.c?view=diff&rev=126241&p1=httpd/apreq/branches/multi-env-unstable/t/testall.c&r1=126240&p2=httpd/apreq/branches/multi-env-unstable/t/testall.c&r2=126241
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/t/testall.c (original)
+++ httpd/apreq/branches/multi-env-unstable/t/testall.c Sun Jan 23 13:02:55 2005
@@ -17,9 +17,9 @@
#include <stdio.h>
#include <stdlib.h>
-#include "test_apreq.h"
#include "apreq_env.h"
#include "apr_strings.h"
+#include "test_apreq.h"
/* Top-level pool which can be used by tests. */
apr_pool_t *p;
@@ -46,7 +46,7 @@
{"cookies", testcookie},
{"params", testparam},
{"parsers", testparser},
-// {"performance", testperformance},
+ /*{"performance", testperformance},*/
{"LastTest", NULL}
};
@@ -58,7 +58,6 @@
#define CRLF "\015\012"
-apr_bucket_brigade *bb;
apr_table_t *table;
static apr_pool_t *test_pool(void *env)