You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Yann Ylavic <yl...@gmail.com> on 2013/09/18 01:17:00 UTC

Re: svn commit: r1523974 - in /httpd/httpd/branches/2.4.x: docs/manual/mod/mod_lua.xml modules/lua/lua_request.c modules/lua/mod_lua.c

On Tue, Sep 17, 2013 at 12:38 PM, <hu...@apache.org> wrote:

> Author: humbedooh
> Date: Tue Sep 17 10:38:12 2013
> New Revision: 1523974
>
> <...>
>
>
> +static apr_uint64_t ap_ntoh64(const apr_uint64_t *input)
>  +{
> +    apr_uint64_t rval;
> +    unsigned char *data = (unsigned char *)&rval;
> +
> +    data[0] = *input >> 56;
> +    data[1] = *input >> 48;
> +    data[2] = *input >> 40;
> +    data[3] = *input >> 32;
> +    data[4] = *input >> 24;
> +    data[5] = *input >> 16;
> +    data[6] = *input >> 8;
> +    data[7] = *input >> 0;
> +
> +    return rval;
> +}
>

Isn't that code byte-order dependent

(eg. simply "return *input" when big-endian) 
?

Re: svn commit: r1523974 - in /httpd/httpd/branches/2.4.x: docs/manual/mod/mod_lua.xml modules/lua/lua_request.c modules/lua/mod_lua.c

Posted by Yann Ylavic <yl...@gmail.com>.
On Wed, Sep 18, 2013 at 10:10 AM, Daniel Gruno <ru...@cord.dk> wrote:

> This is one of the things I enjoy about httpd - there's always someone
> there to spot bugs or missing snippets :) Thanks for the heads up, I've
> added a big endian check in the function now.
>

You're welcome, thank *you* for mod_lua!



>
> With regards,
> Daniel.
>

Re: svn commit: r1523974 - in /httpd/httpd/branches/2.4.x: docs/manual/mod/mod_lua.xml modules/lua/lua_request.c modules/lua/mod_lua.c

Posted by Daniel Gruno <ru...@cord.dk>.
On 09/18/2013 01:17 AM, Yann Ylavic wrote:
> On Tue, Sep 17, 2013 at 12:38 PM, <humbedooh@apache.org
> <ma...@apache.org>> wrote:
> 
>     Author: humbedooh
>     Date: Tue Sep 17 10:38:12 2013
>     New Revision: 1523974
> 
>     <...>
> 
> 
>     +static apr_uint64_t ap_ntoh64(const apr_uint64_t *input)
>     +{
>     +    apr_uint64_t rval;
>     +    unsigned char *data = (unsigned char *)&rval;
>     +
>     +    data[0] = *input >> 56;
>     +    data[1] = *input >> 48;
>     +    data[2] = *input >> 40;
>     +    data[3] = *input >> 32;
>     +    data[4] = *input >> 24;
>     +    data[5] = *input >> 16;
>     +    data[6] = *input >> 8;
>     +    data[7] = *input >> 0;
>     +
>     +    return rval;
>     +}
> 
> 
> Isn't that code byte-order dependent
>  
> (eg. simply "return *input" when big-endian)
> ?
> 
This is one of the things I enjoy about httpd - there's always someone
there to spot bugs or missing snippets :) Thanks for the heads up, I've
added a big endian check in the function now.

With regards,
Daniel.