If a char width is specified the number of output buffer bytes
consumed might be greater than one. Update append_char() to
return the number of bytes consumed and use that value in xyzprintf()
instead of one.
Apple clang version 14.0.0 (clang-1400.0.17.3.1) fails the build
because stds.h defines `fallthrough` as a macro which is then
expanded when base.h evaluates
# if __has_attribute(fallthrough) && __clang_major__ >= 5
The macOS SDK defines `DISPATCH_FALLTHROUGH` as the macro instead
of `fallthrough`.
This change replaces the use of `fallthrough` in the tree with
`HEIM_FALLTHROUGH` and updates the declaration in configure logic
to define `HEIM_FALLTHROUGH` based upon existing definitions
(if any) of `fallthrough` or `DISPATCH_FALLTHROUGH`.
The pseudo keyword 'fallthrough' is defined such that case statement
blocks must end with any of these keywords:
* break;
* fallthrough;
* continue;
* goto <label>;
* return [expression];
*
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html#Statement-Attributes
The macro is defined either as
__attribute__((__fallthrough__))
or as
do {} while (0) /* fallthrough */
not including the semicolon.
This change implements the Linux kernel style and updates several locations
where "/*fallthrough*/ and /* FALLTHROUGH */ were not previously replaced.
Externally imported code such as libedit, libtommath and sqlite are
restored to their unaltered state.
Change-Id: I69db8167b0d5884f55d96d72de3059a0235a1ba3
Although not required to address bad code generation in
some versions of gcc 9 and 10, a coding style that requires
explicit comparison of the result to zero before use is
both clearer and would have avoided the generation of bad
code.
This change converts all use of cmp function usage from
```
if (strcmp(a, b) || !strcmp(c, d)) ...
```
to
```
if (strcmp(a, b) != 0 || strcmp(c, d)) == 0
```
for all C library cmp functions and related:
- strcmp(), strncmp()
- strcasecmp(), strncasecmp()
- stricmp(), strnicmp()
- memcmp()
Change-Id: Ic60c15e1e3a07e4faaf10648eefe3adae2543188
It should be possible to pass a format string of "%.s" to permit
a non-nul terminated string to be used as input. The test of remaining
precision and the test for NUL needs to be reversed to permit this
behavior to function correctly.
Change-Id: I200f9c2886419dc4c3870f5f44bc10e81245f56c
Appease the compiler by resolving some of the reported warnings,
including:
- Control paths that don't return.
- Potentially uninitialized variables.
- Unused local variables.
- Unreachable code.
- Type safety.
- Synchronize declarations with definitions for functions.
* don't break when right justifying a number past the end of the buffer
* handle zero precision and the value zero more correctly
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12413 ec53bebd-3082-4978-b11e-865c3cabbd6b
characters to print, we need to figure out how long the string would
have to be. this also fixes snprintf(NULL, 0
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10247 ec53bebd-3082-4978-b11e-865c3cabbd6b
(according to the integer protomotion rules) in variable arguments
lists. Therefore, we should not call va_arg with short but rather
with int. See <http://www.debian.org/Bugs/db/57/57919.html> for
original bug report
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7950 ec53bebd-3082-4978-b11e-865c3cabbd6b
manifests itself on Linux-PPC. From Tom Rini
<trini@kernel.crashing.org>
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7286 ec53bebd-3082-4978-b11e-865c3cabbd6b
(as_reserve): don't loop. better heuristic for how much space to realloc.
(vasnprintf): simplify initializing to one.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@4082 ec53bebd-3082-4978-b11e-865c3cabbd6b