You need to sign in or sign up before continuing.
- 03 7月, 2014 1 次提交
-
-
由 Rich Felker 提交于
this change is presently non-functional since the callees do not yet use their locale argument for anything.
-
- 09 5月, 2014 1 次提交
-
-
由 Szabolcs Nagy 提交于
-
- 27 11月, 2013 1 次提交
-
-
由 Rich Felker 提交于
these functions were spuriously failing in the case where the buffer size was exactly the number of bytes/characters to be written, including null termination. since these functions do not have defined error conditions other than buffer size, a reasonable application may fail to check the return value when the format string and buffer size are known to be valid; such an application could then attempt to use a non-terminated buffer. in addition to fixing the bug, I have changed the error handling behavior so that these functions always null-terminate the output except in the case where the buffer size is zero, and so that they always write as many characters as possible before failing, rather than dropping whole fields that do not fit. this actually simplifies the logic somewhat anyway.
-
- 25 8月, 2013 3 次提交
-
-
由 Rich Felker 提交于
this is a nonstandard extension but will be required in the next version of POSIX, and it's widely used/useful in shell scripts utilizing the date utility.
-
由 Rich Felker 提交于
%e pads with spaces instead of zeros.
-
由 Rich Felker 提交于
this may need further revision in the future, since POSIX is rather unclear on the requirements, and is designed around the assumption of POSIX TZ specifiers which are not sufficiently powerful to represent real-world timezones (this is why zoneinfo support was added). the basic issue is that strftime gets the string and numeric offset for the timezone from the extra fields in struct tm, which are initialized when calling localtime/gmtime/etc. however, a conforming application might have created its own struct tm without initializing these fields, in which case using __tm_zone (a pointer) could crash. other zoneinfo-based implementations simply check for a null pointer, but otherwise can still crash of the field contains junk. simply ignoring __tm_zone and using tzname[] would "work" but would give incorrect results in time zones with more complex rules. I feel like this would lower the quality of implementation. instead, simply validate __tm_zone: unless it points to one of the zone name strings managed by the timezone system, assume it's invalid. this commit also fixes several other minor bugs with formatting: tm_isdst being negative is required to suppress printing of the zone formats, and %z was using the wrong format specifiers since the type of val was changed, resulting in bogus output.
-
- 23 8月, 2013 6 次提交
-
-
由 Rich Felker 提交于
this bug was masked by local experimental CFLAGS in my config.mak.
-
由 Rich Felker 提交于
at present, since POSIX requires %F to behave as %+4Y-%m-%d and ISO C requires %F to behave as %Y-%m-%d, the default behavior for %Y has been changed to match %+4Y. this seems to be the only way to conform to the requirements of both standards, and it does not affect years prior to the year 10000. depending on the outcome of interpretations from the standards bodies, this may be adjusted at some point.
-
由 Rich Felker 提交于
use a long long value so that even with offsets, values cannot overflow. instead of using different format strings for different numeric formats, simply use a per-format width and %0*lld for all of them. this width specifier is not for use with strftime field widths; that will be a separate step in the caller.
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
make __strftime_fmt_1 return a string (possibly in the caller-provided temp buffer) rather than writing into the output buffer. this approach makes more sense when padding to a minimum field width might be required, and it's also closer to what wcsftime wants.
-
由 Rich Felker 提交于
-
- 28 7月, 2013 2 次提交
-
-
由 Rich Felker 提交于
LC_GLOBAL_LOCALE refers to the global locale, controlled by setlocale, not the thread-local locale in effect which these functions should be using. neither LC_GLOBAL_LOCALE nor 0 has an argument to the *_l functions has behavior defined by the standard, but 0 is a more logical choice for requesting the callee to lookup the current locale. in the future I may move the current locale lookup the the caller (the non-_l-suffixed wrapper). at this point, all of the locale logic is dummied out, so no harm was done, but it should at least avoid misleading usage.
-
由 Rich Felker 提交于
this change is in preparation for possibly adding support for the field width and padding specifiers added in POSIX 2008.
-
- 25 7月, 2013 2 次提交
-
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
the latter is both for ABI purposes, and to facilitate eventually adding LC_TIME support. it's also nice to eliminate an extra source file.
-
- 17 7月, 2013 1 次提交
-
-
由 Rich Felker 提交于
this commit has two major user-visible parts: zoneinfo-format time zones are now supported, and overflow handling is intended to be complete in the sense that all functions return a correct result if and only if the result fits in the destination type, and otherwise return an error. also, some noticable bugs in the way DST detection and normalization worked have been fixed, and performance may be better than before, but it has not been tested.
-
- 29 6月, 2013 3 次提交
-
-
由 Rich Felker 提交于
in the process, I refactored the week-number code so it can be used by the week-based-year formats to determine year adjustments at the boundary values. this also improves indention/code readability.
-
由 Rich Felker 提交于
that's what I get for changing a hard-coded threshold to a proper non-magic-number without testing.
-
由 Rich Felker 提交于
output for plain week numbers (%U and %W) has been sanity-checked, and output for the week-based-year week numbers (%V) has been checked extensively against known-good data for the full non-negative range of 32-bit time_t. year numbers for week-based years (%g and %G) are not yet implemented.
-
- 07 9月, 2012 1 次提交
-
-
由 Rich Felker 提交于
to deal with the fact that the public headers may be used with pre-c99 compilers, __restrict is used in place of restrict, and defined appropriately for any supported compiler. we also avoid the form [restrict] since older versions of gcc rejected it due to a bug in the original c99 standard, and instead use the form *restrict.
-
- 12 2月, 2011 1 次提交
-
-
由 Rich Felker 提交于
-