You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Bill Stoddard <bi...@wstoddard.com> on 2001/04/20 20:22:22 UTC

Re: cvs commit: httpd-2.0/support httpd.exp

-1 (a veto) on this patch.

The Windows compiler doesn't like casts on the left side of the assignment.  yea, it sucks but we've
lready had this discussion.

Bill


> dougm       01/04/20 09:43:40
>
>   Modified:    .        CHANGES
>                include  http_config.h
>                server   config.c
>                support  httpd.exp
>   Log:
>   Add ap_set_int_slot() function
>   Submitted by: John K. Sterling <st...@covalent.net>
>   Reviewed by: dougm
>
>   Revision  Changes    Path
>   1.179     +3 -0      httpd-2.0/CHANGES
>
>   Index: CHANGES
>   ===================================================================
>   RCS file: /home/cvs/httpd-2.0/CHANGES,v
>   retrieving revision 1.178
>   retrieving revision 1.179
>   diff -u -r1.178 -r1.179
>   --- CHANGES 2001/04/20 15:38:20 1.178
>   +++ CHANGES 2001/04/20 16:43:31 1.179
>   @@ -1,5 +1,8 @@
>    Changes with Apache 2.0.18-dev
>
>   +  *) Add ap_set_int_slot() function
>   +     [John K. Sterling <st...@covalent.net>]
>   +
>      *) Under certain circumstances, Apache did not supply the
>         right response headers when requiring authentication.
>         [Gertjan van Wingerde <Ge...@cmg.nl>] PR#7114
>
>
>
>   1.76      +12 -0     httpd-2.0/include/http_config.h
>
>   Index: http_config.h
>   ===================================================================
>   RCS file: /home/cvs/httpd-2.0/include/http_config.h,v
>   retrieving revision 1.75
>   retrieving revision 1.76
>   diff -u -r1.75 -r1.76
>   --- http_config.h 2001/04/14 18:20:56 1.75
>   +++ http_config.h 2001/04/20 16:43:34 1.76
>   @@ -483,6 +483,18 @@
>       const char *arg);
>
>    /**
>   + * Generic command handling function for integers
>   + * @param cmd The command parameters for this directive
>   + * @param struct_ptr pointer into a given type
>   + * @param arg The argument to the directive
>   + * @return An error string or NULL on success
>   + * @deffunc const char *ap_set_int_slot(cmd_parms *cmd, void *struct_ptr, const char *arg)
>   + */
>   +AP_DECLARE_NONSTD(const char *) ap_set_int_slot(cmd_parms *cmd,
>   +                                                void *struct_ptr,
>   +                                                const char *arg);
>   +
>   +/**
>     * Return true if the specified method is limited by being listed in
>     * a <Limit> container, or by *not* being listed in a <LimiteExcept>
>     * container.
>
>
>
>   1.125     +19 -0     httpd-2.0/server/config.c
>
>   Index: config.c
>   ===================================================================
>   RCS file: /home/cvs/httpd-2.0/server/config.c,v
>   retrieving revision 1.124
>   retrieving revision 1.125
>   diff -u -r1.124 -r1.125
>   --- config.c 2001/04/13 19:00:37 1.124
>   +++ config.c 2001/04/20 16:43:36 1.125
>   @@ -1061,6 +1061,25 @@
>        return NULL;
>    }
>
>   +AP_DECLARE_NONSTD(const char *) ap_set_int_slot(cmd_parms *cmd,
>   +                                                void *struct_ptr,
>   +                                                const char *arg)
>   +{
>   +    char *endptr;
>   +    char *error_str = NULL;
>   +    int offset = (int) (long) cmd->info;
>   +
>   +    *(int *) (struct_ptr + offset) = strtol(arg, &endptr, 10);
>   +
>   +    if ((*arg == '\0') || (*endptr != '\0')) {
>   +        error_str = apr_psprintf(cmd->pool,
>   +                     "Invalid value for directive %s, expected integer",
>   +                     cmd->directive->directive);
>   +    }
>   +
>   +    return error_str;
>   +}
>   +
>    AP_DECLARE_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *cmd,
>    void *struct_ptr,
>    const char *arg_)
>
>
>
>   1.34      +1 -0      httpd-2.0/support/httpd.exp
>
>   Index: httpd.exp
>   ===================================================================
>   RCS file: /home/cvs/httpd-2.0/support/httpd.exp,v
>   retrieving revision 1.33
>   retrieving revision 1.34
>   diff -u -r1.33 -r1.34
>   --- httpd.exp 2001/04/18 18:20:03 1.33
>   +++ httpd.exp 2001/04/20 16:43:39 1.34
>   @@ -319,6 +319,7 @@
>    ap_set_etag
>    ap_set_file_slot
>    ap_set_flag_slot
>   +ap_set_int_slot
>    ap_set_keepalive
>    ap_set_last_modified
>    ap_set_listenbacklog
>
>
>


Re: cvs commit: httpd-2.0/support httpd.exp

Posted by Bill Stoddard <bi...@wstoddard.com>.
It's fixed.

Bill

> On Fri, 20 Apr 2001, Bill Stoddard wrote:
> >-1 (a veto) on this patch.
> >
> >The Windows compiler doesn't like casts on the left side of the 
> >assignment.  yea, it sucks but we've already had this discussion.
> 
> The Windows compiler handles casts on the left side of the assignment 
> just fine, even at warning level 4 (the maximum warning level) in a 
> C++ file.  What it doesn't handle is adding an integer to a void 
> *.  The struct_ptr in the assignment has to be changed to an real 
> pointer before the addition instead of after the addition.



Re: cvs commit: httpd-2.0/support httpd.exp

Posted by Greg Marr <gr...@alum.wpi.edu>.
On Fri, 20 Apr 2001, Bill Stoddard wrote:
>-1 (a veto) on this patch.
>
>The Windows compiler doesn't like casts on the left side of the 
>assignment.  yea, it sucks but we've already had this discussion.

The Windows compiler handles casts on the left side of the assignment 
just fine, even at warning level 4 (the maximum warning level) in a 
C++ file.  What it doesn't handle is adding an integer to a void 
*.  The struct_ptr in the assignment has to be changed to an real 
pointer before the addition instead of after the addition.

>+AP_DECLARE_NONSTD(const char *) ap_set_int_slot(cmd_parms *cmd,
>+                                                void *struct_ptr,
>+                                                const char *arg)
>+{
>+    char *endptr;
>+    char *error_str = NULL;
>+    int offset = (int) (long) cmd->info;
>+
>+    *(int *) (struct_ptr + offset) = strtol(arg, &endptr, 10);

If offset is in bytes:
*(int *) ((char *)struct_ptr + offset) = strtol(arg, &endptr, 10);

If offset is in ints
*((int *)struct_ptr + offset) = strtol(arg, &endptr, 10);

-- 
Greg Marr
gregm@alum.wpi.edu
"We thought you were dead."
"I was, but I'm better now." - Sheridan, "The Summoning"


Re: cvs commit: httpd-2.0/support httpd.exp

Posted by Doug MacEachern <do...@covalent.net>.
On Fri, 20 Apr 2001, Bill Stoddard wrote:

> -1 (a veto) on this patch.
> 
> The Windows compiler doesn't like casts on the left side of the assignment.  yea, it sucks but we've
> lready had this discussion.

wha?  you mean this?

    *(int *) (struct_ptr + offset) = strtol(arg, &endptr, 10);

all the other ap_set_*_slot functions do that.  please explain more.


Re: cvs commit: httpd-2.0/support httpd.exp

Posted by sterling <st...@covalent.net>.
Are you planning on removing ap_set_flag_slot which does the same
operation?

sterling


On Fri, 20 Apr 2001, Bill Stoddard wrote:

> -1 (a veto) on this patch.
> 
> The Windows compiler doesn't like casts on the left side of the assignment.  yea, it sucks but we've
> lready had this discussion.
> 
> Bill
> 
> 
> > dougm       01/04/20 09:43:40
> >
> >   Modified:    .        CHANGES
> >                include  http_config.h
> >                server   config.c
> >                support  httpd.exp
> >   Log:
> >   Add ap_set_int_slot() function
> >   Submitted by: John K. Sterling <st...@covalent.net>
> >   Reviewed by: dougm
> >
> >   Revision  Changes    Path
> >   1.179     +3 -0      httpd-2.0/CHANGES
> >
> >   Index: CHANGES
> >   ===================================================================
> >   RCS file: /home/cvs/httpd-2.0/CHANGES,v
> >   retrieving revision 1.178
> >   retrieving revision 1.179
> >   diff -u -r1.178 -r1.179
> >   --- CHANGES 2001/04/20 15:38:20 1.178
> >   +++ CHANGES 2001/04/20 16:43:31 1.179
> >   @@ -1,5 +1,8 @@
> >    Changes with Apache 2.0.18-dev
> >
> >   +  *) Add ap_set_int_slot() function
> >   +     [John K. Sterling <st...@covalent.net>]
> >   +
> >      *) Under certain circumstances, Apache did not supply the
> >         right response headers when requiring authentication.
> >         [Gertjan van Wingerde <Ge...@cmg.nl>] PR#7114
> >
> >
> >
> >   1.76      +12 -0     httpd-2.0/include/http_config.h
> >
> >   Index: http_config.h
> >   ===================================================================
> >   RCS file: /home/cvs/httpd-2.0/include/http_config.h,v
> >   retrieving revision 1.75
> >   retrieving revision 1.76
> >   diff -u -r1.75 -r1.76
> >   --- http_config.h 2001/04/14 18:20:56 1.75
> >   +++ http_config.h 2001/04/20 16:43:34 1.76
> >   @@ -483,6 +483,18 @@
> >       const char *arg);
> >
> >    /**
> >   + * Generic command handling function for integers
> >   + * @param cmd The command parameters for this directive
> >   + * @param struct_ptr pointer into a given type
> >   + * @param arg The argument to the directive
> >   + * @return An error string or NULL on success
> >   + * @deffunc const char *ap_set_int_slot(cmd_parms *cmd, void *struct_ptr, const char *arg)
> >   + */
> >   +AP_DECLARE_NONSTD(const char *) ap_set_int_slot(cmd_parms *cmd,
> >   +                                                void *struct_ptr,
> >   +                                                const char *arg);
> >   +
> >   +/**
> >     * Return true if the specified method is limited by being listed in
> >     * a <Limit> container, or by *not* being listed in a <LimiteExcept>
> >     * container.
> >
> >
> >
> >   1.125     +19 -0     httpd-2.0/server/config.c
> >
> >   Index: config.c
> >   ===================================================================
> >   RCS file: /home/cvs/httpd-2.0/server/config.c,v
> >   retrieving revision 1.124
> >   retrieving revision 1.125
> >   diff -u -r1.124 -r1.125
> >   --- config.c 2001/04/13 19:00:37 1.124
> >   +++ config.c 2001/04/20 16:43:36 1.125
> >   @@ -1061,6 +1061,25 @@
> >        return NULL;
> >    }
> >
> >   +AP_DECLARE_NONSTD(const char *) ap_set_int_slot(cmd_parms *cmd,
> >   +                                                void *struct_ptr,
> >   +                                                const char *arg)
> >   +{
> >   +    char *endptr;
> >   +    char *error_str = NULL;
> >   +    int offset = (int) (long) cmd->info;
> >   +
> >   +    *(int *) (struct_ptr + offset) = strtol(arg, &endptr, 10);
> >   +
> >   +    if ((*arg == '\0') || (*endptr != '\0')) {
> >   +        error_str = apr_psprintf(cmd->pool,
> >   +                     "Invalid value for directive %s, expected integer",
> >   +                     cmd->directive->directive);
> >   +    }
> >   +
> >   +    return error_str;
> >   +}
> >   +
> >    AP_DECLARE_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *cmd,
> >    void *struct_ptr,
> >    const char *arg_)
> >
> >
> >
> >   1.34      +1 -0      httpd-2.0/support/httpd.exp
> >
> >   Index: httpd.exp
> >   ===================================================================
> >   RCS file: /home/cvs/httpd-2.0/support/httpd.exp,v
> >   retrieving revision 1.33
> >   retrieving revision 1.34
> >   diff -u -r1.33 -r1.34
> >   --- httpd.exp 2001/04/18 18:20:03 1.33
> >   +++ httpd.exp 2001/04/20 16:43:39 1.34
> >   @@ -319,6 +319,7 @@
> >    ap_set_etag
> >    ap_set_file_slot
> >    ap_set_flag_slot
> >   +ap_set_int_slot
> >    ap_set_keepalive
> >    ap_set_last_modified
> >    ap_set_listenbacklog
> >
> >
> >
>