From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7868) id C84063858CD1; Fri, 24 Nov 2023 10:37:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C84063858CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1700822235; bh=WyS9s2A0boIsK5DL43Az9de0J0dByAfHl4oUhBYcFSw=; h=From:To:Subject:Date:From; b=XmxtmzjbrS6QE6D1DeQN6fLVM6NZnlJDEceqcNjN2GqUtDFpu9TM0Kk3NYbVvkc33 oOGpv40kqAS2zu9+XzrIh5320JcbjfOT+4VrtkzOT3DsuttMJWRyl+v86r27zBYrCz luy6fXDShWag909BmlxughZfI69w3qK0ouUF0Sv8= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Takashi Yano To: newlib-cvs@sourceware.org Subject: [newlib-cygwin/cygwin-3_4-branch] newlib: nl_langinfo: Fix a bug of time stuff. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/cygwin-3_4-branch X-Git-Oldrev: 8d5043b32f8f6a6e569800bf9b872b901512a0c9 X-Git-Newrev: 4a7cc5af01e438b33f6544d99548fe5f4d2cb776 Message-Id: <20231124103715.C84063858CD1@sourceware.org> Date: Fri, 24 Nov 2023 10:37:15 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D4a7cc5af01e= 438b33f6544d99548fe5f4d2cb776 commit 4a7cc5af01e438b33f6544d99548fe5f4d2cb776 Author: Takashi Yano Date: Thu Nov 23 20:00:55 2023 +0900 newlib: nl_langinfo: Fix a bug of time stuff. =20 Previously, e.g. nl_langinfo(_NL_TIME_WMONTH_1) returns "February" due to the bug. Similarly, nl_langinfo(_NL_TIME_WWDAY_1) returns "Mon". This occurs because wide char month and weekday arrays are pointed off-by-one (e.g. the array wmon[12] is reffered as wmon[1-12] rather than wmon[0-11]). This patch fixes that. =20 Fixes: d47d5b850bed ("Extend locale support to maintain wide char value= s of native strings") Reviewed-by: Corinna Vinschen Signed-off-by: Takashi Yano Diff: --- newlib/libc/locale/nl_langinfo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/newlib/libc/locale/nl_langinfo.c b/newlib/libc/locale/nl_langi= nfo.c index eb984912f..f8fcbb462 100644 --- a/newlib/libc/locale/nl_langinfo.c +++ b/newlib/libc/locale/nl_langinfo.c @@ -78,6 +78,7 @@ static struct _nl_item_t _NLITEM (ctype, woutdigits[8]), _NLITEM (ctype, woutdigits[9]), _NLITEM (time, codeset), + _NLITEM (time, wmon[0]), _NLITEM (time, wmon[1]), _NLITEM (time, wmon[2]), _NLITEM (time, wmon[3]), @@ -89,7 +90,7 @@ static struct _nl_item_t _NLITEM (time, wmon[9]), _NLITEM (time, wmon[10]), _NLITEM (time, wmon[11]), - _NLITEM (time, wmon[12]), + _NLITEM (time, wmonth[0]), _NLITEM (time, wmonth[1]), _NLITEM (time, wmonth[2]), _NLITEM (time, wmonth[3]), @@ -101,21 +102,20 @@ static struct _nl_item_t _NLITEM (time, wmonth[9]), _NLITEM (time, wmonth[10]), _NLITEM (time, wmonth[11]), - _NLITEM (time, wmonth[12]), + _NLITEM (time, wwday[0]), _NLITEM (time, wwday[1]), _NLITEM (time, wwday[2]), _NLITEM (time, wwday[3]), _NLITEM (time, wwday[4]), _NLITEM (time, wwday[5]), _NLITEM (time, wwday[6]), - _NLITEM (time, wwday[7]), + _NLITEM (time, wweekday[0]), _NLITEM (time, wweekday[1]), _NLITEM (time, wweekday[2]), _NLITEM (time, wweekday[3]), _NLITEM (time, wweekday[4]), _NLITEM (time, wweekday[5]), _NLITEM (time, wweekday[6]), - _NLITEM (time, wweekday[7]), _NLITEM (time, wX_fmt), _NLITEM (time, wx_fmt), _NLITEM (time, wc_fmt),