mirror of git://sourceware.org/git/glibc.git
[BZ #28]
Update. * time/strptime_l.c (__strptime_internal): Fix handling of %Ey. [BZ #28]
This commit is contained in:
parent
0a1be81598
commit
1750bc8d9b
|
@ -1,5 +1,8 @@
|
||||||
2004-08-08 Ulrich Drepper <drepper@redhat.com>
|
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.
|
* po/sv.po: Update from translation team.
|
||||||
|
|
||||||
2004-08-07 Ulrich Drepper <drepper@redhat.com>
|
2004-08-07 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <langinfo.h>
|
#include <langinfo.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
@ -732,30 +733,26 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
|
||||||
else
|
else
|
||||||
return NULL;
|
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,
|
era = _nl_select_era_entry (era_cnt
|
||||||
_NL_TIME_ERA_NUM_ENTRIES);
|
HELPER_LOCALE_ARG);
|
||||||
for (era_cnt = 0; era_cnt < (int) num_eras;
|
if (era != NULL && match_string (era->era_name, rp))
|
||||||
++era_cnt, rp = rp_backup)
|
|
||||||
{
|
{
|
||||||
era = _nl_select_era_entry (era_cnt
|
*decided = loc;
|
||||||
HELPER_LOCALE_ARG);
|
break;
|
||||||
if (era != NULL && match_string (era->era_name, rp))
|
|
||||||
{
|
|
||||||
*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;
|
*decided = raw;
|
||||||
}
|
}
|
||||||
|
@ -763,15 +760,66 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM)
|
||||||
normal representation. */
|
normal representation. */
|
||||||
goto match_century;
|
goto match_century;
|
||||||
case 'y':
|
case 'y':
|
||||||
if (*decided == raw)
|
if (*decided != raw)
|
||||||
goto match_year_in_century;
|
{
|
||||||
|
get_number(0, 9999, 4);
|
||||||
|
tm->tm_year = val;
|
||||||
|
want_era = 1;
|
||||||
|
want_xday = 1;
|
||||||
|
want_century = 1;
|
||||||
|
|
||||||
get_number(0, 9999, 4);
|
if (era_cnt >= 0)
|
||||||
tm->tm_year = val;
|
{
|
||||||
want_era = 1;
|
assert (*decided == loc);
|
||||||
want_xday = 1;
|
|
||||||
want_century = 1;
|
era = _nl_select_era_entry (era_cnt HELPER_LOCALE_ARG);
|
||||||
break;
|
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':
|
case 'Y':
|
||||||
if (*decided != raw)
|
if (*decided != raw)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue