diff options
author | Ralf Corsepius <ralf.corsepius@rtems.org> | 2009-12-02 11:00:17 +0000 |
---|---|---|
committer | Ralf Corsepius <ralf.corsepius@rtems.org> | 2009-12-02 11:00:17 +0000 |
commit | 65c3dca4ba411c190d4ab973ebed5f7b389f4868 (patch) | |
tree | 664a1bfa4fa1bcf4e10380878feb69576afa39cf /cpukit/shttpd | |
parent | 46e483b847082afa01754b6d43eb25fb51063f21 (diff) |
2009-12-02 Ralf Corsépius <ralf.corsepius@rtems.org>
* shttpd/def.h: Shrink default URI_MAX to 32767.
Add special cases for sizeof(size_t) < 2.
Diffstat (limited to 'cpukit/shttpd')
-rw-r--r-- | cpukit/shttpd/defs.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cpukit/shttpd/defs.h b/cpukit/shttpd/defs.h index fef5ecefc4..6956ebe113 100644 --- a/cpukit/shttpd/defs.h +++ b/cpukit/shttpd/defs.h @@ -34,7 +34,27 @@ #define EXPIRE_TIME 3600 /* Expiration time, seconds */ #define ENV_MAX 4096 /* Size of environment block */ #define CGI_ENV_VARS 64 /* Maximum vars passed to CGI */ +#ifdef __rtems__ +#if defined(__SIZEOF_SIZE_T__) && (__SIZEOF_SIZE_T__ <= 2) +/* HACK: Reduce the array size on targets with 16bit size_t */ +# if defined(__AVR__) +/* FIXME: 1500 is sufficient to avoid compilation breakdown. */ +# define URI_MAX (32767-1500) +# elif defined(__M32C__) +/* FIXME: 1500 is sufficient to avoid compilation breakdown. */ +# define URI_MAX (32767-1500) +# else +/* Theoretically, this should work on all targets with 16bit size_t + * In practice, it trips over other compiler limitations. */ +# define URI_MAX 32767 +# endif +#else // __SIZEOF_SIZE_T__ > 2 +/* HACK: 32768 is 1 too much to fit into 16bit array indices. */ +#define URI_MAX 32767 /* Maximum URI size */ +#endif +#else // __rtems__ #define URI_MAX 32768 /* Maximum URI size */ +#endif #define MIN_REQ_LEN 16 /* "GET / HTTP/1.1\n\n" */ #define NELEMS(ar) (sizeof(ar) / sizeof(ar[0])) |