Home | History | Annotate | Download | only in stdio
History log of /src/lib/libc/stdio/vsnprintf.c
RevisionDateAuthorComments
 1.29  12-Jan-2017  christos undo SSP damage from -Wsystem-headers
 1.28  29-Sep-2014  christos branches: 1.28.2;
Return EOVERFLOW like FreeBSD does if the buffer size exceeds INT_MAX
(well FreeBSD documents INT_MAX + 1, but in the code it is INT_MAX).
 1.27  17-May-2013  joerg branches: 1.27.6;
Provide explicit LC_C_LOCALE accessor and drop the various NULL checks.
Provide LC_GLOBAL_LOCALE in a way that works with all locale functions.
Merge constant data used by the initial global locale and the C locale.
Drop function call layer for _current_locale() and directly return the
locale reference, not a pointer to it. Use protected access for global
variables, so that libc references can avoid the GOT overhead.
 1.26  19-Apr-2013  joerg Add explicit locale versions for the printf family. Replace asprintf,
snprintf and sprintf with simple wrappers around the corresponding
va_list functions to reduce code duplication.
 1.25  15-Mar-2012  christos branches: 1.25.2;
- ansify, knf.
- no functional changes
 1.24  13-Mar-2012  christos PR/45989: Martin Husemann: lint invocation does include -w only on i386

- turn lint -w for all the platforms after fixing the lint warnings.
- add _DIAGASSERTS() for casts that would assign values to types that
would not fit.
- change types, add casts
- change into ansii prototypes
- turn on _DIAGNOSTIC for libc (during current, to be eliminated for release
builds)

approved by core@
 1.23  17-Jul-2011  joerg branches: 1.23.2; 1.23.4;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.22  26-Oct-2007  christos make _FORTIFY_SOURCE play nicely with lint
 1.21  03-Jun-2007  christos branches: 1.21.4;
Make these work with _FORTIFY_SOURCE, by overriding the fortified definitions
 1.20  09-Feb-2005  kleink A little libc namespace housekeeping exercise:
* Make vfprintf_unlocked() an internal function, c.f. __svfscanf_unlocked().
* Add internal names for arc4random(), endnetpath(), fhstatvfs(),
fstatvfs(), mkstemp(), shquote(), statvfs(), taddr2uaddr(), uaddr2taddr(),
uuid_create_nil(), uuid_is_nil(), and wcwidth().
* Include namespace.h where supposed to.
 1.19  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.18  18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.17  05-Jan-2003  kristerw Fix two bugs:

1. snprintf(foo, 0. "XXX") is guaranteed not to write in foo by the
standard (ISO/IEC 9899 7.19.6.5) but our implementation handles this
as if the buffer has a size of (size_t)-1.

2. snprintf(NULL, 0, "XXX") leaks memory since cantwrite() allocates
memory if _bf._base == NULL, and this buffer is never freed
(PR 16483).
 1.16  07-Dec-2001  yamt branches: 1.16.2;
- make FILE structure extensible without breaking binary-compatibility.
- add fputwc, fgetwc, fwide and related functions.
- add hooks needed to maintain the orientation of file stream.
 1.15  19-Oct-2000  kleink branches: 1.15.2;
Actually EINVAL fits the circumstances better.
 1.14  19-Oct-2000  kleink C99: Passing a null pointer as the buffer argument to snprintf() and
vsnprintf() is permitted when the size argument is zero as well; mostly
from Peter Seebach in PR standards/9603.
 1.13  22-Jan-2000  mycroft branches: 1.13.4;
Delint.
Remove trailing ; from uses of __weak_alias(). The macro inserts this if
needed.
 1.12  21-Jan-2000  mycroft Initialize f._file for locking primitives.
 1.11  20-Sep-1999  lukem back out the #ifdef _DIAGNOSTIC argument checks; too many people complained.
_DIAGASSERT() is still retained.
 1.10  16-Sep-1999  lukem * use _DIAGASSERT() to check pointer arguments against NULL and file
