httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@locus.apache.org
Subject cvs commit: apache-2.0/src/modules/dav/main mod_dav.c props.c util.c
Date Mon, 03 Jul 2000 08:55:15 GMT
gstein      00/07/03 01:55:10

  Modified:    src/main util_xml.c
               src/modules/dav/fs lock.c repos.c
               src/modules/dav/main mod_dav.c props.c util.c
  Log:
  misc const cleanups and others issues found using maintainer-mode
      (initial errors found by Ryan Bloom).
  also switch to use new command table initializer macros.
  
  Revision  Changes    Path
  1.5       +11 -3     apache-2.0/src/main/util_xml.c
  
  Index: util_xml.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/util_xml.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- util_xml.c	2000/07/01 14:02:49	1.4
  +++ util_xml.c	2000/07/03 08:54:36	1.5
  @@ -151,6 +151,7 @@
       dav_xml_attr *prev;
       char *colon;
       const char *quoted;
  +    char *elem_name;
   
       /* punt once we find an error */
       if (ctx->error)
  @@ -159,7 +160,7 @@
       elem = ap_pcalloc(ctx->p, sizeof(*elem));
   
       /* prep the element */
  -    elem->name = ap_pstrdup(ctx->p, name);
  +    elem->name = elem_name = ap_pstrdup(ctx->p, name);
   
       /* fill in the attributes (note: ends up in reverse order) */
       while (*attrs) {
  @@ -258,7 +259,7 @@
   	elem->lang = elem->parent->lang;
   
       /* adjust the element's namespace */
  -    colon = strchr(elem->name, ':');
  +    colon = ap_strchr(elem_name, ':');
       if (colon == NULL) {
   	/*
   	 * The element is using the default namespace, which will always
  @@ -283,7 +284,14 @@
   
       /* adjust all remaining attributes' namespaces */
       for (attr = elem->attr; attr; attr = attr->next) {
  -	colon = strchr(attr->name, ':');
  +        /*
  +         * dav_xml_attr defines this as "const" but we dup'd it, so we
  +         * know that we can change it. a bit hacky, but the existing
  +         * structure def is best.
  +         */
  +        char *attr_name = (char *)attr->name;
  +
  +	colon = ap_strchr(attr_name, ':');
   	if (colon == NULL) {
   	    /*
   	     * Attributes do NOT use the default namespace. Therefore,
  
  
  
  1.5       +1 -1      apache-2.0/src/modules/dav/fs/lock.c
  
  Index: lock.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/fs/lock.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- lock.c	2000/07/01 14:02:52	1.4
  +++ lock.c	2000/07/03 08:54:41	1.5
  @@ -282,7 +282,7 @@
   {
       dav_locktoken *locktoken;
   
  -    if (strstr(char_token, "opaquelocktoken:") != char_token) {
  +    if (ap_strstr_c(char_token, "opaquelocktoken:") != char_token) {
   	return dav_new_error(p,
   			     HTTP_BAD_REQUEST, DAV_ERR_LOCK_UNK_STATE_TOKEN,
   			     "The lock token uses an unknown State-token "
  
  
  
  1.5       +1 -1      apache-2.0/src/modules/dav/fs/repos.c
  
  Index: repos.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/fs/repos.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- repos.c	2000/07/01 14:02:52	1.4
  +++ repos.c	2000/07/03 08:54:43	1.5
  @@ -1279,7 +1279,7 @@
   /* ### move this to dav_util? */
   /* Walk recursively down through directories, *
    * including lock-null resources as we go.    */
  -dav_error * dav_fs_walker(dav_fs_walker_context *fsctx, int depth)
  +static dav_error * dav_fs_walker(dav_fs_walker_context *fsctx, int depth)
   {
       dav_error *err = NULL;
       dav_walker_ctx *wctx = fsctx->wctx;
  
  
  
  1.5       +42 -59    apache-2.0/src/modules/dav/main/mod_dav.c
  
  Index: mod_dav.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/main/mod_dav.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- mod_dav.c	2000/07/02 09:08:45	1.4
  +++ mod_dav.c	2000/07/03 08:54:52	1.5
  @@ -433,7 +433,8 @@
   /*
    * Command handler for the DAVLockDB directive, which is TAKE1
    */
  -static const char *dav_cmd_davlockdb(cmd_parms *cmd, void *config, char *arg1)
  +static const char *dav_cmd_davlockdb(cmd_parms *cmd, void *config,
  +                                     const char *arg1)
   {
       dav_server_conf *conf;
   
  @@ -449,7 +450,7 @@
    * Command handler for DAVMinTimeout directive, which is TAKE1
    */
   static const char *dav_cmd_davmintimeout(cmd_parms *cmd, void *config,
  -                                         char *arg1)
  +                                         const char *arg1)
   {
       dav_dir_conf *conf = (dav_dir_conf *) config;
   
  @@ -464,7 +465,7 @@
    * Command handler for DAVParam directive, which is TAKE2
    */
   static const char *dav_cmd_davparam(cmd_parms *cmd, void *config,
  -                                    char *arg1, char *arg2)
  +                                    const char *arg1, const char *arg2)
   {
       dav_dir_conf *conf = (dav_dir_conf *) config;
   
  @@ -477,7 +478,7 @@
    * Command handler for LimitXMLRequestBody directive, which is TAKE1
    */
   static const char *dav_cmd_limitxmlrequestbody(cmd_parms *cmd, void *config,
  -                                               char *arg1)
  +                                               const char *arg1)
   {
       dav_dir_conf *conf = (dav_dir_conf *) config;
   
  @@ -536,7 +537,7 @@
       const char *e_uri = ap_escape_uri(p, uri);
   
       /* check the easy case... */
  -    if (strchr(e_uri, '&') == NULL)
  +    if (ap_strchr_c(e_uri, '&') == NULL)
   	return e_uri;
   
       /* more work needed... sigh. */
  @@ -812,18 +813,19 @@
   static int dav_parse_range(request_rec *r,
                              off_t *range_start, off_t *range_end)
   {
  -    const char *range;
  +    const char *range_c;
  +    char *range;
       char *dash;
       char *slash;
   
  -    range = ap_table_get(r->headers_in, "content-range");
  -    if (range == NULL)
  +    range_c = ap_table_get(r->headers_in, "content-range");
  +    if (range_c == NULL)
           return 0;
   
  -    range = ap_pstrdup(r->pool, range);
  +    range = ap_pstrdup(r->pool, range_c);
       if (strncasecmp(range, "bytes ", 6) != 0
  -        || (dash = strchr(range, '-')) == NULL
  -        || (slash = strchr(range, '/')) == NULL) {
  +        || (dash = ap_strchr(range, '-')) == NULL
  +        || (slash = ap_strchr(range, '/')) == NULL) {
           /* malformed header. ignore it (per S14.16 of RFC2616) */
           return 0;
       }
  @@ -3258,54 +3260,35 @@
   
   static const command_rec dav_cmds[] =
   {
  -    {
  -	"DAV",
  -	dav_cmd_dav,
  -	NULL,
  -	ACCESS_CONF,            /* per directory/location */
  -	FLAG,
  -	"turn DAV on/off for a directory or location"
  -    },
  -    {
  -	"DAVLockDB",
  -	dav_cmd_davlockdb,
  -	NULL,
  -	RSRC_CONF,              /* per server */
  -	TAKE1,
  -	"specify a lock database"
  -    },
  -    {
  -	"DAVMinTimeout",
  -	dav_cmd_davmintimeout,
  -	NULL,
  -	ACCESS_CONF|RSRC_CONF,  /* per directory/location, or per server */
  -	TAKE1,
  -	"specify minimum allowed timeout"
  -    },
  -    {
  -	"DAVDepthInfinity",
  -	dav_cmd_davdepthinfinity,
  -	NULL,
  -	ACCESS_CONF|RSRC_CONF,  /* per directory/location, or per server */
  -	FLAG,
  -	"allow Depth infinity PROPFIND requests"
  -    },
  -    {
  -	"DAVParam",
  -	dav_cmd_davparam,
  -	NULL,
  -	ACCESS_CONF|RSRC_CONF,  /* per directory/location, or per server */
  -	TAKE2,
  -	"DAVParam <parameter name> <parameter value>"
  -    },
  -    {
  -	"LimitXMLRequestBody",
  -	dav_cmd_limitxmlrequestbody,
  -	NULL,
  -	ACCESS_CONF|RSRC_CONF,  /* per directory/location, or per server */
  -	TAKE1,
  -	"Limit (in bytes) on maximum size of an XML-based request body"
  -    },
  +    /* per directory/location */
  +    AP_INIT_FLAG("DAV", dav_cmd_dav, NULL, ACCESS_CONF,
  +                 "turn DAV on/off for a directory or location"),
  +
  +    /* per server */
  +    AP_INIT_TAKE1("DAVLockDB", dav_cmd_davlockdb, NULL,	RSRC_CONF,
  +                  "specify a lock database"),
  +
  +    /* per directory/location, or per server */
  +    AP_INIT_TAKE1("DAVMinTimeout", dav_cmd_davmintimeout, NULL,
  +                  ACCESS_CONF|RSRC_CONF,
  +                  "specify minimum allowed timeout"),
  +
  +    /* per directory/location, or per server */
  +    AP_INIT_FLAG("DAVDepthInfinity", dav_cmd_davdepthinfinity, NULL,
  +                 ACCESS_CONF|RSRC_CONF,
  +                 "allow Depth infinity PROPFIND requests"),
  +
  +    /* per directory/location, or per server */
  +    AP_INIT_TAKE2("DAVParam", dav_cmd_davparam, NULL,
  +                  ACCESS_CONF|RSRC_CONF,
  +                  "DAVParam <parameter name> <parameter value>"),
  +
  +    /* per directory/location, or per server */
  +    AP_INIT_TAKE1("LimitXMLRequestBody", dav_cmd_limitxmlrequestbody, NULL,
  +                  ACCESS_CONF|RSRC_CONF,
  +                  "Limit (in bytes) on maximum size of an XML-based request "
  +                  "body"),
  +
       { NULL }
   };
   
  
  
  
  1.4       +1 -1      apache-2.0/src/modules/dav/main/props.c
  
  Index: props.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/main/props.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- props.c	2000/06/28 11:23:53	1.3
  +++ props.c	2000/07/03 08:54:54	1.4
  @@ -856,7 +856,7 @@
       return key;
   }
   
  -dav_error *dav_really_open_db(dav_propdb *propdb, int ro)
  +static dav_error *dav_really_open_db(dav_propdb *propdb, int ro)
   {
       dav_error *err;
       dav_datum key;
  
  
  
  1.4       +1 -1      apache-2.0/src/modules/dav/main/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/dav/main/util.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- util.c	2000/06/28 11:23:53	1.3
  +++ util.c	2000/07/03 08:54:54	1.4
  @@ -851,7 +851,7 @@
       char *list;
       const char *state_token;
       const char *uri = NULL;	/* scope of current production; NULL=no-tag */
  -    size_t uri_len;
  +    size_t uri_len = 0;
       dav_if_header *ih = NULL;
       uri_components parsed_uri;
       const dav_hooks_locks *locks_hooks = DAV_GET_HOOKS_LOCKS(r);
  
  
  

Mime
View raw message