|
|
66498b |
From 198358dd8ff858c9e36531a7406ccb2246ae77b7 Mon Sep 17 00:00:00 2001
|
|
|
66498b |
From: Akira TAGOH <akira@tagoh.org>
|
|
|
66498b |
Date: Mon, 12 Mar 2018 11:49:58 +0900
|
|
|
66498b |
Subject: [PATCH] Allow the constant names in the range
|
|
|
66498b |
|
|
|
66498b |
https://bugs.freedesktop.org/show_bug.cgi?id=105415
|
|
|
66498b |
---
|
|
|
66498b |
src/fcname.c | 34 +++++++++++++++++++++++++++++-----
|
|
|
66498b |
1 file changed, 29 insertions(+), 5 deletions(-)
|
|
|
66498b |
|
|
|
66498b |
diff --git a/src/fcname.c b/src/fcname.c
|
|
|
66498b |
index 79e413e..15fb659 100644
|
|
|
66498b |
--- a/src/fcname.c
|
|
|
66498b |
+++ b/src/fcname.c
|
|
|
66498b |
@@ -330,13 +330,37 @@ FcNameConvert (FcType type, FcChar8 *string)
|
|
|
66498b |
case FcTypeRange:
|
|
|
66498b |
if (sscanf ((char *) string, "[%lg %lg]", &b, &e) != 2)
|
|
|
66498b |
{
|
|
|
66498b |
- v.u.d = strtod ((char *) string, &p);
|
|
|
66498b |
- if (p != NULL && p[0] != 0)
|
|
|
66498b |
+ char *sc, *ec;
|
|
|
66498b |
+ size_t len = strlen ((const char *) string);
|
|
|
66498b |
+ int si, ei;
|
|
|
66498b |
+
|
|
|
66498b |
+ sc = malloc (len);
|
|
|
66498b |
+ ec = malloc (len);
|
|
|
66498b |
+ if (sc && ec && sscanf ((char *) string, "[%s %[^]]]", sc, ec) == 2)
|
|
|
66498b |
{
|
|
|
66498b |
- v.type = FcTypeVoid;
|
|
|
66498b |
- break;
|
|
|
66498b |
+ if (FcNameConstant ((const FcChar8 *) sc, &si) &&
|
|
|
66498b |
+ FcNameConstant ((const FcChar8 *) ec, &ei))
|
|
|
66498b |
+ v.u.r = FcRangeCreateDouble (si, ei);
|
|
|
66498b |
+ else
|
|
|
66498b |
+ goto bail1;
|
|
|
66498b |
+ }
|
|
|
66498b |
+ else
|
|
|
66498b |
+ {
|
|
|
66498b |
+ bail1:
|
|
|
66498b |
+ v.type = FcTypeDouble;
|
|
|
66498b |
+ if (FcNameConstant (string, &si))
|
|
|
66498b |
+ {
|
|
|
66498b |
+ v.u.d = (double) si;
|
|
|
66498b |
+ } else {
|
|
|
66498b |
+ v.u.d = strtod ((char *) string, &p);
|
|
|
66498b |
+ if (p != NULL && p[0] != 0)
|
|
|
66498b |
+ v.type = FcTypeVoid;
|
|
|
66498b |
+ }
|
|
|
66498b |
}
|
|
|
66498b |
- v.type = FcTypeDouble;
|
|
|
66498b |
+ if (sc)
|
|
|
66498b |
+ free (sc);
|
|
|
66498b |
+ if (ec)
|
|
|
66498b |
+ free (ec);
|
|
|
66498b |
}
|
|
|
66498b |
else
|
|
|
66498b |
v.u.r = FcRangeCreateDouble (b, e);
|
|
|
66498b |
--
|
|
|
66498b |
2.14.3
|
|
|
66498b |
|