descriptors against -1 (as appropriate).
* add actual checks which to detect stuff that would trigger_DIAGASSERT(),
and attempt to return a sane error condition.
* knf some code
* remove some `register' decls.

the first two items result in the addition of code similar to the
following in various functions:

_DIAGASSERT(path != NULL)
#ifdef _DIAGNOSTIC
if (path == NULL) {
errno = EFAULT;
return (-1);
}
#endif
 1.9  13-Oct-1998  kleink Need internal names for snprintf() and vsnprintf().
 1.8  19-Dec-1997  kleink Change several functions to return -1 instead of EOF, which was semantically
wrong.
 1.7  13-Jul-1997  christos Fix RCSID's
Fix gcc warnings.
Add prototypes for functions that were declared in more than one place
to local.h or extern.h and use that instead.
 1.6  29-Mar-1996  jtc Add explict function return types
 1.5  02-Feb-1995  jtc Merged with 4.4lite.
Changed to conform to NetBSD's new RCS Id convention.
 1.4  22-May-1994  cgd _VA_LIST_ -> _BSD_VA_LIST_
 1.3  26-Aug-1993  jtc Declare rcsid strings so they are stored in text segment.
 1.2  01-Aug-1993  mycroft Add RCS identifiers.
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2  02-Feb-1995  jtc imported from 44lite
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.13.4.1  19-Oct-2000  he Pull up revisions 1.14-1.15 (requested by kleink):
C99 alignment: a buffer size of 0 is permitted. Also, when
size is 0, a null buffer pointer may be passed. Fixes PR#9603.
 1.15.2.4  08-Jan-2003  thorpej Sync with HEAD.
 1.15.2.3  07-May-2002  nathanw One more routine to use vfprintf_unlocked()
 1.15.2.2  06-Feb-2002  nathanw #include "reentrant.h" before "local.h" so that the thread types used
in fileext.h are avaliable.
 1.15.2.1  28-Jan-2002  nathanw Catch up to -current.
 1.16.2.1  10-Jan-2003  jmc Pull up revisions 1.16-1.17 (requested by kristerw in ticket #1059)
Fix two bugs:
1. snprintf(foo, 0. XXX) is guaranteed not to write in foo by the
standard (ISO/IEC 9899 7.19.6.5) but our implementation handles this
as if the buffer has a size of (size_t)-1.
2. snprintf(NULL, 0, XXX) leaks memory since cantwrite() allocates
memory if _bf._base == NULL, and this buffer is never freed
(PR 16483).
 1.21.4.1  06-Nov-2007  matt sync with HEAD
 1.23.4.1  03-Nov-2014  msaitoh Pull up following revision(s) (requested by christos in ticket #1161):
lib/libc/stdio/printf.3: revision 1.64 via patch
lib/libc/stdio/vsnprintf.c: revision 1.28 via patch
lib/libc/stdio/vsnprintf_ss.c: revision 1.13 via patch
Return EOVERFLOW like FreeBSD does if the buffer size exceeds INT_MAX
(well FreeBSD documents INT_MAX + 1, but in the code it is INT_MAX).
Return EOVERFLOW like FreeBSD does if the buffer size exceeds INT_MAX
(well FreeBSD documents INT_MAX + 1, but in the code it is INT_MAX).
 1.23.2.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.23.2.1  17-Apr-2012  yamt sync with head
 1.25.2.1  23-Jun-2013  tls resync from head
 1.27.6.1  30-Sep-2014  martin Pull up following revision(s) (requested by christos in ticket #122):
lib/libc/stdio/printf.3: revision 1.64
lib/libc/stdio/vsnprintf.c: revision 1.28
lib/libc/stdio/vsnprintf_ss.c: revision 1.13
Return EOVERFLOW like FreeBSD does if the buffer size exceeds INT_MAX
(well FreeBSD documents INT_MAX + 1, but in the code it is INT_MAX).
 1.28.2.1  20-Mar-2017  pgoyette Sync with HEAD

RSS XML Feed