On Thu, Sep 08, 2011 at 05:36:06PM -0400, Jeff Trawick wrote:
> static apr_status_t base10_strtoff(apr_off_t *offset, const char *buf,
>                                    char **endptr)
> {
>     const char *last;
> 
>     *offset = apr_atoi64(buf);

I think this needs to DTRT with a 32-bit off_t.

How about this?

static apr_status_t strtoff(apr_off_t *offset, const char *nptr,
                            char **endptr, int base)
{
    errno = 0;
    if (sizeof(apr_off_t) == 4) {
        *offset = strtol(nptr, endptr, base);
    }
    else {
        *offset = apr_strtoi64(ptr, endptr, base);
    }
    return APR_FROM_OS_ERROR(errno);
}


Reply via email to