summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/shared-mime-info/shared-mime-info/0001-Fix-literal-as-per-c-11.patch
blob: 25f409c206ec52584a581f5e5373511c538b7f2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
From 157c16b09f54741aefbc4be6a3507455f0378389 Mon Sep 17 00:00:00 2001
From: Biswapriyo Nath <nathbappai@gmail.com>
Date: Sun, 8 Oct 2023 13:26:43 +0000
Subject: [PATCH] Fix missing sentinel warning with clang

This fixes the compiler warnings similar as following.

../src/update-mime-database.cpp:393:50: warning: missing sentinel in function call [-Wsentinel]
  393 |                         g_strconcat(namespaceURI, " ", localName, NULL),
      |                                                                       ^
      |                                                                       , nullptr

Upstream-Status: Backport [https://gitlab.freedesktop.org/xdg/shared-mime-info/-/commit/157c16b09f54741aefbc4be6a3507455f0378389]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 src/update-mime-database.cpp | 58 ++++++++++++++++++------------------
 1 file changed, 29 insertions(+), 29 deletions(-)

--- a/src/update-mime-database.cpp
+++ b/src/update-mime-database.cpp
@@ -390,7 +390,7 @@ static void add_namespace(Type *type, co
 	}
 
 	g_hash_table_insert(namespace_hash,
-			g_strconcat(namespaceURI, " ", localName, NULL),
+			g_strconcat(namespaceURI, " ", localName, nullptr),
 			type);
 }
 
@@ -1023,7 +1023,7 @@ static void write_out_type(gpointer key,
 	char *lower;
 
 	lower = g_ascii_strdown(type->media, -1);
-	media = g_strconcat(mime_dir, "/", lower, NULL);
+	media = g_strconcat(mime_dir, "/", lower, nullptr);
 	g_free(lower);
 #ifdef _WIN32
 	fs::create_directory(media);
@@ -1032,7 +1032,7 @@ static void write_out_type(gpointer key,
 #endif
 
 	lower = g_ascii_strdown(type->subtype, -1);
-	filename = g_strconcat(media, "/", lower, ".xml.new", NULL);
+	filename = g_strconcat(media, "/", lower, ".xml.new", nullptr);
 	g_free(lower);
 	g_free(media);
 	media = NULL;
@@ -1622,7 +1622,7 @@ static Magic *magic_new(xmlNode *node, T
 			magic_free(magic);
 			magic = NULL;
 			(*error)->message = g_strconcat(
-				_("Error in <match> element: "), old, NULL);
+				_("Error in <match> element: "), old, nullptr);
 			g_free(old);
 		} else if (magic->matches == NULL) {
 			magic_free(magic);
@@ -1843,7 +1843,7 @@ static TreeMagic *tree_magic_new(xmlNode
 			tree_magic_free(magic);
 			magic = NULL;
 			(*error)->message = g_strconcat(
-				_("Error in <treematch> element: "), old, NULL);
+				_("Error in <treematch> element: "), old, nullptr);
 			g_free(old);
 		}
 	}
@@ -1960,7 +1960,7 @@ static void delete_old_types(const gchar
 
 	for (i = 0; i < G_N_ELEMENTS(media_types); i++)
 	{
-		const fs::path media_dir = g_strconcat(mime_dir, "/", media_types[i], NULL);
+		const fs::path media_dir = g_strconcat(mime_dir, "/", media_types[i], nullptr);
 
 		if (!fs::is_directory(fs::status(media_dir)))
 			continue;
@@ -1973,13 +1973,13 @@ static void delete_old_types(const gchar
 				continue;
 
 			char *type_name = g_strconcat(media_types[i], "/",
-						dir_entry.path().filename().string().c_str(), NULL);
+						dir_entry.path().filename().string().c_str(), nullptr);
 			type_name[strlen(type_name) - 4] = '\0';
 			if (!g_hash_table_lookup(types, type_name))
 			{
 				char *path;
 				path = g_strconcat(mime_dir, "/",
-						type_name, ".xml", NULL);
+						type_name, ".xml", nullptr);
 #if 0
 				g_warning("Removing old info for type %s",
 						path);
@@ -2002,7 +2002,7 @@ static void add_ns(gpointer key, gpointe
 	Type *type = (Type *) value;
 
 	g_ptr_array_add(lines, g_strconcat(ns, " ", type->media,
-					   "/", type->subtype, "\n", NULL));
+					   "/", type->subtype, "\n", nullptr));
 }
 
 /* Write all the collected namespace rules to 'XMLnamespaces' */
