]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/snprintf.c
Return kDNSServiceErr_ServiceNotRunning when Bonjour for Windows not installed.
[thirdparty/cups.git] / cups / snprintf.c
index 65f261d3fa2d310664cfdce4ba1284cb82395a94..e4eb3e9757c96d4d1042e2947da52179bcdf2087 100644 (file)
@@ -1,23 +1,12 @@
 /*
- * "$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.
  */
 
 /*
@@ -93,7 +82,8 @@ _cups_vsnprintf(char       *buffer,   /* O - Output buffer */
        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
@@ -125,7 +115,8 @@ _cups_vsnprintf(char       *buffer, /* O - Output buffer */
          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
@@ -183,8 +174,9 @@ _cups_vsnprintf(char       *buffer, /* O - Output buffer */
            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;
 
@@ -214,8 +206,9 @@ _cups_vsnprintf(char       *buffer, /* O - Output buffer */
            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;
 
@@ -238,8 +231,9 @@ _cups_vsnprintf(char       *buffer, /* O - Output buffer */
            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;
 
@@ -329,7 +323,8 @@ _cups_vsnprintf(char       *buffer, /* O - Output buffer */
   * Nul-terminate the string and return the number of characters needed.
   */
 
-  *bufptr = '\0';
+  if (bufptr)
+       *bufptr = '\0';
 
   return (bytes);
 }
@@ -358,9 +353,3 @@ _cups_snprintf(char       *buffer,  /* O - Output buffer */
   return (bytes);
 }
 #endif /* !HAVE_SNPRINTF */
-
-
-/*
- * End of "$Id: snprintf.c 6649 2007-07-11 21:46:42Z mike $".
- */
-