summaryrefslogtreecommitdiff
path: root/StdLib/LibC/Stdio/vfwscanf.c
diff options
context:
space:
mode:
authorDaryl McDaniel <daryl.mcdaniel@intel.com>2014-07-17 20:54:49 +0000
committerdarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>2014-07-17 20:54:49 +0000
commitdfa51bb619b455315a0476d0f2335da41268a2a2 (patch)
tree72dfbd3440d46e2afa70c835ffec7c8c066678ec /StdLib/LibC/Stdio/vfwscanf.c
parentcaf89d64ff700b3d8807f477c172feaaae85d5f3 (diff)
downloadedk2-platforms-dfa51bb619b455315a0476d0f2335da41268a2a2.tar.xz
StdLib: Simple code cleanup
StdLib/LibC/Main/Main.c Change Print to Debug statements. Ensure errno is initialized to 0 before calling main(). StdLib/LibC/StdLib/Malloc.c Aesthetic Cleanup: remove unnecessary cast, fix two whitespace alignment problems. StdLib/LibC/Uefi/InteractiveIO/NonCanonRead.c Change Include order. StdLib/Include/paths.h Add definition _PATH_LIB for the path to the library directory: /Efi/StdLib/lib. StdLib/LibC/Stdio/vfwscanf.c Align declarations and initializations. Initialize the multipurpose pointer, p, to NULL. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Daryl McDaniel <daryl.mcdaniel@intel.com> Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15664 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'StdLib/LibC/Stdio/vfwscanf.c')
-rw-r--r--StdLib/LibC/Stdio/vfwscanf.c74
1 files changed, 39 insertions, 35 deletions
diff --git a/StdLib/LibC/Stdio/vfwscanf.c b/StdLib/LibC/Stdio/vfwscanf.c
index 7bf3f66690..ae149c3602 100644
--- a/StdLib/LibC/Stdio/vfwscanf.c
+++ b/StdLib/LibC/Stdio/vfwscanf.c
@@ -1,5 +1,7 @@
-/*-
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
+/** @file
+ valist worker function for the wide-character fscanf.
+
+ Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
@@ -96,10 +98,10 @@
* The following are used in integral conversions only:
* SIGNOK, NDIGITS, PFXOK, and NZDIGITS
*/
-#define SIGNOK 0x40 /* +/- is (still) legal */
-#define NDIGITS 0x80 /* no digits detected */
-#define PFXOK 0x100 /* 0x prefix is (still) legal */
-#define NZDIGITS 0x200 /* no zero digits detected */
+#define SIGNOK 0x40 /* +/- is (still) legal */
+#define NDIGITS 0x80 /* no digits detected */
+#define PFXOK 0x100 /* 0x prefix is (still) legal */
+#define NZDIGITS 0x200 /* no zero digits detected */
#define HAVESIGN 0x10000 /* sign detected */
/*
@@ -138,38 +140,40 @@ vfwscanf(FILE * __restrict fp, const wchar_t * __restrict fmt, va_list ap)
int
__vfwscanf_unlocked(FILE * __restrict fp, const wchar_t * __restrict fmt, va_list ap)
{
- wint_t c; /* character from format, or conversion */
- size_t width; /* field width, or 0 */
- wchar_t *p; /* points into all kinds of strings */
- int n; /* handy integer */
- int flags; /* flags as defined above */
- wchar_t *p0; /* saves original value of p when necessary */
- int nassigned; /* number of fields assigned */
- int nconversions; /* number of conversions */
- int nread; /* number of characters consumed from fp */
- int base; /* base argument to conversion function */
- wchar_t buf[BUF]; /* buffer for numeric conversions */
- const wchar_t *ccls; /* character class start */
- const wchar_t *ccle; /* character class end */
- int cclcompl; /* ccl is complemented? */
- wint_t wi; /* handy wint_t */
- char *mbp; /* multibyte string pointer for %c %s %[ */
- size_t nconv; /* number of bytes in mb. conversion */
- char mbbuf[MB_LEN_MAX]; /* temporary mb. character buffer */
- static const mbstate_t initial = { 0 };
- mbstate_t mbs;
-
+ wint_t c; /* character from format, or conversion */
+ size_t width; /* field width, or 0 */
+ wchar_t *p = NULL; /* points into all kinds of strings */
+ int n; /* handy integer */
+ int flags; /* flags as defined above */
+ wchar_t *p0; /* saves original value of p when necessary */
+ int nassigned; /* number of fields assigned */
+ int nconversions; /* number of conversions */
+ int nread; /* number of characters consumed from fp */
+ int base; /* base argument to conversion function */
+ wchar_t buf[BUF]; /* buffer for numeric conversions */
+ const wchar_t *ccls; /* character class start */
+ const wchar_t *ccle; /* character class end */
+ int cclcompl; /* ccl is complemented? */
+ wint_t wi; /* handy wint_t */
+ char *mbp; /* multibyte string pointer for %c %s %[ */
+ size_t nconv; /* number of bytes in mb. conversion */
+ char mbbuf[MB_LEN_MAX]; /* temporary mb. character buffer */
+ mbstate_t mbs;
+
+ static const mbstate_t initial = { 0 };
/* `basefix' is used to avoid `if' tests in the integer scanner */
- static short basefix[17] =
+ static short basefix[17] =
{ 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
- nassigned = 0;
- nconversions = 0;
- nread = 0;
- ccls = ccle = NULL;
- base = 0;
- cclcompl = 0;
- mbp = NULL;
+ nassigned = 0;
+ nconversions = 0;
+ nread = 0;
+ ccls = NULL;
+ ccle = NULL;
+ base = 0;
+ cclcompl = 0;
+ mbp = NULL;
+
for (;;) {
c = *fmt++;
if (c == 0)