@@ -2038,7 +2038,7 @@ static void write_subclass(gpointer key,
 
 	for (l = list; l; l = l->next)
 	{
-		line = g_strconcat (static_cast<const gchar *>(key), " ", l->data, "\n", NULL);
+		line = g_strconcat (static_cast<const gchar *>(key), " ", l->data, "\n", nullptr);
 		fwrite(line, 1, strlen(line), stream);
 		g_free (line);
 	}
@@ -2061,7 +2061,7 @@ static void add_alias(gpointer key, gpoi
 	
 	g_ptr_array_add(lines, g_strconcat(alias, " ", type->media,
 					   "/", type->subtype, "\n", 
-					   NULL));
+					   nullptr));
 }
 
 /* Write all the collected aliases */
@@ -2092,7 +2092,7 @@ static void add_type(gpointer key, gpoin
 {
 	GPtrArray *lines = (GPtrArray *) data;
 	
-	g_ptr_array_add(lines, g_strconcat((char *)key, "\n", NULL));
+	g_ptr_array_add(lines, g_strconcat((char *)key, "\n", nullptr));
 }
 
 /* Write all the collected types */
@@ -2127,7 +2127,7 @@ static void write_one_icon(gpointer key,
 	FILE *stream = (FILE *)data;
 	char *line;
 
-	line = g_strconcat (mimetype, ":", iconname, "\n", NULL);
+	line = g_strconcat (mimetype, ":", iconname, "\n", nullptr);
 	fwrite(line, 1, strlen(line), stream);
 	g_free (line);
 }
@@ -2168,7 +2168,7 @@ static void check_in_path_xdg_data(const
 		dirs[n] = g_strdup(env);
 	else
 		dirs[n] = g_build_filename(g_get_home_dir(), ".local",
-						"share", NULL);
+						"share", nullptr);
 	n++;
 
 	for (i = 0; i < n; i++)
@@ -3588,7 +3588,7 @@ newest_mtime(const char *packagedir)
 	while ((name = g_dir_read_name(dir))) {
 		char *path;
 
-		path = g_build_filename(packagedir, name, NULL);
+		path = g_build_filename(packagedir, name, nullptr);
 		retval = g_stat(path, &statbuf);
 		g_free(path);
 		if (retval < 0)
@@ -3609,7 +3609,7 @@ is_cache_up_to_date (const char *mimedir
 	char *mimeversion;
 	int retval;
 
-	mimeversion = g_build_filename(mimedir, "/version", NULL);
+	mimeversion = g_build_filename(mimedir, "/version", nullptr);
 	retval = g_stat(mimeversion, &version_stat);
 	g_free(mimeversion);
 	if (retval < 0)
@@ -3694,7 +3694,7 @@ int main(int argc, char **argv)
 		}
 	}
 
-	package_dir = g_strconcat(mime_dir, "/packages", NULL);
+	package_dir = g_strconcat(mime_dir, "/packages", nullptr);
 
 	if (!fs::exists(mime_dir) && !fs::is_directory(fs::status(mime_dir)))
 	{
@@ -3747,7 +3747,7 @@ int main(int argc, char **argv)
 
 		g_hash_table_foreach(globs_hash, collect_glob2, &glob_list);
 		glob_list = g_list_sort(glob_list, (GCompareFunc)compare_glob_by_weight);
-		globs_path = g_strconcat(mime_dir, "/globs.new", NULL);
+		globs_path = g_strconcat(mime_dir, "/globs.new", nullptr);
 		globs = fopen_gerror(globs_path, error);
 		if (!globs)
 			goto out;
@@ -3761,7 +3761,7 @@ int main(int argc, char **argv)
 			goto out;
 		g_free(globs_path);
 
-		globs_path = g_strconcat(mime_dir, "/globs2.new", NULL);
+		globs_path = g_strconcat(mime_dir, "/globs2.new", nullptr);
 		globs = fopen_gerror(globs_path, error);
 		if (!globs)
 			goto out;
@@ -3782,7 +3782,7 @@ int main(int argc, char **argv)
 		FILE *stream;
 		char *magic_path;
 		int i;
-		magic_path = g_strconcat(mime_dir, "/magic.new", NULL);
+		magic_path = g_strconcat(mime_dir, "/magic.new", nullptr);
 		stream = fopen_gerror(magic_path, error);
 		if (!stream)
 			goto out;
@@ -3807,7 +3807,7 @@ int main(int argc, char **argv)
 		FILE *stream;
 		char *ns_path;
 
-		ns_path = g_strconcat(mime_dir, "/XMLnamespaces.new", NULL);
+		ns_path = g_strconcat(mime_dir, "/XMLnamespaces.new", nullptr);
 		stream = fopen_gerror(ns_path, error);
 		if (!stream)
 			goto out;
@@ -3823,7 +3823,7 @@ int main(int argc, char **argv)
 		FILE *stream;
 		char *path;
 		
-		path = g_strconcat(mime_dir, "/subclasses.new", NULL);
+		path = g_strconcat(mime_dir, "/subclasses.new", nullptr);
 		stream = fopen_gerror(path, error);
 		if (!stream)
 			goto out;
@@ -3839,7 +3839,7 @@ int main(int argc, char **argv)
 		FILE *stream;
 		char *path;
 		
-		path = g_strconcat(mime_dir, "/aliases.new", NULL);
+		path = g_strconcat(mime_dir, "/aliases.new", nullptr);
 		stream = fopen_gerror(path, error);
 		if (!stream)
 			goto out;
@@ -3855,7 +3855,7 @@ int main(int argc, char **argv)
 		FILE *stream;
 		char *path;
 		
-		path = g_strconcat(mime_dir, "/types.new", NULL);
+		path = g_strconcat(mime_dir, "/types.new", nullptr);
 		stream = fopen_gerror(path, error);
 		if (!stream)
 			goto out;
@@ -3871,7 +3871,7 @@ int main(int argc, char **argv)
 		FILE *stream;
 		char *icon_path;
 
-		icon_path = g_strconcat(mime_dir, "/generic-icons.new", NULL);
+		icon_path = g_strconcat(mime_dir, "/generic-icons.new", nullptr);
 		stream = fopen_gerror(icon_path, error);
 		if (!stream)
 			goto out;
@@ -3887,7 +3887,7 @@ int main(int argc, char **argv)
 		FILE *stream;
 		char *icon_path;
 
-		icon_path = g_strconcat(mime_dir, "/icons.new", NULL);
+		icon_path = g_strconcat(mime_dir, "/icons.new", nullptr);
 		stream = fopen_gerror(icon_path, error);
 		if (!stream)
 			goto out;
@@ -3903,7 +3903,7 @@ int main(int argc, char **argv)
 		FILE *stream;
 		char *path;
 		int i;
-		path = g_strconcat(mime_dir, "/treemagic.new", NULL);
+		path = g_strconcat(mime_dir, "/treemagic.new", nullptr);
 		stream = fopen_gerror(path, error);
 		if (!stream)
 			goto out;
@@ -3928,7 +3928,7 @@ int main(int argc, char **argv)
 		FILE *stream;
 		char *path;
 		
-		path = g_strconcat(mime_dir, "/mime.cache.new", NULL);
+		path = g_strconcat(mime_dir, "/mime.cache.new", nullptr);
 		stream = fopen_gerror(path, error);
 		if (!stream)
 			goto out;
@@ -3944,7 +3944,7 @@ int main(int argc, char **argv)
 		FILE *stream;
 		char *path;
 
-		path = g_strconcat(mime_dir, "/version.new", NULL);
+		path = g_strconcat(mime_dir, "/version.new", nullptr);
 		stream = fopen_gerror(path, error);
 		if (!stream)
 			goto out;