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