diff options
author | Andy Wingo <wingo@pobox.com> | 2011-04-28 15:53:35 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-04-28 15:53:35 +0200 |
commit | 1903eae4c9ab97b575dad4ab1f5cf05436d84ab3 (patch) | |
tree | dbb5a83c4dce6f6f10642b3d39ec76ee63dd77a5 /lib/strftime.c | |
parent | 0c81a0c13ad39c381e4ff4d073e3158bcfd51a7a (diff) | |
parent | 91956a94fe6363cf69d574b56397962ec6ef4468 (diff) | |
download | guile-1903eae4c9ab97b575dad4ab1f5cf05436d84ab3.tar.gz |
Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
GUILE-VERSION
Diffstat (limited to 'lib/strftime.c')
-rw-r--r-- | lib/strftime.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/strftime.c b/lib/strftime.c index be7750de1..df09be9ca 100644 --- a/lib/strftime.c +++ b/lib/strftime.c @@ -172,15 +172,16 @@ extern char *tzname[]; #define add(n, f) \ do \ { \ - int _n = (n); \ - int _delta = width - _n; \ - int _incr = _n + (_delta > 0 ? _delta : 0); \ - if ((size_t) _incr >= maxsize - i) \ + size_t _n = (n); \ + size_t _w = (width < 0 ? 0 : width); \ + size_t _incr = _n < _w ? _w : _n; \ + if (_incr >= maxsize - i) \ return 0; \ if (p) \ { \ - if (digits == 0 && _delta > 0) \ + if (digits == 0 && _n < _w) \ { \ + size_t _delta = width - _n; \ if (pad == L_('0')) \ memset_zero (p, _delta); \ else \ |