[vlc-devel] commit: freetype: initialise fontresult to FcResultMatch (Ilkka Ollakka )

git version control git at videolan.org
Sat Aug 1 12:08:49 CEST 2009


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sat Aug  1 13:04:19 2009 +0300| [592f40d6b0c6010051d8867a791301cb90dbc760] | committer: Ilkka Ollakka 

freetype: initialise fontresult to FcResultMatch

fontconfig doesn't really seem to set that result variable correctly
in allmost all cases, only few codepaths that it's setted to NoMatch,
but it doesn't get setted on valid paths or configerrors or any of
thosecases. Thanks to Laurent Aimar for this one.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=592f40d6b0c6010051d8867a791301cb90dbc760
---

 modules/misc/freetype.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/modules/misc/freetype.c b/modules/misc/freetype.c
index 00090cc..d0f4011 100644
--- a/modules/misc/freetype.c
+++ b/modules/misc/freetype.c
@@ -298,7 +298,9 @@ static int Create( vlc_object_t *p_this )
 
 #ifdef HAVE_FONTCONFIG
     FcPattern     *fontpattern = NULL, *fontmatch = NULL;
-    FcResult       fontresult = FcResultNoMatch;
+    /* Initialise result to Match, as fontconfig doesnt
+     * really set this other than some error-cases */
+    FcResult       fontresult = FcResultMatch;
 #endif
 
 
@@ -362,6 +364,9 @@ static int Create( vlc_object_t *p_this )
         goto error;
     FcDefaultSubstitute( fontpattern );
 
+    /* testing fontresult here doesn't do any good really, but maybe it will
+     * in future as fontconfig code doesn't set it in all cases and just
+     * returns NULL or doesn't set to to Match on all Match cases.*/
     fontmatch = FcFontMatch( NULL, fontpattern, &fontresult );
     if( !fontmatch || fontresult == FcResultNoMatch )
         goto error;




More information about the vlc-devel mailing list