From 41189d8fecac7e302ae0d44751f114eebac6b869 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Sun, 6 Sep 2020 23:43:53 -0700 Subject: [PATCH] Imported Upstream version 2.39.92 --- NEWS | 15 +++++++++++++++ configure.ac | 4 ++-- gio/giomm/contenttype.cc | 2 ++ gio/giomm/contenttype.h | 2 ++ gio/src/application.ccg | 11 +++++++++++ gio/src/application.hg | 11 +++++++++++ gio/src/gio_docs.xml | 4 ++-- gio/src/gio_extra_objects.defs | 6 ++++++ glib/glibmm/ustring.h | 21 ++++++++++++++++++++- tools/m4/convert_glib.m4 | 2 +- 10 files changed, 72 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 40e6b92..5491520 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,18 @@ +2.39.92 (unstable): + +Gio: +* Application: Add add_main_option_entry() and add_option_group(). + (Murray Cumming) + +Documentation: +* Glib::ustring: Say more clearly that it must be only UTF-8. + (Kjell Ahlstedt) Bug #681560 (vurentjie) + +Build: +* win32: Surround content_type_get_symbolic_icon() with ifdefs. + (Giuseppe Penone) + + 2.39.91 (unstable): Documenation: diff --git a/configure.ac b/configure.ac index d0b8ec1..eefddba 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ ## You should have received a copy of the GNU Lesser General Public License ## along with this library. If not, see . -AC_INIT([glibmm], [2.39.91], +AC_INIT([glibmm], [2.39.92], [http://bugzilla.gnome.org/enter_bug.cgi?product=glibmm], [glibmm], [http://www.gtkmm.org/]) AC_PREREQ([2.59]) @@ -60,7 +60,7 @@ AS_IF([test "x$enable_static" = xyes], AC_DEFINE([GIOMM_STATIC_LIB], [1], [Define if giomm is built as a static library]) ]) -glibreq='2.0 >= 2.39.91' +glibreq='2.0 >= 2.39.92' GLIBMM_MODULES="sigc++-2.0 >= 2.2.10 glib-$glibreq gobject-$glibreq gmodule-$glibreq" GIOMM_MODULES="$GLIBMM_MODULES gio-$glibreq" diff --git a/gio/giomm/contenttype.cc b/gio/giomm/contenttype.cc index 9168899..a01a487 100644 --- a/gio/giomm/contenttype.cc +++ b/gio/giomm/contenttype.cc @@ -56,6 +56,7 @@ Glib::RefPtr content_type_get_icon(const Glib::ustring& type) return retvalue; } +#ifdef G_OS_UNIX Glib::RefPtr content_type_get_symbolic_icon(const Glib::ustring& type) { Glib::RefPtr retvalue = Glib::wrap(g_content_type_get_symbolic_icon(type.c_str())); @@ -63,6 +64,7 @@ Glib::RefPtr content_type_get_symbolic_icon(const Glib::ustring& type retvalue->reference(); //The function does not do a ref for us. return retvalue; } +#endif bool content_type_can_be_executable(const Glib::ustring& type) { diff --git a/gio/giomm/contenttype.h b/gio/giomm/contenttype.h index ee14264..476d916 100644 --- a/gio/giomm/contenttype.h +++ b/gio/giomm/contenttype.h @@ -97,6 +97,7 @@ Glib::ustring content_type_get_mime_type(const Glib::ustring& type); */ Glib::RefPtr content_type_get_icon(const Glib::ustring& type); +#ifdef G_OS_UNIX /** * Gets the symbolic icon for a content type. * @@ -106,6 +107,7 @@ Glib::RefPtr content_type_get_icon(const Glib::ustring& type); * @newin{2,34} */ Glib::RefPtr content_type_get_symbolic_icon(const Glib::ustring& type); +#endif /** * Checks if a content type can be executable. Note that for instance diff --git a/gio/src/application.ccg b/gio/src/application.ccg index 3dee00d..8175d9e 100644 --- a/gio/src/application.ccg +++ b/gio/src/application.ccg @@ -21,6 +21,7 @@ #include #include #include +#include // std::memset() namespace { @@ -207,4 +208,14 @@ void Application::open(const Glib::RefPtr& file, const Glib::ustring& open(files, hint); } +void Application::add_main_option_entry(Glib::OptionEntry& entry) +{ + //Create a temporary array, just so we can give the correct thing to g_application_add_main_option_entries(): + GOptionEntry array[2]; + array[0] = *(entry.gobj()); //Copy contents. + std::memset(&array[1], 0, sizeof(GOptionEntry)); + + g_application_add_main_option_entries(gobj(), array); +} + } // namespace Gio diff --git a/gio/src/application.hg b/gio/src/application.hg index d8d02ef..327736a 100644 --- a/gio/src/application.hg +++ b/gio/src/application.hg @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -129,6 +130,16 @@ public: _WRAP_METHOD(void set_action_group(const Glib::RefPtr& action_group), g_application_set_action_group) + + //TODO: Custom write the documentation for this method? + _WRAP_METHOD_DOCS_ONLY(g_application_add_main_option_entries) + void add_main_option_entry(Glib::OptionEntry& entry); + _IGNORE(g_application_add_main_option_entries) + + _WRAP_METHOD(void add_option_group(Glib::OptionGroup& group), g_application_add_option_group) + + + _WRAP_METHOD(bool is_registered() const, g_application_get_is_registered) _WRAP_METHOD(bool is_remote() const, g_application_get_is_remote) diff --git a/gio/src/gio_docs.xml b/gio/src/gio_docs.xml index 9e25bfd..27e4ce7 100644 --- a/gio/src/gio_docs.xml +++ b/gio/src/gio_docs.xml @@ -58791,8 +58791,8 @@ Since: 2.40 -On UNIX, returns the process ID as a decimal string. On Windows, -returns the result of GetProcessId() also as a string. +On UNIX, returns the process ID as a decimal string. +On Windows, returns the result of GetProcessId() also as a string. diff --git a/gio/src/gio_extra_objects.defs b/gio/src/gio_extra_objects.defs index fe3c161..acfab9a 100644 --- a/gio/src/gio_extra_objects.defs +++ b/gio/src/gio_extra_objects.defs @@ -18,6 +18,12 @@ (gtype-id "G_TYPE_ACTION_GROUP") ) +(define-object ActionMap + (in-module "Gio") + (c-name "GActionMap") + (gtype-id "G_TYPE_ACTION_MAP") +) + (define-object DBusConnection (in-module "Gio") (c-name "GDBusConnection") diff --git a/glib/glibmm/ustring.h b/glib/glibmm/ustring.h index f0fa217..6e09ecd 100644 --- a/glib/glibmm/ustring.h +++ b/glib/glibmm/ustring.h @@ -84,6 +84,20 @@ struct IteratorTraits * the old UTF-8 character and the new one to write could be different. * Therefore, any write operation would invalidate all other iterators * pointing into the same string. + * + * The Glib::ustring iterated over must contain only valid UTF-8 data. + * If it does not, operator++(), operator-\-() and operator*() may make + * accesses outside the bounds of the string. A loop such as the following + * one would not stop at the end of the string. + * @code + * // Bad code! Don't do this! + * const char not_utf8[] = { '\x80', '\xef', '\x80', '\x80', '\xef', '\x80' }; + * const Glib::ustring s(not_utf8, not_utf8 + sizeof not_utf8); + * for (Glib::ustring::const_iterator it = s.begin(); it != s.end(); ++it) + * std::cout << *it << std::endl; + * @endcode + * + * @tparam T std::string::iterator or std::string::const_iterator */ template class ustring_Iterator @@ -156,8 +170,13 @@ gunichar get_unichar_from_std_iterator(std::string::const_iterator pos) G_GNUC_P * character, and std::string::length() returns the number of bytes * rather than characters. So don't do that without a good reason. * @par + * Many member functions and operators of Glib::ustring and Glib::ustring_Iterator + * assume that the string contains only valid UTF-8 data. If it does not, memory + * outside the bounds of the string can be accessed. + * @par * In a perfect world the C++ Standard Library would contain a UTF-8 string - * class. Unfortunately, the C++ standard doesn't mention UTF-8 at all. Note + * class. Unfortunately, the C++98 standard doesn't mention UTF-8 at all. + * C++11 has UTF-8 literals but no UTF-8 string class. Note * that std::wstring is not a UTF-8 string class because it contains only * fixed-width characters (where width could be 32, 16, or even 8 bits). * diff --git a/tools/m4/convert_glib.m4 b/tools/m4/convert_glib.m4 index 5df0a27..3dd4e8d 100644 --- a/tools/m4/convert_glib.m4 +++ b/tools/m4/convert_glib.m4 @@ -122,7 +122,7 @@ _CONVERSION(`GObject*',`Glib::RefPtr',`Glib::wrap($3)') dnl OptionGroup _CONVERSION(`OptionGroup&',`GOptionGroup*',`($3).gobj()') -#_CONVERSION(`GOptionGroup*',`OptionGroup',`Glib::wrap(($3), true /* take_copy */)') +_CONVERSION(`Glib::OptionGroup&',`GOptionGroup*',`($3).gobj()') dnl Bytes _CONVERSION(`GBytes*',`Glib::RefPtr',`Glib::wrap($3)') -- 2.7.4