diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2011-03-21 09:26:05 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-03-21 09:26:05 -0700 |
commit | a44c5709cecc6d21246c66651ea8c51201b8881a (patch) | |
tree | 32cd4be38c433335997b3a67f1038992095e20f1 /lib | |
parent | 5d6d7e57010a1e09d553885c1ad5d54b7ba96747 (diff) | |
download | emacs-a44c5709cecc6d21246c66651ea8c51201b8881a.tar.gz |
Merge from gnulib.
Diffstat (limited to 'lib')
-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 0a02b507744..acebc9adfad 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 \ |