texlive[50234] Build/source/texk/bibtex-x: use u_strFromUTF8WithSub()

commits+kakuto at tug.org commits+kakuto at tug.org
Tue Mar 5 05:24:00 CET 2019


Revision: 50234
          http://tug.org/svn/texlive?view=revision&revision=50234
Author:   kakuto
Date:     2019-03-05 05:23:59 +0100 (Tue, 05 Mar 2019)
Log Message:
-----------
use u_strFromUTF8WithSub() with a change U_SENTINEL ---> 0xfffd

Modified Paths:
--------------
    trunk/Build/source/texk/bibtex-x/ChangeLog
    trunk/Build/source/texk/bibtex-x/bibtex-2.c

Modified: trunk/Build/source/texk/bibtex-x/ChangeLog
===================================================================
--- trunk/Build/source/texk/bibtex-x/ChangeLog	2019-03-05 01:23:16 UTC (rev 50233)
+++ trunk/Build/source/texk/bibtex-x/ChangeLog	2019-03-05 04:23:59 UTC (rev 50234)
@@ -1,6 +1,11 @@
 2019-03-05  Akira Kakuto  <kakuto at w32tex.org>
 
-	* bibtex-2.c: Avoid access violation on Windows.
+	* bibtex-2.c: Change U_SENTINEL to 0xfffd in
+	u_strFromUTF8WithSub(a, b, c, d, e, U_SENTINEL, NULL, f)
+	which is
+	u_strFromUTF8(a, b, c, d, e, f)
+	where U_SENTINEL is -1, because it works also for my
+	build of ICU.
 
 2019-03-04  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
 

Modified: trunk/Build/source/texk/bibtex-x/bibtex-2.c
===================================================================
--- trunk/Build/source/texk/bibtex-x/bibtex-2.c	2019-03-05 01:23:16 UTC (rev 50233)
+++ trunk/Build/source/texk/bibtex-x/bibtex-2.c	2019-03-05 04:23:59 UTC (rev 50234)
@@ -2962,28 +2962,31 @@
 /*
 icu_toUChars() seems not working here, using u_strFromUTF8 instead. (04/mar/2019)
 */
+
 /*
+On Windows, u_strFromUTF8() fails but u_strFromUTF8WithSub()
+with U_SENTINEL (-1) ---> 0xfffd works.
+So I use u_strFromUTF8WithSub() by replacing 0xffffffff --> 0xfffd.
+--ak (05/mar/2019)
+*/
+
+/*
   uchlen1 = icu_toUChars(entry_strs, (ptr1 * (ENT_STR_SIZE+1)), lenk1, uch1, ucap);
   uchlen2 = icu_toUChars(entry_strs, (ptr2 * (ENT_STR_SIZE+1)), lenk2, uch2, ucap);
 */
-  u_strFromUTF8(uch1, ucap, &uchlen1, (char *)&ENTRY_STRS(ptr1, 0), lenk1, &err1);
-  u_strFromUTF8(uch2, ucap, &uchlen2, (char *)&ENTRY_STRS(ptr2, 0), lenk2, &err1);
+  u_strFromUTF8WithSub(uch1, ucap, &uchlen1, (char *)&ENTRY_STRS(ptr1, 0), lenk1, 0xfffd, NULL, &err1);
+  u_strFromUTF8WithSub(uch2, ucap, &uchlen2, (char *)&ENTRY_STRS(ptr2, 0), lenk2, 0xfffd, NULL, &err1);
 
 /*
-   In my Windows build, the above fails: err1 != U_ZERO_ERROR, which
-   gives access violation in ucol_open(). Maybe my ICU build is wrong.
-   In this case I use the original functions which seem not working,
-   only to avoid a crash by access violation. Thus I cannot support
-   correct behavior for bibtexu on Windows.  -- A. Kakuto 2019/03/05
+  If err1 != U_ZERO_ERROR, we use the original functions.
 */
 
   if (!U_SUCCESS(err1)) {
     uchlen1 = icu_toUChars(entry_strs, (ptr1 * (ENT_STR_SIZE+1)), lenk1, uch1, ucap);
     uchlen2 = icu_toUChars(entry_strs, (ptr2 * (ENT_STR_SIZE+1)), lenk2, uch2, ucap);
+  err1 = U_ZERO_ERROR;
   }
 
-  err1 = U_ZERO_ERROR;
-
   if(Flag_location)
     ucol1 = ucol_open(Str_location, &err1);
   else



More information about the tex-live-commits mailing list