aboutsummaryrefslogtreecommitdiff
path: root/fontconfig
diff options
context:
space:
mode:
Diffstat (limited to 'fontconfig')
-rw-r--r--fontconfig/src/fccfg.c13
-rw-r--r--fontconfig/src/fcftint.h2
-rw-r--r--fontconfig/src/fcmatrix.c6
-rw-r--r--fontconfig/src/fcpat.c10
-rw-r--r--fontconfig/src/ftglue.c16
5 files changed, 30 insertions, 17 deletions
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__