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 int
main (void) main (void)
{ {
const FcChar8 *doc = "" const FcChar8 *doc = (const FcChar8 *) ""
"<fontconfig>\n" "<fontconfig>\n"
" <include ignore_missing=\"yes\">blahblahblah</include>\n" " <include ignore_missing=\"yes\">blahblahblah</include>\n"
"</fontconfig>\n" "</fontconfig>\n"
""; "";
const FcChar8 *doc2 = "" const FcChar8 *doc2 = (const FcChar8 *) ""
"<fontconfig>\n" "<fontconfig>\n"
" <include ignore_missing=\"no\">blahblahblah</include>\n" " <include ignore_missing=\"no\">blahblahblah</include>\n"
"</fontconfig>\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) 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; FcBool b;
if (c) if (c)
@ -95,7 +95,7 @@ build_pattern (json_object *obj)
else else
{ {
v.type = FcTypeString; 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) 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); fread (buf, (size_t)len, sizeof (char), fp);
buf[len] = 0; buf[len] = 0;
ret = FcConfigParseAndLoadFromMemory (config, buf, FcTrue); ret = FcConfigParseAndLoadFromMemory (config, (const FcChar8 *) buf, FcTrue);
bail1: bail1:
fclose (fp); fclose (fp);
if (buf) if (buf)

View File

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

View File

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

View File

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