This is the mail archive of the
libc-alpha@cygnus.com
mailing list for the glibc project.
glibc strftime multibyte format bugs (Emacs 20.3, Solaris 2.6, ja)
- To: libc-alpha@cygnus.com
- Subject: glibc strftime multibyte format bugs (Emacs 20.3, Solaris 2.6, ja)
- From: Paul Eggert <eggert@twinsun.com>
- Date: Wed, 2 Sep 1998 18:41:41 -0700 (PDT)
When using GNU Emacs 20.3 under Solaris 2.6 in Japanese mode, I
noticed some encoding errors when running strftime, due to some bugs
in code that I introduced in my 1997-11-02 patch to strftime.c.
I enclose a patch below.
1998-09-02 Paul Eggert <eggert@twinsun.com>
* strftime.c (my_strftime): When mbrlen returns (size_t) -2,
copy the redundant bytes at the end of the format as-is; don't
just copy their first byte and then rescan, as that might get
us an encoding error.
Account correctly for the length of multibyte sequences in the
format.
===================================================================
RCS file: strftime.c,v
retrieving revision 20.3
retrieving revision 20.3.0.1
diff -u -r20.3 -r20.3.0.1
--- strftime.c 1998/04/27 23:48:59 20.3
+++ strftime.c 1998/09/03 00:08:32 20.3.0.1
@@ -544,7 +544,13 @@
if (bytes == 0)
break;
- if (bytes == (size_t) -2 || bytes == (size_t) -1)
+ if (bytes == (size_t) -2)
+ {
+ len += strlen (f + len);
+ break;
+ }
+
+ if (bytes == (size_t) -1)
{
len++;
break;
@@ -555,6 +561,7 @@
while (! mbsinit (&mbstate));
cpy (len, f);
+ f += len - 1;
continue;
}
}