about summary refs log tree commit diff
path: root/time
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-02-08 10:05:09 +0000
committerJakub Jelinek <jakub@redhat.com>2005-02-08 10:05:09 +0000
commitd585b66fa4d11059948f466c9080a6826932358d (patch)
tree8b06692920852c297635b46a7d616c3066f95fac /time
parente7cbcee4982d8caa809a91c9cfef5fda67445f0a (diff)
downloadglibc-d585b66fa4d11059948f466c9080a6826932358d.tar.gz
glibc-d585b66fa4d11059948f466c9080a6826932358d.tar.xz
glibc-d585b66fa4d11059948f466c9080a6826932358d.zip
Updated to fedora-glibc-20050208T0948 cvs/fedora-glibc-2_3_4-6
Diffstat (limited to 'time')
-rw-r--r--time/strptime_l.c12
-rw-r--r--time/tst-strptime.c22
2 files changed, 27 insertions, 7 deletions
diff --git a/time/strptime_l.c b/time/strptime_l.c
index df98099f0a..01c4f8282a 100644
--- a/time/strptime_l.c
+++ b/time/strptime_l.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -539,10 +539,12 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
 	    }
 #endif
 	  if (!match_string (HERE_AM_STR, rp))
-	    if (match_string (HERE_PM_STR, rp))
-	      is_pm = 1;
-	    else
-	      return NULL;
+	    {
+	      if (match_string (HERE_PM_STR, rp))
+		is_pm = 1;
+	      else
+		return NULL;
+	    }
 	  break;
 	case 'r':
 #ifdef _NL_CURRENT
diff --git a/time/tst-strptime.c b/time/tst-strptime.c
index a0b2ebedd2..6356aa0d41 100644
--- a/time/tst-strptime.c
+++ b/time/tst-strptime.c
@@ -42,6 +42,10 @@ 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 },
+  { "ja_JP.EUC-JP", "2000-01-01 08:12:21 AM", "%Y-%m-%d %I:%M:%S %p",
+    6, 0, 0, 1 },
+  { "en_US.ISO-8859-1", "2000-01-01 08:12:21 PM", "%Y-%m-%d %I:%M:%S %p",
+    6, 0, 0, 1 },
   { "ja_JP.EUC-JP", "2001 20 \xb7\xee", "%Y %U %a", 1, 140, 4, 21 },
   { "ja_JP.EUC-JP", "2001 21 \xb7\xee", "%Y %W %a", 1, 140, 4, 21 },
 };
@@ -73,7 +77,14 @@ test_tm (void)
     {
       memset (&tm, '\0', sizeof (tm));
 
-      if (*strptime (tm_tests[i].input, tm_tests[i].format, &tm) != '\0')
+      char *ret = strptime (tm_tests[i].input, tm_tests[i].format, &tm);
+      if (ret == NULL)
+	{
+	  printf ("strptime returned NULL for `%s'\n", tm_tests[i].input);
+	  result = 1;
+	  continue;
+	}
+      else if (*ret != '\0')
 	{
 	  printf ("not all of `%s' read\n", tm_tests[i].input);
 	  result = 1;
@@ -127,7 +138,14 @@ main (int argc, char *argv[])
 	  exit (EXIT_FAILURE);
 	}
 
-      if (*strptime (day_tests[i].input, day_tests[i].format, &tm) != '\0')
+      char *ret = strptime (day_tests[i].input, day_tests[i].format, &tm);
+      if (ret == NULL)
+	{
+	  printf ("strptime returned NULL for `%s'\n", day_tests[i].input);
+	  result = 1;
+	  continue;
+	}
+      else if (*ret != '\0')
 	{
 	  printf ("not all of `%s' read\n", day_tests[i].input);
 	  result = 1;