]> sourceware.org Git - glibc.git/commitdiff
Allow strptime read outputs from strftime. Fixes bug 4772.
authorOndřej Bílka <neleai@seznam.cz>
Wed, 4 Dec 2013 12:53:13 +0000 (13:53 +0100)
committerOndřej Bílka <neleai@seznam.cz>
Wed, 4 Dec 2013 12:53:13 +0000 (13:53 +0100)
ChangeLog
time/strptime_l.c
time/tst-strptime.c

index c191b980751e8f5121b5058cc8a500dfda187e52..2f04edda399b9e3c548b17cc8169e10a45e89e5e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-12-04  Ondřej Bílka  <neleai@seznam.cz>
+
+       [BZ #4772]
+       * time/strptime_l.c (__strptime_internal): Allow modifiers
+       in strptime.
+       * time/tst-strptime.c (day_tests): Add testcase.
+
+
 2013-12-04  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
        * scripts/bench.pl: Skip over blank lines.
index c2c2ee83c545e2c42a467e1b18d45e995b0c0ac9..b9a8e144fefb2128d3250925a6e4b072a6523cc3 100644 (file)
@@ -320,17 +320,14 @@ __strptime_internal (rp, fmt, tmp, statep LOCALE_PARAM)
        }
 
       ++fmt;
-      if (statep != NULL)
-       {
-         /* In recursive calls silently discard strftime modifiers.  */
-         while (*fmt == '-' || *fmt == '_' || *fmt == '0'
-                || *fmt == '^' || *fmt == '#')
-           ++fmt;
-
-         /* And field width.  */
-         while (*fmt >= '0' && *fmt <= '9')
-           ++fmt;
-       }
+      /* We discard strftime modifiers.  */
+      while (*fmt == '-' || *fmt == '_' || *fmt == '0'
+            || *fmt == '^' || *fmt == '#')
+       ++fmt;
+
+      /* And field width.  */
+      while (*fmt >= '0' && *fmt <= '9')
+       ++fmt;
 
 #ifndef _NL_CURRENT
       /* We need this for handling the `E' modifier.  */
index 193f7dbe0e68ca3c075876eb60e465837bf61d5e..5c5fa7b805c65950aa6ac5ead26f2e9ee2da6edd 100644 (file)
@@ -41,6 +41,8 @@ static const struct
   { "C", "19990502123412", "%Y%m%d%H%M%S", 0, 121, 4, 2 },
   { "C", "2001 20 Mon", "%Y %U %a", 1, 140, 4, 21 },
   { "C", "2001 21 Mon", "%Y %W %a", 1, 140, 4, 21 },
+  { "C", "2001 21 Mon", "%2000Y %W %a", 1, 140, 4, 21 },
+  { "C", "2001 21 Mon", "%^Y %W %a", 1, 140, 4, 21 },
   { "C", "2001 EST 21 Mon", "%Y %Z %W %a", 1, 140, 4, 21 },
   { "C", "2012 00 Sun", "%Y %W %a", 0, 0, 0, 1 },
   { "ja_JP.EUC-JP", "2000-01-01 08:12:21 AM", "%Y-%m-%d %I:%M:%S %p",
This page took 0.13502 seconds and 5 git commands to generate.