glib2-2.74.4

This commit is contained in:
Rmys
2022-12-22 12:14:29 +03:00
parent da85e2deb5
commit 116eda41b2
2 changed files with 8 additions and 50 deletions
@@ -1,48 +0,0 @@
diff -Nuar a/glib/ghash.h b/glib/ghash.h
--- a/glib/ghash.h 2022-11-24 15:29:05.000000000 +0300
+++ b/glib/ghash.h 2022-11-30 22:54:54.674385705 +0300
@@ -162,7 +162,7 @@
gconstpointer v2);
/* Macro for optimization in the case it is not used as callback function */
-#define g_str_equal(v1, v2) (strcmp ((gconstpointer) (v1), (gconstpointer) (v2)) == 0)
+#define g_str_equal(v1, v2) (strcmp ((const char *) (v1), (const char *) (v2)) == 0)
GLIB_AVAILABLE_IN_ALL
guint g_str_hash (gconstpointer v);
diff -Nuar a/glib/tests/cxx.cpp b/glib/tests/cxx.cpp
@@ -192,15 +299,40 @@
g_assert_null (ptr);
}
+static void
+test_str_equal (void)
+{
+ const char *str_a = "a";
+ char *str_b = g_strdup ("b");
+ gconstpointer str_a_ptr = str_a, str_b_ptr = str_b;
+ const unsigned char *str_c = (const unsigned char *) "c";
+
+ g_test_summary ("Test typechecking and casting of arguments to g_str_equal() macro in C++");
+ g_test_bug ("https://gitlab.gnome.org/GNOME/glib/-/issues/2820");
+
+ /* We dont actually care what the comparisons do at runtime. What were
+ * checking here is that the types dont emit warnings at compile time. */
+ g_assert_true (g_str_equal ("a", str_a));
+ g_assert_false (g_str_equal ("a", str_b));
+ g_assert_true (g_str_equal (str_a, str_a_ptr));
+ g_assert_false (g_str_equal (str_a_ptr, str_b_ptr));
+ g_assert_false (g_str_equal (str_c, str_b));
+
+ g_free (str_b);
+}
+
int
@@ -211,6 +343,7 @@
g_test_add_func ("/C++/inlined-not-inlined-functions", test_inline_no_inline_macros);
g_test_add_func ("/C++/clear-pointer", test_clear_pointer);
g_test_add_func ("/C++/steal-pointer", test_steal_pointer);
+ g_test_add_func ("/C++/str-equal", test_str_equal);
return g_test_run ();
}
+8 -2
View File
@@ -12,7 +12,7 @@
<IsA>library</IsA>
<Summary>A library of handy utility functions</Summary>
<Description>glib2 is the low-level core library that forms the basis for projects such as GTK+ and GNOME. It provides data structure handling for C, portability wrappers, and interfaces for such runtime functionality as an event loop, threads, dynamic loading, and an object system.</Description>
<Archive sha1sum="c64e3df1c17cc11bee060226e2af175a3723ecbc" type="tarxz">mirrors://gnome/glib/2.74/glib-2.74.2.tar.xz</Archive>
<Archive sha1sum="8d1b033c9144f59330af6d8670bfe55595ecf2db" type="tarxz">mirrors://gnome/glib/2.74/glib-2.74.4.tar.xz</Archive>
<BuildDependencies>
<Dependency>meson</Dependency>
<Dependency>ninja</Dependency>
@@ -27,7 +27,6 @@
<Patches>
<Patch level="1">noisy-glib-compile-schemas.diff</Patch>
<Patch level="1">glib-2.68.2-skip_warnings-1.patch</Patch>
<Patch level="1">2820-str-equal-cxx.patch</Patch>
</Patches>
<AdditionalFiles>
<AdditionalFile target="multilib.diff" permission="0644">multilib.diff</AdditionalFile>
@@ -141,6 +140,13 @@
</Package>
<History>
<Update release="27">
<Date>2022-12-22</Date>
<Version>2.74.4</Version>
<Comment>Version bump.</Comment>
<Name>Mustafa Cinasal</Name>
<Email>muscnsl@gmail.com</Email>
</Update>
<Update release="26">
<Date>2022-11-25</Date>
<Version>2.74.2</Version>