Update.
	* time/strptime_l.c (__strptime_internal): Fix handling of %Ey.
	[BZ #28]
This commit is contained in:
Ulrich Drepper 2004-08-08 22:20:57 +00:00
parent 0a1be81598
commit 1750bc8d9b
2 changed files with 79 additions and 28 deletions

View File

@ -1,5 +1,8 @@
2004-08-08 Ulrich Drepper <drepper@redhat.com>
* time/strptime_l.c (__strptime_internal): Fix handling of %Ey.
[BZ #28]
* po/sv.po: Update from translation team.
2004-08-07 Ulrich Drepper <drepper@redhat.com>

View File

@ -20,6 +20,7 @@
# include <config.h>
#endif
#include <assert.h>
#include <ctype.h>
#include <langinfo.h>
#include <limits.h>
@ -732,30 +733,26 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
else
return NULL;
}
else
num_eras = _NL_CURRENT_WORD (LC_TIME,
_NL_TIME_ERA_NUM_ENTRIES);
for (era_cnt = 0; era_cnt < (int) num_eras;
++era_cnt, rp = rp_backup)
{
num_eras = _NL_CURRENT_WORD (LC_TIME,
_NL_TIME_ERA_NUM_ENTRIES);
for (era_cnt = 0; era_cnt < (int) num_eras;
++era_cnt, rp = rp_backup)
era = _nl_select_era_entry (era_cnt
HELPER_LOCALE_ARG);
if (era != NULL && match_string (era->era_name, rp))
{
era = _nl_select_era_entry (era_cnt
HELPER_LOCALE_ARG);
if (era != NULL && match_string (era->era_name, rp))
{
*decided = loc;
break;
}
*decided = loc;
break;
}
if (era_cnt == (int) num_eras)
{
era_cnt = -1;
if (*decided == loc)
return NULL;
}
else
break;
}
if (era_cnt != (int) num_eras)
break;
era_cnt = -1;
if (*decided == loc)
return NULL;
*decided = raw;
}
@ -763,15 +760,66 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
normal representation. */
goto match_century;
case 'y':
if (*decided == raw)
goto match_year_in_century;
if (*decided != raw)
{
get_number(0, 9999, 4);
tm->tm_year = val;
want_era = 1;
want_xday = 1;
want_century = 1;
get_number(0, 9999, 4);
tm->tm_year = val;
want_era = 1;
want_xday = 1;
want_century = 1;
break;
if (era_cnt >= 0)
{
assert (*decided == loc);
era = _nl_select_era_entry (era_cnt HELPER_LOCALE_ARG);
bool match = false;
if (era != NULL)
{
int delta = ((tm->tm_year - era->offset)
* era->absolute_direction);
match = (delta >= 0
&& delta < (((int64_t) era->stop_date[0]
- (int64_t) era->start_date[0])
* era->absolute_direction));
}
if (! match)
return NULL;
break;
}
num_eras = _NL_CURRENT_WORD (LC_TIME,
_NL_TIME_ERA_NUM_ENTRIES);
for (era_cnt = 0; era_cnt < (int) num_eras; ++era_cnt)
{
era = _nl_select_era_entry (era_cnt
HELPER_LOCALE_ARG);
if (era != NULL)
{
int delta = ((tm->tm_year - era->offset)
* era->absolute_direction);
if (delta >= 0
&& delta < (((int64_t) era->stop_date[0]
- (int64_t) era->start_date[0])
* era->absolute_direction))
{
*decided = loc;
break;
}
}
}
if (era_cnt != (int) num_eras)
break;
era_cnt = -1;
if (*decided == loc)
return NULL;
*decided = raw;
}
goto match_year_in_century;
case 'Y':
if (*decided != raw)
{