Backport two fixes from upstream

- calendar: Use the new "%OB" format if supported
- Fix compiler warnings with GCC 8.1

https://bugzilla.redhat.com/show_bug.cgi?id=1669768
This commit is contained in:
Kalev Lember 2019-01-27 07:54:48 +01:00
parent 2e36051005
commit d1a98a01b8
3 changed files with 141 additions and 7 deletions

View File

@ -0,0 +1,67 @@
From 889a63dffc72c048502d0f7d2b26bfc8532462eb Mon Sep 17 00:00:00 2001
From: John Lindgren <john@jlindgren.net>
Date: Tue, 15 May 2018 21:47:12 -0400
Subject: [PATCH] Fix compiler warnings with GCC 8.1.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
GCC 8.1 added some new warnings, including warning about parentheses
with no effect in variable declarations. GTK2 headers have a few of
these, which produce a lot of warnings in projects using GTK2.
The warnings look like:
/usr/include/gtk-2.0/gtk/gtkfilechooserbutton.h:59:8: warning:
unnecessary parentheses in declaration of __gtk_reserved1 [-Wparentheses]
void (*__gtk_reserved1);
^
Removing the parentheses is harmless and fixes the warnings.
---
gtk/gtkfilechooserbutton.h | 14 +++++++-------
gtk/gtkstatusicon.h | 4 ++--
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/gtk/gtkfilechooserbutton.h b/gtk/gtkfilechooserbutton.h
index b3d9112cf9..fdacc4b6ec 100644
--- a/gtk/gtkfilechooserbutton.h
+++ b/gtk/gtkfilechooserbutton.h
@@ -56,13 +56,13 @@ struct _GtkFileChooserButtonClass
void (* file_set) (GtkFileChooserButton *fc);
- void (*__gtk_reserved1);
- void (*__gtk_reserved2);
- void (*__gtk_reserved3);
- void (*__gtk_reserved4);
- void (*__gtk_reserved5);
- void (*__gtk_reserved6);
- void (*__gtk_reserved7);
+ void *__gtk_reserved1;
+ void *__gtk_reserved2;
+ void *__gtk_reserved3;
+ void *__gtk_reserved4;
+ void *__gtk_reserved5;
+ void *__gtk_reserved6;
+ void *__gtk_reserved7;
};
diff --git a/gtk/gtkstatusicon.h b/gtk/gtkstatusicon.h
index 19dbd1cdeb..c45caca5ae 100644
--- a/gtk/gtkstatusicon.h
+++ b/gtk/gtkstatusicon.h
@@ -73,8 +73,8 @@ struct _GtkStatusIconClass
gboolean keyboard_mode,
GtkTooltip *tooltip);
- void (*__gtk_reserved1);
- void (*__gtk_reserved2);
+ void *__gtk_reserved1;
+ void *__gtk_reserved2;
};
GType gtk_status_icon_get_type (void) G_GNUC_CONST;
--
2.20.1

View File

@ -0,0 +1,63 @@
From 2ea743ab466703091a44a74e1a4ac7db983c0bca Mon Sep 17 00:00:00 2001
From: Rafal Luzynski <digitalfreak@lingonborough.com>
Date: Sat, 10 Feb 2018 14:07:56 +0100
Subject: [PATCH] calendar: Use the new "%OB" format if supported
Due to the recent changes introduced in glibc 2.27 "%OB" is the
correct format to obtain a month name as used in the calendar
header. The same rule has been working in BSD family (including
OS X) since 1990s. This simple hack checks whether "%OB" is supported
at runtime and uses it if it is, falls back to the old "%B" otherwise.
Closes: #9
---
gtk/gtkcalendar.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index 2dd68d6394..28baba16f1 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -689,6 +689,7 @@ gtk_calendar_init (GtkCalendar *calendar)
#ifdef G_OS_WIN32
wchar_t wbuffer[100];
#else
+ static const char *month_format = NULL;
char buffer[255];
time_t tmp_time;
#endif
@@ -714,7 +715,7 @@ gtk_calendar_init (GtkCalendar *calendar)
{
#ifndef G_OS_WIN32
tmp_time= (i+3)*86400;
- strftime ( buffer, sizeof (buffer), "%a", gmtime (&tmp_time));
+ strftime (buffer, sizeof (buffer), "%a", gmtime (&tmp_time));
default_abbreviated_dayname[i] = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
#else
if (!GetLocaleInfoW (GetThreadLocale (), LOCALE_SABBREVDAYNAME1 + (i+6)%7,
@@ -730,7 +731,21 @@ gtk_calendar_init (GtkCalendar *calendar)
{
#ifndef G_OS_WIN32
tmp_time=i*2764800;
- strftime ( buffer, sizeof (buffer), "%B", gmtime (&tmp_time));
+ if (G_UNLIKELY (month_format == NULL))
+ {
+ buffer[0] = '\0';
+ month_format = "%OB";
+ strftime (buffer, sizeof (buffer), month_format, gmtime (&tmp_time));
+ /* "%OB" is not supported in Linux with glibc < 2.27 */
+ if (!strcmp (buffer, "%OB") || !strcmp (buffer, "OB") || !strcmp (buffer, ""))
+ {
+ month_format = "%B";
+ strftime (buffer, sizeof (buffer), month_format, gmtime (&tmp_time));
+ }
+ }
+ else
+ strftime (buffer, sizeof (buffer), month_format, gmtime (&tmp_time));
+
default_monthname[i] = g_locale_to_utf8 (buffer, -1, NULL, NULL, NULL);
#else
if (!GetLocaleInfoW (GetThreadLocale (), LOCALE_SMONTHNAME1 + i,
--
2.20.1

View File

@ -20,7 +20,7 @@
Summary: GTK+ graphical user interface library
Name: gtk2
Version: 2.24.32
Release: 3%{?dist}
Release: 4%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
URL: http://www.gtk.org
@ -38,6 +38,10 @@ Patch8: tooltip-positioning.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=611313
Patch15: window-dragging.patch
# Backported from upstream:
Patch20: 0001-calendar-Use-the-new-OB-format-if-supported.patch
Patch21: 0001-Fix-compiler-warnings-with-GCC-8.1.patch
BuildRequires: pkgconfig(atk) >= %{atk_version}
BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version}
BuildRequires: pkgconfig(gobject-introspection-1.0) >= %{gobject_introspection_version}
@ -143,12 +147,7 @@ Requires: gtk2 = %{version}-%{release}
This package contains developer documentation for the GTK+ widget toolkit.
%prep
%setup -q -n gtk+-%{version}
%patch1 -p1 -b .system-python
%patch2 -p1 -b .icon-padding
%patch8 -p1 -b .tooltip-positioning
%patch15 -p1 -b .window-dragging
%autosetup -n gtk+-%{version} -p1
%build
export CFLAGS='-fno-strict-aliasing %optflags'
@ -324,6 +323,11 @@ gtk-query-immodules-2.0-%{__isa_bits} --update-cache
%doc tmpdocs/examples
%changelog
* Sun Jan 27 2019 Kalev Lember <klember@redhat.com> - 2.24.32-4
- Backport two fixes from upstream (#1669768)
- calendar: Use the new "%OB" format if supported
- Fix compiler warnings with GCC 8.1
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.24.32-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild