Fix gcc warnings with -Wpointer-sign

Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/184
This commit is contained in:
Akira TAGOH 2019-11-06 20:28:41 +09:00
parent aa8c8cfa9f
commit 23ab038281
5 changed files with 17 additions and 17 deletions

View File

@ -26,12 +26,12 @@
int
main (void)
{
const FcChar8 *doc = ""
const FcChar8 *doc = (const FcChar8 *) ""
"<fontconfig>\n"
" <include ignore_missing=\"yes\">blahblahblah</include>\n"
"</fontconfig>\n"
"";
const FcChar8 *doc2 = ""
const FcChar8 *doc2 = (const FcChar8 *) ""
"<fontconfig>\n"
" <include ignore_missing=\"no\">blahblahblah</include>\n"
"</fontconfig>\n"

View File

@ -69,7 +69,7 @@ build_pattern (json_object *obj)
}
else if (json_object_get_type (iter.val) == json_type_string)
{
const FcConstant *c = FcNameGetConstant (json_object_get_string (iter.val));
const FcConstant *c = FcNameGetConstant ((const FcChar8 *) json_object_get_string (iter.val));
FcBool b;
if (c)
@ -95,7 +95,7 @@ build_pattern (json_object *obj)
else
{
v.type = FcTypeString;
v.u.s = json_object_get_string (iter.val);
v.u.s = (const FcChar8 *) json_object_get_string (iter.val);
}
}
else if (json_object_get_type (iter.val) == json_type_null)
@ -445,7 +445,7 @@ load_config (FcConfig *config, char *file)
fread (buf, (size_t)len, sizeof (char), fp);
buf[len] = 0;
ret = FcConfigParseAndLoadFromMemory (config, buf, FcTrue);
ret = FcConfigParseAndLoadFromMemory (config, (const FcChar8 *) buf, FcTrue);
bail1:
fclose (fp);
if (buf)

View File

@ -39,7 +39,7 @@ run_query (void)
FcPattern *pat = FcPatternCreate (), *match;
FcResult result;
FcPatternAddString (pat, FC_FAMILY, "sans-serif");
FcPatternAddString (pat, FC_FAMILY, (const FcChar8 *) "sans-serif");
FcPatternAddBool (pat, FC_SCALABLE, FcTrue);
FcConfigSubstitute (NULL, pat, FcMatchPattern);
FcDefaultSubstitute (pat);

View File

@ -183,7 +183,7 @@ main(void)
char *sysroot = NULL, systempl[512] = "/tmp/fc107-XXXXXX";
FcChar8 *d = NULL, *dd = NULL;
FcCache *c = NULL;
const FcChar8 *doc = ""
const FcChar8 *doc = (const FcChar8 *) ""
"<fontconfig>\n"
" <dir>%s</dir>\n"
"</fontconfig>\n"
@ -208,16 +208,16 @@ main(void)
retval++;
fprintf (stderr, "D: Creating %s\n", basedir);
mkdir_p (basedir);
len = strlen (doc) + strlen (basedir) + 1;
len = strlen ((const char *) doc) + strlen (basedir) + 1;
dd = malloc (len);
snprintf (dd, len, doc, basedir);
snprintf ((char *) dd, len, (char *) doc, basedir);
if (!FcConfigParseAndLoadFromMemory (cfg, dd, FcFalse))
{
fprintf (stderr, "%s: Unable to load a config\n", basedir);
goto bail;
}
sleep (1);
c = FcDirCacheRead (basedir, FcFalse, cfg);
c = FcDirCacheRead ((const FcChar8 *) basedir, FcFalse, cfg);
FcDirCacheUnload (c);
sleep (1);
retval++;
@ -230,22 +230,22 @@ main(void)
fprintf (stderr, "D: Creating %s\n", sysroot);
mkdir_p (sysroot);
retval++;
d = FcStrBuildFilename (sysroot, basedir, NULL);
d = FcStrBuildFilename ((const FcChar8 *) sysroot, basedir, NULL);
fprintf (stderr, "D: Creating %s\n", d);
mkdir_p (d);
mkdir_p ((const char *) d);
free (d);
retval++;
free (dd);
len = strlen (doc) + strlen (basedir) + 1;
len = strlen ((const char *) doc) + strlen (basedir) + 1;
dd = malloc (len);
snprintf (dd, len, doc, basedir);
snprintf ((char *) dd, len, (char *) doc, basedir);
if (!FcConfigParseAndLoadFromMemory (cfg, dd, FcFalse))
{
fprintf (stderr, "%s: Unable to load a config\n", basedir);
goto bail;
}
sleep (1);
c = FcDirCacheRead (basedir, FcFalse, cfg);
c = FcDirCacheRead ((const FcChar8 *) basedir, FcFalse, cfg);
FcDirCacheUnload (c);
sleep (1);
retval++;

View File

@ -28,12 +28,12 @@
int
main (void)
{
const FcChar8 *doc = ""
const FcChar8 *doc = (const FcChar8 *) ""
"<fontconfig>\n"
" <cachedir></cachedir>\n"
"</fontconfig>\n"
"";
const FcChar8 *doc2 = ""
const FcChar8 *doc2 = (const FcChar8 *) ""
"<fontconfig>\n"
" <cachedir prefix=\"xdg\"></cachedir>\n"
"</fontconfig>\n"