aboutsummaryrefslogtreecommitdiff
path: root/fontconfig/src/fcstr.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-03-06 08:37:36 +0100
committermarha <marha@users.sourceforge.net>2013-04-11 11:13:32 +0200
commitfb84fb26466262dcab4bd31bdf51c982f14f891a (patch)
tree8b53ac928f676a2a6f2273c770d65625794c1ab5 /fontconfig/src/fcstr.c
parentd95b2ad7bc95e4ba2f1af9737935878f1ff7d79a (diff)
downloadvcxsrv-fb84fb26466262dcab4bd31bdf51c982f14f891a.tar.gz
vcxsrv-fb84fb26466262dcab4bd31bdf51c982f14f891a.tar.bz2
vcxsrv-fb84fb26466262dcab4bd31bdf51c982f14f891a.zip
fontconfig libfontenc mesa xserver git update 6 Mar 2013
xserver commit 103b77c59e3638a45179bf6d7908f5c738d2d872 libfontenc commit 624508365ec3279bc74ce523d024533e062629e1 fontconfig commit e96d7760886a3781a46b3271c76af99e15cb0146 mesa commit 88b20d58344ed336b146799c0bf1149a932dc2d7
Diffstat (limited to 'fontconfig/src/fcstr.c')
-rw-r--r--fontconfig/src/fcstr.c62
1 files changed, 60 insertions, 2 deletions
diff --git a/fontconfig/src/fcstr.c b/fontconfig/src/fcstr.c
index 414d6dd6b..4d11a4c65 100644
--- a/fontconfig/src/fcstr.c
+++ b/fontconfig/src/fcstr.c
@@ -30,6 +30,7 @@
#include <regex.h>
#endif
+
/* Objects MT-safe for readonly access. */
FcChar8 *
@@ -864,6 +865,64 @@ FcStrUsesHome (const FcChar8 *s)
}
FcChar8 *
+FcStrBuildFilename (const FcChar8 *path,
+ ...)
+{
+ va_list ap;
+ FcStrSet *sset = FcStrSetCreate ();
+ FcStrList *list;
+ FcChar8 *s, *ret = NULL, *p;
+ size_t len = 0;
+
+ if (!sset || !path)
+ return NULL;
+
+ if (!FcStrSetAdd (sset, path))
+ goto bail0;
+
+ va_start (ap, path);
+ while (1)
+ {
+ s = (FcChar8 *)va_arg (ap, FcChar8 *);
+ if (!s)
+ break;
+ if (!FcStrSetAdd (sset, s))
+ goto bail1;
+ }
+ list = FcStrListCreate (sset);
+ while ((s = FcStrListNext (list)))
+ {
+ len += strlen ((const char *)s) + 1;
+ }
+ list->n = 0;
+ ret = malloc (sizeof (FcChar8) * (len + 1));
+ if (!ret)
+ goto bail2;
+ p = ret;
+ while ((s = FcStrListNext (list)))
+ {
+ if (p != ret)
+ {
+ p[0] = FC_DIR_SEPARATOR;
+ p++;
+ }
+ len = strlen ((const char *)s);
+ memcpy (p, s, len);
+ p += len;
+ }
+ *p = 0;
+
+bail2:
+ FcStrListDone (list);
+bail1:
+ va_end (ap);
+bail0:
+ FcStrSetDestroy (sset);
+
+ return ret;
+}
+
+FcChar8 *
FcStrCopyFilename (const FcChar8 *s)
{
FcChar8 *new;
@@ -1052,8 +1111,7 @@ FcStrCanonFilename (const FcChar8 *s)
FcChar8 cwd[FC_MAX_FILE_LEN + 2];
if (getcwd ((char *) cwd, FC_MAX_FILE_LEN) == NULL)
return NULL;
- strcat ((char *) cwd, "/");
- full = FcStrPlus (cwd, s);
+ full = FcStrBuildFilename (cwd, s, NULL);
file = FcStrCanonAbsoluteFilename (full);
FcStrFree (full);
return file;