[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Google
  Web www.spinics.net

[PATCH v2] fc-{list,match}: constify format string



We don't free this string anywhere, so mark it const to avoid gcc warnings
and possible bugs in the future (if people did try freeing it).

fc-list.c: In function 'main':
fc-list.c:161:16: warning: pointer targets in assignment
	differ in signedness [-Wpointer-sign]

fc-match.c: In function 'main':
fc-match.c:201:13: warning: pointer targets in assignment
	differ in signedness [-Wpointer-sign]
fc-match.c:203:13: warning: pointer targets in assignment
	differ in signedness [-Wpointer-sign]

Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>
---
v2
	- tweak fc-list indentation
	- add fc-match with same kind of fix

 fc-list/fc-list.c   |   20 ++++++++++----------
 fc-match/fc-match.c |   22 +++++++++++-----------
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/fc-list/fc-list.c b/fc-list/fc-list.c
index ad38332..0149b0c 100644
--- a/fc-list/fc-list.c
+++ b/fc-list/fc-list.c
@@ -94,16 +94,16 @@ usage (char *program, int error)
 int
 main (int argc, char **argv)
 {
-    int		verbose = 0;
-    int		quiet = 0;
-    FcChar8     *format = NULL;
-    int		nfont = 0;
-    int		i;
-    FcObjectSet *os = 0;
-    FcFontSet	*fs;
-    FcPattern   *pat;
+    int			verbose = 0;
+    int			quiet = 0;
+    const FcChar8	*format = NULL;
+    int			nfont = 0;
+    int			i;
+    FcObjectSet		*os = 0;
+    FcFontSet		*fs;
+    FcPattern		*pat;
 #if HAVE_GETOPT_LONG || HAVE_GETOPT
-    int		c;
+    int			c;
 
 #if HAVE_GETOPT_LONG
     while ((c = getopt_long (argc, argv, "vf:qVh", longopts, NULL)) != -1)
@@ -158,7 +158,7 @@ main (int argc, char **argv)
     if (!verbose && !format && !os)
 	os = FcObjectSetBuild (FC_FAMILY, FC_STYLE, FC_FILE, (char *) 0);
     if (!format)
-        format = "%{=fclist}\n";
+        format = (const FcChar8 *) "%{=fclist}\n";
     fs = FcFontList (0, pat, os);
     if (os)
 	FcObjectSetDestroy (os);
diff --git a/fc-match/fc-match.c b/fc-match/fc-match.c
index e64b4bc..ca7eee0 100644
--- a/fc-match/fc-match.c
+++ b/fc-match/fc-match.c
@@ -98,16 +98,16 @@ usage (char *program, int error)
 int
 main (int argc, char **argv)
 {
-    int		verbose = 0;
-    int		sort = 0, all = 0;
-    FcChar8     *format = NULL;
-    int		i;
-    FcObjectSet *os = 0;
-    FcFontSet	*fs;
-    FcPattern   *pat;
-    FcResult	result;
+    int			verbose = 0;
+    int			sort = 0, all = 0;
+    const FcChar8	*format = NULL;
+    int			i;
+    FcObjectSet		*os = 0;
+    FcFontSet		*fs;
+    FcPattern		*pat;
+    FcResult		result;
 #if HAVE_GETOPT_LONG || HAVE_GETOPT
-    int		c;
+    int			c;
 
 #if HAVE_GETOPT_LONG
     while ((c = getopt_long (argc, argv, "asvf:Vh", longopts, NULL)) != -1)
@@ -198,9 +198,9 @@ main (int argc, char **argv)
     if (!format)
     {
 	if (os)
-	    format = "%{=unparse}\n";
+	    format = (const FcChar8 *) "%{=unparse}\n";
 	else
-	    format = "%{=fcmatch}\n";
+	    format = (const FcChar8 *) "%{=fcmatch}\n";
     }
 
     if (fs)
-- 
1.7.6.1

_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig


[Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Legacy]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Red Hat 9]     [Gimp]     [Yosemite News]

  Powered by Linux