From 24abc56b37a3ec32a03b7eafccd96607ae13ea89 Mon Sep 17 00:00:00 2001 From: marha Date: Tue, 29 Mar 2011 06:44:20 +0000 Subject: xserver fontconfig mesa git update 29 Mar 2011 --- fontconfig/src/fccfg.c | 13 +++++++++++-- fontconfig/src/fcftint.h | 2 +- fontconfig/src/fcmatrix.c | 6 +++--- fontconfig/src/fcpat.c | 10 +++++++--- fontconfig/src/ftglue.c | 16 ++++++++-------- 5 files changed, 30 insertions(+), 17 deletions(-) (limited to 'fontconfig') diff --git a/fontconfig/src/fccfg.c b/fontconfig/src/fccfg.c index 4beb7d236..09c59919d 100644 --- a/fontconfig/src/fccfg.c +++ b/fontconfig/src/fccfg.c @@ -1689,10 +1689,19 @@ static FcChar8 * FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file) { FcChar8 *path; + int size; if (!dir) dir = (FcChar8 *) ""; - path = malloc (strlen ((char *) dir) + 1 + strlen ((char *) file) + 1); + + size = strlen ((char *) dir) + 1 + strlen ((char *) file) + 1; + /* + * workaround valgrind warning because glibc takes advantage of how it knows memory is + * allocated to implement strlen by reading in groups of 4 + */ + size = (size + 3) & ~3; + + path = malloc (size); if (!path) return 0; @@ -1711,7 +1720,7 @@ FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file) #endif strcat ((char *) path, (char *) file); - FcMemAlloc (FC_MEM_STRING, strlen ((char *) path) + 1); + FcMemAlloc (FC_MEM_STRING, size); if (access ((char *) path, R_OK) == 0) return path; diff --git a/fontconfig/src/fcftint.h b/fontconfig/src/fcftint.h index f32d87c8b..a317370e1 100644 --- a/fontconfig/src/fcftint.h +++ b/fontconfig/src/fcftint.h @@ -50,5 +50,5 @@ FcFreeTypePrivateToUcs4 (FcChar32 private, const FcCharMap *map); FcPrivate const FcCharMap * FcFreeTypeGetPrivateMap (FT_Encoding encoding); - + #endif /* _FCFTINT_H_ */ diff --git a/fontconfig/src/fcmatrix.c b/fontconfig/src/fcmatrix.c index 1d6e2f6b0..f0c613918 100644 --- a/fontconfig/src/fcmatrix.c +++ b/fontconfig/src/fcmatrix.c @@ -30,10 +30,10 @@ const FcMatrix FcIdentityMatrix = { 1, 0, 0, 1 }; FcMatrix * -FcMatrixCopy (const FcMatrix *mat) +FcMatrixCopy (const FcMatrix *mat) { FcMatrix *r; - if(!mat) + if(!mat) return 0; r = (FcMatrix *) malloc (sizeof (*r) ); if (!r) @@ -58,7 +58,7 @@ FcMatrixEqual (const FcMatrix *mat1, const FcMatrix *mat2) { if(mat1 == mat2) return FcTrue; if(mat1 == 0 || mat2 == 0) return FcFalse; - return mat1->xx == mat2->xx && + return mat1->xx == mat2->xx && mat1->xy == mat2->xy && mat1->yx == mat2->yx && mat1->yy == mat2->yy; diff --git a/fontconfig/src/fcpat.c b/fontconfig/src/fcpat.c index be01a4fd2..8f63659df 100644 --- a/fontconfig/src/fcpat.c +++ b/fontconfig/src/fcpat.c @@ -1057,9 +1057,13 @@ FcStrStaticName (const FcChar8 *name) if (b->hash == hash && !strcmp ((char *)name, (char *) (b + 1))) return (FcChar8 *) (b + 1); size = sizeof (struct objectBucket) + strlen ((char *)name) + 1; - b = malloc (size + sizeof (int)); - /* workaround glibc bug which reads strlen in groups of 4 */ - FcMemAlloc (FC_MEM_STATICSTR, size + sizeof (int)); + /* + * workaround valgrind warning because glibc takes advantage of how it knows memory is + * allocated to implement strlen by reading in groups of 4 + */ + size = (size + 3) & ~3; + b = malloc (size); + FcMemAlloc (FC_MEM_STATICSTR, size); if (!b) return NULL; b->next = 0; diff --git a/fontconfig/src/ftglue.c b/fontconfig/src/ftglue.c index 1eca304cf..d5af810b4 100644 --- a/fontconfig/src/ftglue.c +++ b/fontconfig/src/ftglue.c @@ -18,7 +18,7 @@ static void ftglue_log( const char* format, ... ) { va_list ap; - + va_start( ap, format ); vfprintf( stderr, format, ap ); va_end( ap ); @@ -170,10 +170,10 @@ ftglue_face_goto_table( FT_Face face, FT_Error error; LOG(( "ftglue_face_goto_table( %p, %c%c%c%c, %p )\n", - face, - (int)((the_tag >> 24) & 0xFF), - (int)((the_tag >> 16) & 0xFF), - (int)((the_tag >> 8) & 0xFF), + face, + (int)((the_tag >> 24) & 0xFF), + (int)((the_tag >> 16) & 0xFF), + (int)((the_tag >> 8) & 0xFF), (int)(the_tag & 0xFF), stream )); @@ -235,7 +235,7 @@ ftglue_face_goto_table( FT_Face face, FT_UNUSED(checksum); FT_UNUSED(size); - + if ( tag == the_tag ) { LOG(( "TrueType table (start: %ld) (size: %ld)\n", start, size )); @@ -251,9 +251,9 @@ ftglue_face_goto_table( FT_Face face, Exit: LOG(( "TrueType error=%d\n", error )); - + return error; -} +} #undef QALLOC #define __ftglue__ -- cgit v1.2.3