diff options
| author | Khem Raj <raj.khem@gmail.com> | 2023-10-19 10:44:23 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-10-23 10:49:19 +0100 |
| commit | 2d052d72f96e7956f44f9ea404c28827a7691521 (patch) | |
| tree | c8c737447a420f70e2a36af5f9ee98f806bdcc2f | |
| parent | cec84a072d7ac4b0f67b21b6034587726082fbfa (diff) | |
| download | poky-2d052d72f96e7956f44f9ea404c28827a7691521.tar.gz | |
shared-mime-info: Fix missing sentinel warning
Clang finds it, gcc does not.
(From OE-Core rev: a49a38c614280ba38a4c63fbac78a64efc30221f)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
3 files changed, 322 insertions, 1 deletions
diff --git a/meta/recipes-support/shared-mime-info/shared-mime-info/0001-Fix-literal-as-per-c-11.patch b/meta/recipes-support/shared-mime-info/shared-mime-info/0001-Fix-literal-as-per-c-11.patch new file mode 100644 index 0000000000..25f409c206 --- /dev/null +++ b/meta/recipes-support/shared-mime-info/shared-mime-info/0001-Fix-literal-as-per-c-11.patch | |||
| @@ -0,0 +1,279 @@ | |||
| 1 | From 157c16b09f54741aefbc4be6a3507455f0378389 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Biswapriyo Nath <nathbappai@gmail.com> | ||
| 3 | Date: Sun, 8 Oct 2023 13:26:43 +0000 | ||
| 4 | Subject: [PATCH] Fix missing sentinel warning with clang | ||
| 5 | |||
| 6 | This fixes the compiler warnings similar as following. | ||
| 7 | |||
| 8 | ../src/update-mime-database.cpp:393:50: warning: missing sentinel in function call [-Wsentinel] | ||
| 9 | 393 | g_strconcat(namespaceURI, " ", localName, NULL), | ||
| 10 | | ^ | ||
| 11 | | , nullptr | ||
| 12 | |||
| 13 | Upstream-Status: Backport [https://gitlab.freedesktop.org/xdg/shared-mime-info/-/commit/157c16b09f54741aefbc4be6a3507455f0378389] | ||
| 14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 15 | --- | ||
| 16 | src/update-mime-database.cpp | 58 ++++++++++++++++++------------------ | ||
| 17 | 1 file changed, 29 insertions(+), 29 deletions(-) | ||
| 18 | |||
| 19 | --- a/src/update-mime-database.cpp | ||
| 20 | +++ b/src/update-mime-database.cpp | ||
| 21 | @@ -390,7 +390,7 @@ static void add_namespace(Type *type, co | ||
| 22 | } | ||
| 23 | |||
| 24 | g_hash_table_insert(namespace_hash, | ||
| 25 | - g_strconcat(namespaceURI, " ", localName, NULL), | ||
| 26 | + g_strconcat(namespaceURI, " ", localName, nullptr), | ||
| 27 | type); | ||
| 28 | } | ||
| 29 | |||
| 30 | @@ -1023,7 +1023,7 @@ static void write_out_type(gpointer key, | ||
| 31 | char *lower; | ||
| 32 | |||
| 33 | lower = g_ascii_strdown(type->media, -1); | ||
| 34 | - media = g_strconcat(mime_dir, "/", lower, NULL); | ||
| 35 | + media = g_strconcat(mime_dir, "/", lower, nullptr); | ||
| 36 | g_free(lower); | ||
| 37 | #ifdef _WIN32 | ||
| 38 | fs::create_directory(media); | ||
| 39 | @@ -1032,7 +1032,7 @@ static void write_out_type(gpointer key, | ||
| 40 | #endif | ||
| 41 | |||
| 42 | lower = g_ascii_strdown(type->subtype, -1); | ||
| 43 | - filename = g_strconcat(media, "/", lower, ".xml.new", NULL); | ||
| 44 | + filename = g_strconcat(media, "/", lower, ".xml.new", nullptr); | ||
| 45 | g_free(lower); | ||
| 46 | g_free(media); | ||
| 47 | media = NULL; | ||
| 48 | @@ -1622,7 +1622,7 @@ static Magic *magic_new(xmlNode *node, T | ||
| 49 | magic_free(magic); | ||
| 50 | magic = NULL; | ||
| 51 | (*error)->message = g_strconcat( | ||
| 52 | - _("Error in <match> element: "), old, NULL); | ||
| 53 | + _("Error in <match> element: "), old, nullptr); | ||
| 54 | g_free(old); | ||
| 55 | } else if (magic->matches == NULL) { | ||
| 56 | magic_free(magic); | ||
| 57 | @@ -1843,7 +1843,7 @@ static TreeMagic *tree_magic_new(xmlNode | ||
| 58 | tree_magic_free(magic); | ||
| 59 | magic = NULL; | ||
| 60 | (*error)->message = g_strconcat( | ||
| 61 | - _("Error in <treematch> element: "), old, NULL); | ||
| 62 | + _("Error in <treematch> element: "), old, nullptr); | ||
| 63 | g_free(old); | ||
| 64 | } | ||
| 65 | } | ||
| 66 | @@ -1960,7 +1960,7 @@ static void delete_old_types(const gchar | ||
| 67 | |||
| 68 | for (i = 0; i < G_N_ELEMENTS(media_types); i++) | ||
| 69 | { | ||
| 70 | - const fs::path media_dir = g_strconcat(mime_dir, "/", media_types[i], NULL); | ||
| 71 | + const fs::path media_dir = g_strconcat(mime_dir, "/", media_types[i], nullptr); | ||
| 72 | |||
| 73 | if (!fs::is_directory(fs::status(media_dir))) | ||
| 74 | continue; | ||
| 75 | @@ -1973,13 +1973,13 @@ static void delete_old_types(const gchar | ||
| 76 | continue; | ||
| 77 | |||
| 78 | char *type_name = g_strconcat(media_types[i], "/", | ||
| 79 | - dir_entry.path().filename().string().c_str(), NULL); | ||
| 80 | + dir_entry.path().filename().string().c_str(), nullptr); | ||
| 81 | type_name[strlen(type_name) - 4] = '\0'; | ||
| 82 | if (!g_hash_table_lookup(types, type_name)) | ||
| 83 | { | ||
| 84 | char *path; | ||
| 85 | path = g_strconcat(mime_dir, "/", | ||
| 86 | - type_name, ".xml", NULL); | ||
| 87 | + type_name, ".xml", nullptr); | ||
| 88 | #if 0 | ||
| 89 | g_warning("Removing old info for type %s", | ||
| 90 | path); | ||
| 91 | @@ -2002,7 +2002,7 @@ static void add_ns(gpointer key, gpointe | ||
| 92 | Type *type = (Type *) value; | ||
| 93 | |||
| 94 | g_ptr_array_add(lines, g_strconcat(ns, " ", type->media, | ||
| 95 | - "/", type->subtype, "\n", NULL)); | ||
| 96 | + "/", type->subtype, "\n", nullptr)); | ||
| 97 | } | ||
| 98 | |||
| 99 | /* Write all the collected namespace rules to 'XMLnamespaces' */ | ||
| 100 | @@ -2038,7 +2038,7 @@ static void write_subclass(gpointer key, | ||
| 101 | |||
| 102 | for (l = list; l; l = l->next) | ||
| 103 | { | ||
| 104 | - line = g_strconcat (static_cast<const gchar *>(key), " ", l->data, "\n", NULL); | ||
| 105 | + line = g_strconcat (static_cast<const gchar *>(key), " ", l->data, "\n", nullptr); | ||
| 106 | fwrite(line, 1, strlen(line), stream); | ||
| 107 | g_free (line); | ||
| 108 | } | ||
| 109 | @@ -2061,7 +2061,7 @@ static void add_alias(gpointer key, gpoi | ||
| 110 | |||
| 111 | g_ptr_array_add(lines, g_strconcat(alias, " ", type->media, | ||
| 112 | "/", type->subtype, "\n", | ||
| 113 | - NULL)); | ||
| 114 | + nullptr)); | ||
| 115 | } | ||
| 116 | |||
| 117 | /* Write all the collected aliases */ | ||
| 118 | @@ -2092,7 +2092,7 @@ static void add_type(gpointer key, gpoin | ||
| 119 | { | ||
| 120 | GPtrArray *lines = (GPtrArray *) data; | ||
| 121 | |||
| 122 | - g_ptr_array_add(lines, g_strconcat((char *)key, "\n", NULL)); | ||
| 123 | + g_ptr_array_add(lines, g_strconcat((char *)key, "\n", nullptr)); | ||
| 124 | } | ||
| 125 | |||
| 126 | /* Write all the collected types */ | ||
| 127 | @@ -2127,7 +2127,7 @@ static void write_one_icon(gpointer key, | ||
| 128 | FILE *stream = (FILE *)data; | ||
| 129 | char *line; | ||
| 130 | |||
| 131 | - line = g_strconcat (mimetype, ":", iconname, "\n", NULL); | ||
| 132 | + line = g_strconcat (mimetype, ":", iconname, "\n", nullptr); | ||
| 133 | fwrite(line, 1, strlen(line), stream); | ||
| 134 | g_free (line); | ||
| 135 | } | ||
| 136 | @@ -2168,7 +2168,7 @@ static void check_in_path_xdg_data(const | ||
| 137 | dirs[n] = g_strdup(env); | ||
| 138 | else | ||
| 139 | dirs[n] = g_build_filename(g_get_home_dir(), ".local", | ||
| 140 | - "share", NULL); | ||
| 141 | + "share", nullptr); | ||
| 142 | n++; | ||
| 143 | |||
| 144 | for (i = 0; i < n; i++) | ||
| 145 | @@ -3588,7 +3588,7 @@ newest_mtime(const char *packagedir) | ||
| 146 | while ((name = g_dir_read_name(dir))) { | ||
| 147 | char *path; | ||
| 148 | |||
| 149 | - path = g_build_filename(packagedir, name, NULL); | ||
| 150 | + path = g_build_filename(packagedir, name, nullptr); | ||
| 151 | retval = g_stat(path, &statbuf); | ||
| 152 | g_free(path); | ||
| 153 | if (retval < 0) | ||
| 154 | @@ -3609,7 +3609,7 @@ is_cache_up_to_date (const char *mimedir | ||
| 155 | char *mimeversion; | ||
| 156 | int retval; | ||
| 157 | |||
| 158 | - mimeversion = g_build_filename(mimedir, "/version", NULL); | ||
| 159 | + mimeversion = g_build_filename(mimedir, "/version", nullptr); | ||
| 160 | retval = g_stat(mimeversion, &version_stat); | ||
| 161 | g_free(mimeversion); | ||
| 162 | if (retval < 0) | ||
| 163 | @@ -3694,7 +3694,7 @@ int main(int argc, char **argv) | ||
| 164 | } | ||
| 165 | } | ||
| 166 | |||
| 167 | - package_dir = g_strconcat(mime_dir, "/packages", NULL); | ||
| 168 | + package_dir = g_strconcat(mime_dir, "/packages", nullptr); | ||
| 169 | |||
| 170 | if (!fs::exists(mime_dir) && !fs::is_directory(fs::status(mime_dir))) | ||
| 171 | { | ||
| 172 | @@ -3747,7 +3747,7 @@ int main(int argc, char **argv) | ||
| 173 | |||
| 174 | g_hash_table_foreach(globs_hash, collect_glob2, &glob_list); | ||
| 175 | glob_list = g_list_sort(glob_list, (GCompareFunc)compare_glob_by_weight); | ||
| 176 | - globs_path = g_strconcat(mime_dir, "/globs.new", NULL); | ||
| 177 | + globs_path = g_strconcat(mime_dir, "/globs.new", nullptr); | ||
| 178 | globs = fopen_gerror(globs_path, error); | ||
| 179 | if (!globs) | ||
| 180 | goto out; | ||
| 181 | @@ -3761,7 +3761,7 @@ int main(int argc, char **argv) | ||
| 182 | goto out; | ||
| 183 | g_free(globs_path); | ||
| 184 | |||
| 185 | - globs_path = g_strconcat(mime_dir, "/globs2.new", NULL); | ||
| 186 | + globs_path = g_strconcat(mime_dir, "/globs2.new", nullptr); | ||
| 187 | globs = fopen_gerror(globs_path, error); | ||
| 188 | if (!globs) | ||
| 189 | goto out; | ||
| 190 | @@ -3782,7 +3782,7 @@ int main(int argc, char **argv) | ||
| 191 | FILE *stream; | ||
| 192 | char *magic_path; | ||
| 193 | int i; | ||
| 194 | - magic_path = g_strconcat(mime_dir, "/magic.new", NULL); | ||
| 195 | + magic_path = g_strconcat(mime_dir, "/magic.new", nullptr); | ||
| 196 | stream = fopen_gerror(magic_path, error); | ||
| 197 | if (!stream) | ||
| 198 | goto out; | ||
| 199 | @@ -3807,7 +3807,7 @@ int main(int argc, char **argv) | ||
| 200 | FILE *stream; | ||
| 201 | char *ns_path; | ||
| 202 | |||
| 203 | - ns_path = g_strconcat(mime_dir, "/XMLnamespaces.new", NULL); | ||
| 204 | + ns_path = g_strconcat(mime_dir, "/XMLnamespaces.new", nullptr); | ||
| 205 | stream = fopen_gerror(ns_path, error); | ||
| 206 | if (!stream) | ||
| 207 | goto out; | ||
| 208 | @@ -3823,7 +3823,7 @@ int main(int argc, char **argv) | ||
| 209 | FILE *stream; | ||
| 210 | char *path; | ||
| 211 | |||
| 212 | - path = g_strconcat(mime_dir, "/subclasses.new", NULL); | ||
| 213 | + path = g_strconcat(mime_dir, "/subclasses.new", nullptr); | ||
| 214 | stream = fopen_gerror(path, error); | ||
| 215 | if (!stream) | ||
| 216 | goto out; | ||
| 217 | @@ -3839,7 +3839,7 @@ int main(int argc, char **argv) | ||
| 218 | FILE *stream; | ||
| 219 | char *path; | ||
| 220 | |||
| 221 | - path = g_strconcat(mime_dir, "/aliases.new", NULL); | ||
| 222 | + path = g_strconcat(mime_dir, "/aliases.new", nullptr); | ||
| 223 | stream = fopen_gerror(path, error); | ||
| 224 | if (!stream) | ||
| 225 | goto out; | ||
| 226 | @@ -3855,7 +3855,7 @@ int main(int argc, char **argv) | ||
| 227 | FILE *stream; | ||
| 228 | char *path; | ||
| 229 | |||
| 230 | - path = g_strconcat(mime_dir, "/types.new", NULL); | ||
| 231 | + path = g_strconcat(mime_dir, "/types.new", nullptr); | ||
| 232 | stream = fopen_gerror(path, error); | ||
| 233 | if (!stream) | ||
| 234 | goto out; | ||
| 235 | @@ -3871,7 +3871,7 @@ int main(int argc, char **argv) | ||
| 236 | FILE *stream; | ||
| 237 | char *icon_path; | ||
| 238 | |||
| 239 | - icon_path = g_strconcat(mime_dir, "/generic-icons.new", NULL); | ||
| 240 | + icon_path = g_strconcat(mime_dir, "/generic-icons.new", nullptr); | ||
| 241 | stream = fopen_gerror(icon_path, error); | ||
| 242 | if (!stream) | ||
| 243 | goto out; | ||
| 244 | @@ -3887,7 +3887,7 @@ int main(int argc, char **argv) | ||
| 245 | FILE *stream; | ||
| 246 | char *icon_path; | ||
| 247 | |||
| 248 | - icon_path = g_strconcat(mime_dir, "/icons.new", NULL); | ||
| 249 | + icon_path = g_strconcat(mime_dir, "/icons.new", nullptr); | ||
| 250 | stream = fopen_gerror(icon_path, error); | ||
| 251 | if (!stream) | ||
| 252 | goto out; | ||
| 253 | @@ -3903,7 +3903,7 @@ int main(int argc, char **argv) | ||
| 254 | FILE *stream; | ||
| 255 | char *path; | ||
| 256 | int i; | ||
| 257 | - path = g_strconcat(mime_dir, "/treemagic.new", NULL); | ||
| 258 | + path = g_strconcat(mime_dir, "/treemagic.new", nullptr); | ||
| 259 | stream = fopen_gerror(path, error); | ||
| 260 | if (!stream) | ||
| 261 | goto out; | ||
| 262 | @@ -3928,7 +3928,7 @@ int main(int argc, char **argv) | ||
| 263 | FILE *stream; | ||
| 264 | char *path; | ||
| 265 | |||
| 266 | - path = g_strconcat(mime_dir, "/mime.cache.new", NULL); | ||
| 267 | + path = g_strconcat(mime_dir, "/mime.cache.new", nullptr); | ||
| 268 | stream = fopen_gerror(path, error); | ||
| 269 | if (!stream) | ||
| 270 | goto out; | ||
| 271 | @@ -3944,7 +3944,7 @@ int main(int argc, char **argv) | ||
| 272 | FILE *stream; | ||
| 273 | char *path; | ||
| 274 | |||
| 275 | - path = g_strconcat(mime_dir, "/version.new", NULL); | ||
| 276 | + path = g_strconcat(mime_dir, "/version.new", nullptr); | ||
| 277 | stream = fopen_gerror(path, error); | ||
| 278 | if (!stream) | ||
| 279 | goto out; | ||
diff --git a/meta/recipes-support/shared-mime-info/shared-mime-info/0001-Fix-string-literal-concatenation.patch b/meta/recipes-support/shared-mime-info/shared-mime-info/0001-Fix-string-literal-concatenation.patch new file mode 100644 index 0000000000..7825c39312 --- /dev/null +++ b/meta/recipes-support/shared-mime-info/shared-mime-info/0001-Fix-string-literal-concatenation.patch | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | From ccf704a606625bc62e70dbe815b309c22a0bda05 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Tobias Mayer <tobim@fastmail.fm> | ||
| 3 | Date: Sun, 8 Oct 2023 00:11:49 +0200 | ||
| 4 | Subject: [PATCH] Fix string literal concatenation | ||
| 5 | |||
| 6 | Clang is not able to disambiguate between multiple string literatals | ||
| 7 | and C++11 user defined literals. Spaces help. | ||
| 8 | |||
| 9 | Upstream-Status: Backport [https://gitlab.freedesktop.org/xdg/shared-mime-info/-/commit/12a3a6b1141c704fc594379af1808bb9008d588c] | ||
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 11 | --- | ||
| 12 | src/update-mime-database.cpp | 4 ++-- | ||
| 13 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
| 14 | |||
| 15 | diff --git a/src/update-mime-database.cpp b/src/update-mime-database.cpp | ||
| 16 | index 733ba06..29d82a9 100644 | ||
| 17 | --- a/src/update-mime-database.cpp | ||
| 18 | +++ b/src/update-mime-database.cpp | ||
| 19 | @@ -2158,7 +2158,7 @@ static void check_in_path_xdg_data(const char *mime_path) | ||
| 20 | |||
| 21 | env = getenv("XDG_DATA_DIRS"); | ||
| 22 | if (!env) | ||
| 23 | - env = "/usr/local/share/"PATH_SEPARATOR"/usr/share/"; | ||
| 24 | + env = "/usr/local/share/" PATH_SEPARATOR "/usr/share/"; | ||
| 25 | dirs = g_strsplit(env, PATH_SEPARATOR, 0); | ||
| 26 | g_return_if_fail(dirs != NULL); | ||
| 27 | for (n = 0; dirs[n]; n++) | ||
| 28 | @@ -2170,7 +2170,7 @@ static void check_in_path_xdg_data(const char *mime_path) | ||
| 29 | dirs[n] = g_build_filename(g_get_home_dir(), ".local", | ||
| 30 | "share", NULL); | ||
| 31 | n++; | ||
| 32 | - | ||
| 33 | + | ||
| 34 | for (i = 0; i < n; i++) | ||
| 35 | { | ||
| 36 | if (stat(dirs[i], &dir_info) == 0 && | ||
| 37 | -- | ||
| 38 | 2.42.0 | ||
| 39 | |||
diff --git a/meta/recipes-support/shared-mime-info/shared-mime-info_git.bb b/meta/recipes-support/shared-mime-info/shared-mime-info_git.bb index 81a9259d7b..cae0064333 100644 --- a/meta/recipes-support/shared-mime-info/shared-mime-info_git.bb +++ b/meta/recipes-support/shared-mime-info/shared-mime-info_git.bb | |||
| @@ -8,7 +8,10 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" | |||
| 8 | 8 | ||
| 9 | DEPENDS = "libxml2 itstool-native glib-2.0 shared-mime-info-native xmlto-native" | 9 | DEPENDS = "libxml2 itstool-native glib-2.0 shared-mime-info-native xmlto-native" |
| 10 | 10 | ||
| 11 | SRC_URI = "git://gitlab.freedesktop.org/xdg/shared-mime-info.git;protocol=https;branch=master" | 11 | SRC_URI = "git://gitlab.freedesktop.org/xdg/shared-mime-info.git;protocol=https;branch=master \ |
| 12 | file://0001-Fix-string-literal-concatenation.patch \ | ||
| 13 | file://0001-Fix-literal-as-per-c-11.patch \ | ||
| 14 | " | ||
| 12 | SRCREV = "8e80a317f5c61a7f410330abea441e0b0b9280b5" | 15 | SRCREV = "8e80a317f5c61a7f410330abea441e0b0b9280b5" |
| 13 | PV = "2.3" | 16 | PV = "2.3" |
| 14 | S = "${WORKDIR}/git" | 17 | S = "${WORKDIR}/git" |
