fontconfig: Branch 'main' - 3 commits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 src/fccfg.c |   34 ++++++++++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 4 deletions(-)

New commits:
commit 6a87e157395c3e552aabe1c0ccf605dac47ba1f5
Merge: cfef476 aaeb9ed
Author: Akira TAGOH <akira@xxxxxxxxx>
Date:   Mon Jan 6 06:34:51 2025 +0000

    Merge branch 'issues/442' into 'main'
    
    Deal with glob string properly
    
    Closes #442
    
    See merge request fontconfig/fontconfig!355

commit aaeb9edc3f92654801ea36779d402534358db6ac
Author: Akira TAGOH <akira@xxxxxxxxx>
Date:   Mon Jan 6 14:57:32 2025 +0900

    Another fix of glob string for Win32

diff --git a/src/fccfg.c b/src/fccfg.c
index 8d9427f..6fd3083 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -2990,7 +2990,7 @@ FcConfigGlobAdd (FcConfig	*config,
 {
     FcStrSet	*set = accept ? config->acceptGlobs : config->rejectGlobs;
     FcChar8     *realglob = FcStrCopyFilename(glob);
-    FcChar8     *cwd = FcStrCopyFilename((const FcChar8 *) "");
+    FcChar8     *cwd = FcStrCopyFilename((const FcChar8 *) ".");
     const FcChar8 *s;
     FcBool       ret;
     size_t       len = 0;
@@ -3006,8 +3006,11 @@ FcConfigGlobAdd (FcConfig	*config,
     else
     {
 	    len = strlen((const char *) cwd);
+	    /* No need to use FC_DIR_SEPARATOR because '\\' will be
+	     * replaced with / by FcConvertDosPath in FcStrCanonFilename
+	     */
 	    if (strncmp((const char *) cwd, (const char *) realglob, len) == 0 &&
-		realglob[len] == FC_DIR_SEPARATOR)
+		realglob[len] == '/')
 		    s = &realglob[len + 1];
 	    else
 		    s = realglob;
commit 8f54cb21c366a97d9c30723bff27d15e70aa7729
Author: Akira TAGOH <akira@xxxxxxxxx>
Date:   Mon Jan 6 14:29:42 2025 +0900

    Deal with glob string properly
    
    This is a regression of da1e3f35e61597fbf58c9c550ceba6d44abb1563
    
    FcStrCopyFilename canonicalize a glob string though, the above
    change expected to expand ~ character only to replace it with
    a home directory.
    However this also had a side-effect; adding a current directory
    name if no home nor absolute path name in a glob string.
    
    This isn't expected behavior here. So dropping it if there are,
    otherwise use it as it is.
    
    Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/442

diff --git a/src/fccfg.c b/src/fccfg.c
index c951020..8d9427f 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -2989,12 +2989,35 @@ FcConfigGlobAdd (FcConfig	*config,
 		 FcBool		accept)
 {
     FcStrSet	*set = accept ? config->acceptGlobs : config->rejectGlobs;
-	FcChar8	*realglob = FcStrCopyFilename(glob);
-	if (!realglob)
-		return FcFalse;
+    FcChar8     *realglob = FcStrCopyFilename(glob);
+    FcChar8     *cwd = FcStrCopyFilename((const FcChar8 *) "");
+    const FcChar8 *s;
+    FcBool       ret;
+    size_t       len = 0;
+
+    /*
+     * FcStrCopyFilename canonicalize a path string and prepend
+     * current directory name if no path included in a string.
+     * This isn't a desired behavior here.
+     * So drop the extra path name if they have. Otherwise use it as it is.
+     */
+    if (cwd == NULL)
+	    s = glob;
+    else
+    {
+	    len = strlen((const char *) cwd);
+	    if (strncmp((const char *) cwd, (const char *) realglob, len) == 0 &&
+		realglob[len] == FC_DIR_SEPARATOR)
+		    s = &realglob[len + 1];
+	    else
+		    s = realglob;
+    }
+    if (!s)
+	    return FcFalse;
 
-    FcBool	 ret = FcStrSetAdd (set, realglob);
+    ret = FcStrSetAdd (set, s);
     FcStrFree(realglob);
+    FcStrFree(cwd);
     return ret;
 }
 



[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux