]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/LibC/Stdio/vswprintf.c
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / StdLib / LibC / Stdio / vswprintf.c
diff --git a/StdLib/LibC/Stdio/vswprintf.c b/StdLib/LibC/Stdio/vswprintf.c
deleted file mode 100644 (file)
index 6d4cc3e..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*\r
- * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>\r
- * All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- * 1. Redistributions of source code must retain the above copyright\r
- *    notice, this list of conditions and the following disclaimer.\r
- * 2. Redistributions in binary form must reproduce the above copyright\r
- *    notice, this list of conditions and the following disclaimer in the\r
- *    documentation and/or other materials provided with the distribution.\r
- * 3. The name of the author may not be used to endorse or promote products\r
- *    derived from this software without specific prior written permission.\r
- *\r
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,\r
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY\r
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL\r
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\r
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\r
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\r
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-\r
-  FreeBSD: src/lib/libc/stdio/vswprintf.c,v 1.6 2005/02/21 19:41:44 fjoe Exp\r
-  NetBSD: vswprintf.c,v 1.1 2005/05/14 23:51:02 christos Exp\r
- */\r
-#include  <LibConfig.h>\r
-#include  <sys/EfiCdefs.h>\r
-\r
-#include  <errno.h>\r
-#include  <stdio.h>\r
-#include  <stdlib.h>\r
-#include  <wchar.h>\r
-#include  <stdarg.h>\r
-#include  "reentrant.h"\r
-#include  "local.h"\r
-\r
-int\r
-vswprintf(wchar_t * __restrict s, size_t n, const wchar_t * __restrict fmt,\r
-    va_list ap)\r
-{\r
-  static const mbstate_t initial = { 0 };\r
-  mbstate_t mbs;\r
-  FILE f;\r
-  char *mbp;\r
-  int ret, sverrno;\r
-  size_t nwc;\r
-  struct __sfileext fext;\r
-\r
-  if (n == 0) {\r
-    errno = EINVAL;\r
-    return (-1);\r
-  }\r
-\r
-  _FILEEXT_SETUP(&f, &fext);\r
-  f._file = -1;\r
-  f._flags = __SWR | __SSTR | __SALC;\r
-  f._bf._base = f._p = (unsigned char *)malloc(128);\r
-  if (f._bf._base == NULL) {\r
-    errno = ENOMEM;\r
-    return (-1);\r
-  }\r
-  f._bf._size = f._w = 127;   /* Leave room for the NUL */\r
-  ret = __vfwprintf_unlocked(&f, fmt, ap);\r
-  if (ret < 0) {\r
-    sverrno = errno;\r
-    free(f._bf._base);\r
-    errno = sverrno;\r
-    return (-1);\r
-  }\r
-  *f._p = '\0';\r
-  mbp = (char *)f._bf._base;\r
-  /*\r
-   * XXX Undo the conversion from wide characters to multibyte that\r
-   * fputwc() did in __vfwprintf().\r
-   */\r
-  mbs = initial;\r
-  nwc = mbsrtowcs(s, (const char **)&mbp, n, &mbs);\r
-  free(f._bf._base);\r
-  if (nwc == (size_t)-1) {\r
-    errno = EILSEQ;\r
-    return (-1);\r
-  }\r
-  if (nwc == n) {\r
-    s[n - 1] = L'\0';\r
-    errno = EOVERFLOW;\r
-    return (-1);\r
-  }\r
-\r
-  return (ret);\r
-}\r