]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/LibC/Stdio/vfwscanf.c
StdLib: Simple code cleanup
[mirror_edk2.git] / StdLib / LibC / Stdio / vfwscanf.c
index 7bf3f666903c4d223bf74c6c24ecbfa088ca7e50..ae149c3602f2e4eb0daf1db14c513a5fe5a9bd97 100644 (file)
@@ -1,5 +1,7 @@
-/*-\r
-  Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+/** @file\r
+  valist worker function for the wide-character fscanf.\r
+\r
+  Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials are licensed and made available under\r
   the terms and conditions of the BSD License that accompanies this distribution.\r
   The full text of the license may be found at\r
  * The following are used in integral conversions only:\r
  * SIGNOK, NDIGITS, PFXOK, and NZDIGITS\r
  */\r
-#define SIGNOK    0x40  /* +/- is (still) legal */\r
-#define NDIGITS   0x80  /* no digits detected */\r
-#define PFXOK   0x100 /* 0x prefix is (still) legal */\r
-#define NZDIGITS  0x200 /* no zero digits detected */\r
+#define SIGNOK    0x40    /* +/- is (still) legal */\r
+#define NDIGITS   0x80    /* no digits detected */\r
+#define PFXOK     0x100   /* 0x prefix is (still) legal */\r
+#define NZDIGITS  0x200   /* no zero digits detected */\r
 #define HAVESIGN  0x10000 /* sign detected */\r
 \r
 /*\r
@@ -138,38 +140,40 @@ vfwscanf(FILE * __restrict fp, const wchar_t * __restrict fmt, va_list ap)
 int\r
 __vfwscanf_unlocked(FILE * __restrict fp, const wchar_t * __restrict fmt, va_list ap)\r
 {\r
-  wint_t c;   /* character from format, or conversion */\r
-  size_t width;   /* field width, or 0 */\r
-  wchar_t *p;   /* points into all kinds of strings */\r
-  int n;      /* handy integer */\r
-  int flags;    /* flags as defined above */\r
-  wchar_t *p0;    /* saves original value of p when necessary */\r
-  int nassigned;    /* number of fields assigned */\r
-  int nconversions; /* number of conversions */\r
-  int nread;    /* number of characters consumed from fp */\r
-  int base;   /* base argument to conversion function */\r
-  wchar_t buf[BUF]; /* buffer for numeric conversions */\r
-  const wchar_t *ccls;  /* character class start */\r
-  const wchar_t *ccle;  /* character class end */\r
-  int cclcompl;   /* ccl is complemented? */\r
-  wint_t wi;    /* handy wint_t */\r
-  char *mbp;    /* multibyte string pointer for %c %s %[ */\r
-  size_t nconv;   /* number of bytes in mb. conversion */\r
-  char mbbuf[MB_LEN_MAX]; /* temporary mb. character buffer */\r
-  static const mbstate_t initial = { 0 };\r
-  mbstate_t mbs;\r
-\r
+  wint_t                  c;                            /* character from format, or conversion */\r
+  size_t                  width;                        /* field width, or 0 */\r
+  wchar_t                *p                   = NULL;   /* points into all kinds of strings */\r
+  int                     n;                            /* handy integer */\r
+  int                     flags;                        /* flags as defined above */\r
+  wchar_t                *p0;                           /* saves original value of p when necessary */\r
+  int                     nassigned;                    /* number of fields assigned */\r
+  int                     nconversions;                 /* number of conversions */\r
+  int                     nread;                        /* number of characters consumed from fp */\r
+  int                     base;                         /* base argument to conversion function */\r
+  wchar_t                 buf[BUF];                     /* buffer for numeric conversions */\r
+  const wchar_t          *ccls;                         /* character class start */\r
+  const wchar_t          *ccle;                         /* character class end */\r
+  int                     cclcompl;                     /* ccl is complemented? */\r
+  wint_t                  wi;                           /* handy wint_t */\r
+  char                   *mbp;                          /* multibyte string pointer for %c %s %[ */\r
+  size_t                  nconv;                        /* number of bytes in mb. conversion */\r
+  char                    mbbuf[MB_LEN_MAX];            /* temporary mb. character buffer */\r
+  mbstate_t               mbs;\r
+\r
+  static const mbstate_t  initial             = { 0 };\r
   /* `basefix' is used to avoid `if' tests in the integer scanner */\r
-  static short basefix[17] =\r
+  static short            basefix[17] =\r
     { 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };\r
 \r
-  nassigned = 0;\r
-  nconversions = 0;\r
-  nread = 0;\r
-  ccls = ccle = NULL;\r
-  base = 0;\r
-  cclcompl = 0;\r
-  mbp = NULL;\r
+  nassigned     = 0;\r
+  nconversions  = 0;\r
+  nread         = 0;\r
+  ccls          = NULL;\r
+  ccle          = NULL;\r
+  base          = 0;\r
+  cclcompl      = 0;\r
+  mbp           = NULL;\r
+\r
   for (;;) {\r
     c = *fmt++;\r
     if (c == 0)\r