- (dtucker) [openbsd-compat/bsd-snprintf.c] Static declarations for public
library interfaces aren't very helpful. Fix up the DOPR_OUTCH macro so it works properly and modify its callers so that they don't pre or post decrement arguments that are conditionally evaluated. While there, put SNPRINTF_CONST back as it prevents build failures in some configurations. ok djm@ (for most of it)
This commit is contained in:
parent
9f74105289
commit
07877ca680
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,11 @@
|
||||||
|
20070123
|
||||||
|
- (dtucker) [openbsd-compat/bsd-snprintf.c] Static declarations for public
|
||||||
|
library interfaces aren't very helpful. Fix up the DOPR_OUTCH macro
|
||||||
|
so it works properly and modify its callers so that they don't pre or
|
||||||
|
post decrement arguments that are conditionally evaluated. While there,
|
||||||
|
put SNPRINTF_CONST back as it prevents build failures in some
|
||||||
|
configurations. ok djm@ (for most of it)
|
||||||
|
|
||||||
20070122
|
20070122
|
||||||
- (djm) [ssh-rand-helper.8] manpage nits;
|
- (djm) [ssh-rand-helper.8] manpage nits;
|
||||||
from dleonard AT vintela.com (bz#1529)
|
from dleonard AT vintela.com (bz#1529)
|
||||||
|
@ -2678,4 +2686,4 @@
|
||||||
OpenServer 6 and add osr5bigcrypt support so when someone migrates
|
OpenServer 6 and add osr5bigcrypt support so when someone migrates
|
||||||
passwords between UnixWare and OpenServer they will still work. OK dtucker@
|
passwords between UnixWare and OpenServer they will still work. OK dtucker@
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.4607 2007/01/22 01:44:53 djm Exp $
|
$Id: ChangeLog,v 1.4608 2007/01/23 13:07:29 dtucker Exp $
|
||||||
|
|
|
@ -168,12 +168,13 @@
|
||||||
|
|
||||||
#define DOPR_OUTCH(buf, pos, buflen, thechar) \
|
#define DOPR_OUTCH(buf, pos, buflen, thechar) \
|
||||||
do { \
|
do { \
|
||||||
if (++pos >= INT_MAX) { \
|
if (pos + 1 >= INT_MAX) { \
|
||||||
errno = ERANGE; \
|
errno = ERANGE; \
|
||||||
return -1; \
|
return -1; \
|
||||||
|
} \
|
||||||
if (pos < buflen) \
|
if (pos < buflen) \
|
||||||
buf[pos] = thechar; \
|
buf[pos] = thechar; \
|
||||||
} \
|
(pos)++; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static int dopr(char *buffer, size_t maxlen, const char *format,
|
static int dopr(char *buffer, size_t maxlen, const char *format,
|
||||||
|
@ -494,7 +495,8 @@ fmtstr(char *buffer, size_t *currlen, size_t maxlen,
|
||||||
++cnt;
|
++cnt;
|
||||||
}
|
}
|
||||||
while (*value && (cnt < max)) {
|
while (*value && (cnt < max)) {
|
||||||
DOPR_OUTCH(buffer, *currlen, maxlen, *value++);
|
DOPR_OUTCH(buffer, *currlen, maxlen, *value);
|
||||||
|
*value++;
|
||||||
++cnt;
|
++cnt;
|
||||||
}
|
}
|
||||||
while ((padlen < 0) && (cnt < max)) {
|
while ((padlen < 0) && (cnt < max)) {
|
||||||
|
@ -582,8 +584,10 @@ fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Digits */
|
/* Digits */
|
||||||
while (place > 0)
|
while (place > 0) {
|
||||||
DOPR_OUTCH(buffer, *currlen, maxlen, convert[--place]);
|
--place;
|
||||||
|
DOPR_OUTCH(buffer, *currlen, maxlen, convert[place]);
|
||||||
|
}
|
||||||
|
|
||||||
/* Left Justified spaces */
|
/* Left Justified spaces */
|
||||||
while (spadlen < 0) {
|
while (spadlen < 0) {
|
||||||
|
@ -788,8 +792,10 @@ fmtfp (char *buffer, size_t *currlen, size_t maxlen,
|
||||||
if (signvalue)
|
if (signvalue)
|
||||||
DOPR_OUTCH(buffer, *currlen, maxlen, signvalue);
|
DOPR_OUTCH(buffer, *currlen, maxlen, signvalue);
|
||||||
|
|
||||||
while (iplace > 0)
|
while (iplace > 0) {
|
||||||
DOPR_OUTCH(buffer, *currlen, maxlen, iconvert[--iplace]);
|
--iplace;
|
||||||
|
DOPR_OUTCH(buffer, *currlen, maxlen, iconvert[iplace]);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_SNPRINTF
|
#ifdef DEBUG_SNPRINTF
|
||||||
printf("fmtfp: fplace=%d zpadlen=%d\n", fplace, zpadlen);
|
printf("fmtfp: fplace=%d zpadlen=%d\n", fplace, zpadlen);
|
||||||
|
@ -807,9 +813,10 @@ fmtfp (char *buffer, size_t *currlen, size_t maxlen,
|
||||||
--zpadlen;
|
--zpadlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (fplace > 0)
|
while (fplace > 0) {
|
||||||
DOPR_OUTCH(buffer, *currlen, maxlen,
|
--fplace;
|
||||||
fconvert[--fplace]);
|
DOPR_OUTCH(buffer, *currlen, maxlen, fconvert[fplace]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (padlen < 0) {
|
while (padlen < 0) {
|
||||||
|
@ -821,7 +828,7 @@ fmtfp (char *buffer, size_t *currlen, size_t maxlen,
|
||||||
#endif /* !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) */
|
#endif /* !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) */
|
||||||
|
|
||||||
#if !defined(HAVE_VSNPRINTF)
|
#if !defined(HAVE_VSNPRINTF)
|
||||||
static int
|
int
|
||||||
vsnprintf (char *str, size_t count, const char *fmt, va_list args)
|
vsnprintf (char *str, size_t count, const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
return dopr(str, count, fmt, args);
|
return dopr(str, count, fmt, args);
|
||||||
|
@ -829,8 +836,8 @@ vsnprintf (char *str, size_t count, const char *fmt, va_list args)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(HAVE_SNPRINTF)
|
#if !defined(HAVE_SNPRINTF)
|
||||||
static int
|
int
|
||||||
snprintf(char *str, size_t count, const char *fmt, ...)
|
snprintf(char *str, size_t count, SNPRINTF_CONST char *fmt, ...)
|
||||||
{
|
{
|
||||||
size_t ret;
|
size_t ret;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
Loading…
Reference in New Issue