/*
- * "$Id: snprintf.c 6649 2007-07-11 21:46:42Z mike $"
+ * snprintf functions for CUPS.
*
- * snprintf functions for CUPS.
+ * Copyright © 2021 by OpenPrinting
+ * Copyright © 2007-2019 by Apple Inc.
+ * Copyright © 1997-2007 by Easy Software Products.
*
- * Copyright 2007-2013 by Apple Inc.
- * Copyright 1997-2007 by Easy Software Products.
- *
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
- * which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
- *
- * This file is subject to the Apple OS-Developed Software exception.
- *
- * Contents:
- *
- * _cups_vsnprintf() - Format a string into a fixed size buffer.
- * _cups_snprintf() - Format a string into a fixed size buffer.
+ * Licensed under Apache License v2.0. See the file "LICENSE" for more
+ * information.
*/
/*
format ++;
width = va_arg(ap, int);
- snprintf(tptr, sizeof(tformat) - (tptr - tformat), "%d", width);
+ /* Note: Can't use snprintf here since we are implementing this function... */
+ sprintf(tptr, "%d", width);
tptr += strlen(tptr);
}
else
format ++;
prec = va_arg(ap, int);
- snprintf(tptr, sizeof(tformat) - (tptr - tformat), "%d", prec);
+ /* Note: Can't use snprintf here since we are implementing this function... */
+ sprintf(tptr, "%d", prec);
tptr += strlen(tptr);
}
else
if ((width + 2) > sizeof(temp))
break;
+ /* Note: Can't use snprintf here since we are implementing this function... */
sprintf(temp, tformat, va_arg(ap, double));
- templen = strlen(temp):
+ templen = strlen(temp);
bytes += (int)templen;
if ((width + 2) > sizeof(temp))
break;
+ /* Note: Can't use snprintf here since we are implementing this function... */
sprintf(temp, tformat, va_arg(ap, int));
- templen = strlen(temp):
+ templen = strlen(temp);
bytes += (int)templen;
if ((width + 2) > sizeof(temp))
break;
+ /* Note: Can't use snprintf here since we are implementing this function... */
sprintf(temp, tformat, va_arg(ap, void *));
- templen = strlen(temp):
+ templen = strlen(temp);
bytes += (int)templen;
* Nul-terminate the string and return the number of characters needed.
*/
- *bufptr = '\0';
+ if (bufptr)
+ *bufptr = '\0';
return (bytes);
}
return (bytes);
}
#endif /* !HAVE_SNPRINTF */
-
-
-/*
- * End of "$Id: snprintf.c 6649 2007-07-11 21:46:42Z mike $".
- */
-