/* Output like sprintf to a buffer of specified size.
Also takes args differently: pass one pointer to an array of strings
in addition to the format string which is separate.
- Copyright (C) 1985, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1985, 2001-2011 Free Software Foundation, Inc.
This file is part of GNU Emacs.
char *big_buffer = 0;
register int tem;
- unsigned char *string;
+ char *string;
char fixed_buffer[20]; /* Default buffer for small formatting. */
char *fmtcpy;
int minlen;
- unsigned char charbuf[MAX_MULTIBYTE_LENGTH + 1]; /* Used for %c. */
+ char charbuf[MAX_MULTIBYTE_LENGTH + 1]; /* Used for %c. */
if (format_end == 0)
format_end = format + strlen (format);
fmt++;
/* Copy this one %-spec into fmtcpy. */
- string = (unsigned char *) fmtcpy;
+ string = fmtcpy;
*string++ = '%';
while (1)
{
abort ();
sprintf (sprintf_buffer, fmtcpy, va_arg(ap, char *));
/* Now copy into final output, truncating as nec. */
- string = (unsigned char *) sprintf_buffer;
+ string = sprintf_buffer;
goto doit;
case 'f':
double d = va_arg(ap, double);
sprintf (sprintf_buffer, fmtcpy, d);
/* Now copy into final output, truncating as nec. */
- string = (unsigned char *) sprintf_buffer;
+ string = sprintf_buffer;
goto doit;
}
case 's':
if (fmtcpy[1] != 's')
minlen = atoi (&fmtcpy[1]);
- string = va_arg(ap, unsigned char *);
+ string = va_arg (ap, char *);
tem = strlen (string);
width = strwidth (string, tem);
goto doit1;
both are passed the same way, otherwise we'll need
to rewrite callers. */
EMACS_INT chr = va_arg(ap, EMACS_INT);
- tem = CHAR_STRING ((int) chr, charbuf);
+ tem = CHAR_STRING ((int) chr, (unsigned char *) charbuf);
string = charbuf;
string[tem] = 0;
width = strwidth (string, tem);
*bufptr = 0; /* Make sure our string end with a '\0' */
return bufptr - buffer;
}
-