summaryrefslogtreecommitdiffstats
path: root/modules/metadata/mod_mime_magic.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/metadata/mod_mime_magic.c')
-rw-r--r--modules/metadata/mod_mime_magic.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/modules/metadata/mod_mime_magic.c b/modules/metadata/mod_mime_magic.c
index 22dadaf..7dac4fd 100644
--- a/modules/metadata/mod_mime_magic.c
+++ b/modules/metadata/mod_mime_magic.c
@@ -257,7 +257,7 @@ static int fsmagic(request_rec *r, const char *fn);
#define L_MAIL 8 /* Electronic mail */
#define L_NEWS 9 /* Usenet Netnews */
-static const char *types[] =
+static const char *const types[] =
{
"text/html", /* HTML */
"text/plain", /* "c program text", */
@@ -462,7 +462,6 @@ typedef struct {
typedef struct {
magic_rsl *head; /* result string list */
magic_rsl *tail;
- unsigned suf_recursion; /* recursion depth in suffix check */
} magic_req_rec;
/*
@@ -606,7 +605,7 @@ static int magic_rsl_putchar(request_rec *r, char c)
/* high overhead for 1 char - just hope they don't do this much */
str[0] = c;
str[1] = '\0';
- return magic_rsl_add(r, str);
+ return magic_rsl_add(r, apr_pstrdup(r->pool, str));
}
/* allocate and copy a contiguous string from a result string list */
@@ -984,7 +983,7 @@ static int apprentice(server_rec *s, apr_pool_t *p)
#if MIME_MAGIC_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(01516)
- MODNAME ": apprentice conf=%x file=%s m=%s m->next=%s last=%s",
+ MODNAME ": apprentice conf=%pp file=%s m=%s m->next=%s last=%s",
conf,
conf->magicfile ? conf->magicfile : "NULL",
conf->magic ? "set" : "NULL",
@@ -1276,7 +1275,7 @@ static int parse(server_rec *serv, apr_pool_t *p, char *l, int lineno)
#if MIME_MAGIC_DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, serv, APLOGNO(01525)
- MODNAME ": parse line=%d m=%x next=%x cont=%d desc=%s",
+ MODNAME ": parse line=%d m=%pp next=%pp cont=%d desc=%s",
lineno, m, m->next, m->cont_level, m->desc);
#endif /* MIME_MAGIC_DEBUG */
@@ -1541,7 +1540,7 @@ static int match(request_rec *r, unsigned char *s, apr_size_t nbytes)
#if MIME_MAGIC_DEBUG
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01529)
- MODNAME ": match conf=%x file=%s m=%s m->next=%s last=%s",
+ MODNAME ": match conf=%pp file=%s m=%s m->next=%s last=%s",
conf,
conf->magicfile ? conf->magicfile : "NULL",
conf->magic ? "set" : "NULL",
@@ -1591,7 +1590,7 @@ static int match(request_rec *r, unsigned char *s, apr_size_t nbytes)
#if MIME_MAGIC_DEBUG
rule_counter++;
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01532)
- MODNAME ": line=%d mc=%x mc->next=%x cont=%d desc=%s",
+ MODNAME ": line=%d mc=%pp mc->next=%pp cont=%d desc=%s",
m_cont->lineno, m_cont,
m_cont->next, m_cont->cont_level,
m_cont->desc);
@@ -2044,12 +2043,12 @@ static int ascmagic(request_rec *r, unsigned char *buf, apr_size_t nbytes)
* - uncompress old into new, using method, return sizeof new
*/
-static struct {
- char *magic;
+static const struct {
+ const char *magic;
apr_size_t maglen;
- char *argv[3];
+ const char *argv[3];
int silent;
- char *encoding; /* MUST be lowercase */
+ const char *encoding; /* MUST be lowercase */
} compr[] = {
/* we use gzip here rather than uncompress because we have to pass
@@ -2077,7 +2076,7 @@ static struct {
},
};
-static int ncompr = sizeof(compr) / sizeof(compr[0]);
+#define ncompr (sizeof(compr) / sizeof(compr[0]))
static int zmagic(request_rec *r, unsigned char *buf, apr_size_t nbytes)
{
@@ -2177,11 +2176,12 @@ static int uncompress(request_rec *r, int method,
parm.method = method;
/* We make a sub_pool so that we can collect our child early, otherwise
- * there are cases (i.e. generating directory indicies with mod_autoindex)
+ * there are cases (i.e. generating directory indices with mod_autoindex)
* where we would end up with LOTS of zombies.
*/
if (apr_pool_create(&sub_context, r->pool) != APR_SUCCESS)
return -1;
+ apr_pool_tag(sub_context, "magic_uncompress");
if ((rv = create_uncompress_child(&parm, sub_context, &pipe_out)) != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01553)