[Fontconfig-bugs] [Bug 95481] Build fails on Android due to broken lconv struct

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu May 26 05:26:22 UTC 2016


https://bugs.freedesktop.org/show_bug.cgi?id=95481

Akira TAGOH <akira at tagoh.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|fontconfig-bugs at lists.freed |akira at tagoh.org
                   |esktop.org                  |
                 CC|                            |akira at tagoh.org,
                   |                            |fontconfig-bugs at lists.freed
                   |                            |esktop.org
             Status|NEW                         |ASSIGNED

--- Comment #1 from Akira TAGOH <akira at tagoh.org> ---
Taking a look at the original code based on FcStrtod(), i.e. glib's code and I
see they do ifdef with __BIONIC__ which was introduced to fix an issue on
Android. does this patch work?

diff --git a/src/fcxml.c b/src/fcxml.c
index cd8fff1..f9b5975 100644
--- a/src/fcxml.c
+++ b/src/fcxml.c
@@ -1352,7 +1352,11 @@ FcParseInt (FcConfigParse *parse)
 static double
 FcStrtod (char *s, char **end)
 {
+#ifndef __BIONIC__
     struct lconv    *locale_data;
+#endif
+    const char     *decimal_point;
+    int                    dlen;
     char           *dot;
     double         v;

@@ -1360,14 +1364,21 @@ FcStrtod (char *s, char **end)
      * Have to swap the decimal point to match the current locale
      * if that locale doesn't use 0x2e
      */
+#ifndef __BIONIC__
+    locale_data = localeconv ();
+    decimal_point = locale_data->decimal_point;
+    dlen = strlen (decimal_point);
+#else
+    decimal_point = ".";
+    dlen = 1;
+#endif
+
     if ((dot = strchr (s, 0x2e)) &&
-       (locale_data = localeconv ()) &&
-       (locale_data->decimal_point[0] != 0x2e ||
-        locale_data->decimal_point[1] != 0))
+       (decimal_point[0] != 0x2e ||
+        decimal_point[1] != 0))
     {
        char    buf[128];
        int     slen = strlen (s);
-       int     dlen = strlen (locale_data->decimal_point);

        if (slen + dlen > (int) sizeof (buf))
        {

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/fontconfig-bugs/attachments/20160526/2e5f8577/attachment.html>


More information about the Fontconfig-bugs mailing list