[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1683387 - /subversion/trunk/subversion/mod_dav_svn/status.c

From: Ivan Zhakov <ivan_at_visualsvn.com>
Date: Wed, 3 Jun 2015 20:08:21 +0300

On 3 June 2015 at 19:47, Bert Huijben <bert_at_qqmail.nl> wrote:
>
>
>> -----Original Message-----
>> From: ivan_at_apache.org [mailto:ivan_at_apache.org]
>> Sent: woensdag 3 juni 2015 18:31
>> To: commits_at_subversion.apache.org
>> Subject: svn commit: r1683387 -
>> /subversion/trunk/subversion/mod_dav_svn/status.c
>>
>> Author: ivan
>> Date: Wed Jun 3 16:31:08 2015
>> New Revision: 1683387
>>
>> URL: http://svn.apache.org/r1683387
>> Log:
>> Fix abort() in svn-status handler on platforms that doesn't support C99
>> format specifiers for strftime(): %F and %z are new in C99 and C89
>> compiler/runtime doesn't support them [1]:
>> [[[
>> Those listed here are supported by the latest C and C++ standards (both
>> published in 2011), but those in yellow were introduced in C99 (only
>> required for C++ implementations since C++11), and may not be supported by
>> libraries that comply with older standards.
>> ]]]
>>
>> [1] http://www.cplusplus.com/reference/ctime/strftime/
>>
>> * subversion/mod_dav_svn/status.c
>> (DEFAULT_TIME_FORMAT): Use '%Y-%m-%d' instead of '%F' and '%Z instead
>> of
>> '%z'.
>
> +1 on the %F part. Good catch!
>
> %z and %Z are handled in ap_ht_time(), so I don't think a change is necessary there. Either should work on all platforms.
>
Good point -- I didn't noticed that.

But as far I understand code in ap_ht_time() it handles %z only if GMT==TRUE:
[[[
AP_DECLARE(char *) ap_ht_time(apr_pool_t *p, apr_time_t t, const char *fmt,
                              int gmt)
{
    apr_size_t retcode;
    char ts[MAX_STRING_LEN];
    char tf[MAX_STRING_LEN];
    apr_time_exp_t xt;

    if (gmt) {
        const char *f;
        char *strp;

        apr_time_exp_gmt(&xt, t);
        /* Convert %Z to "GMT" and %z to "+0000";
         * on hosts that do not have a time zone string in struct tm,
         * strftime must assume its argument is local time.
         */
        for(strp = tf, f = fmt; strp < tf + sizeof(tf) - 6 && (*strp = *f)
            ; f++, strp++) {
            if (*f != '%') continue;
            switch (f[1]) {
            case '%':
                *++strp = *++f;
                break;
            case 'Z':
                *strp++ = 'G';
                *strp++ = 'M';
                *strp = 'T';
                f++;
                break;
            case 'z': /* common extension */
                *strp++ = '+';
                *strp++ = '0';
                *strp++ = '0';
                *strp++ = '0';
                *strp = '0';
                f++;
                break;
            }
        }
        *strp = '\0';
        fmt = tf;
    }
    else {
        apr_time_exp_lt(&xt, t);
    }

    /* check return code? */
    apr_strftime(ts, &retcode, MAX_STRING_LEN, fmt, &xt);
    ts[MAX_STRING_LEN - 1] = '\0';
    return apr_pstrdup(p, ts);
}
]]]

Did I miss something?

-- 
Ivan Zhakov
Received on 2015-06-03 19:08:56 CEST

This is an archived mail posted to the Subversion Dev mailing list.