Avoid __DATE__ and deprecated glib functions

OBS-URL: https://build.opensuse.org/package/show/X11:Utilities/putty?expand=0&rev=6
This commit is contained in:
Jan Engelhardt 2012-06-24 02:36:58 +00:00 committed by Git OBS Bridge
parent db620b33d0
commit b1d91f2dd9
4 changed files with 193 additions and 1 deletions

29
putty-04-nodate.diff Normal file
View File

@ -0,0 +1,29 @@
__DATE__/__TIME__ should not be used; it causes unnecessary
rebuilds in the build service.
---
version.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: putty-0.62/version.c
===================================================================
--- putty-0.62.orig/version.c
+++ putty-0.62/version.c
@@ -30,13 +30,13 @@ char sshver[] = "PuTTY-Prerelease-" STR(
#elif defined SVN_REV
-char ver[] = "Custom build r" STR(SVN_REV) ", " __DATE__ " " __TIME__;
+char ver[] = "Custom build r" STR(SVN_REV);
char sshver[] = "PuTTY-Custom-r" STR(SVN_REV);
#else
-char ver[] = "Unidentified build, " __DATE__ " " __TIME__;
-char sshver[] = "PuTTY-Local: " __DATE__ " " __TIME__;
+char ver[] = "Unidentified build";
+char sshver[] = "PuTTY-Local";
#endif

View File

@ -0,0 +1,128 @@
g_strcasecmp and g_strncasecmp are deprecated in glib-2.32.
---
unix/gtkfont.c | 57 +++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 37 insertions(+), 20 deletions(-)
Index: putty-0.62/unix/gtkfont.c
===================================================================
--- putty-0.62.orig/unix/gtkfont.c
+++ putty-0.62/unix/gtkfont.c
@@ -10,6 +10,8 @@
*/
#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
@@ -524,21 +526,21 @@ static void x11font_enum_fonts(GtkWidget
style = p;
p += sprintf(p, "%s", components[2][0] ? components[2] :
"regular");
- if (!g_strcasecmp(components[3], "i"))
+ if (!g_ascii_strcasecmp(components[3], "i"))
p += sprintf(p, " italic");
- else if (!g_strcasecmp(components[3], "o"))
+ else if (!g_ascii_strcasecmp(components[3], "o"))
p += sprintf(p, " oblique");
- else if (!g_strcasecmp(components[3], "ri"))
+ else if (!g_ascii_strcasecmp(components[3], "ri"))
p += sprintf(p, " reverse italic");
- else if (!g_strcasecmp(components[3], "ro"))
+ else if (!g_ascii_strcasecmp(components[3], "ro"))
p += sprintf(p, " reverse oblique");
- else if (!g_strcasecmp(components[3], "ot"))
+ else if (!g_ascii_strcasecmp(components[3], "ot"))
p += sprintf(p, " other-slant");
- if (components[4][0] && g_strcasecmp(components[4], "normal"))
+ if (components[4][0] && g_ascii_strcasecmp(components[4], "normal"))
p += sprintf(p, " %s", components[4]);
- if (!g_strcasecmp(components[10], "m"))
+ if (!g_ascii_strcasecmp(components[10], "m"))
p += sprintf(p, " [M]");
- if (!g_strcasecmp(components[10], "c"))
+ if (!g_ascii_strcasecmp(components[10], "c"))
p += sprintf(p, " [C]");
if (components[5][0])
p += sprintf(p, " %s", components[5]);
@@ -550,23 +552,23 @@ static void x11font_enum_fonts(GtkWidget
*/
p++;
stylekey = p;
- if (!g_strcasecmp(components[2], "medium") ||
- !g_strcasecmp(components[2], "regular") ||
- !g_strcasecmp(components[2], "normal") ||
- !g_strcasecmp(components[2], "book"))
+ if (!g_ascii_strcasecmp(components[2], "medium") ||
+ !g_ascii_strcasecmp(components[2], "regular") ||
+ !g_ascii_strcasecmp(components[2], "normal") ||
+ !g_ascii_strcasecmp(components[2], "book"))
weightkey = 0;
- else if (!g_strncasecmp(components[2], "demi", 4) ||
- !g_strncasecmp(components[2], "semi", 4))
+ else if (!g_ascii_strncasecmp(components[2], "demi", 4) ||
+ !g_ascii_strncasecmp(components[2], "semi", 4))
weightkey = 1;
else
weightkey = 2;
- if (!g_strcasecmp(components[3], "r"))
+ if (!g_ascii_strcasecmp(components[3], "r"))
slantkey = 0;
- else if (!g_strncasecmp(components[3], "r", 1))
+ else if (!g_ascii_strncasecmp(components[3], "r", 1))
slantkey = 2;
else
slantkey = 1;
- if (!g_strcasecmp(components[4], "normal"))
+ if (!g_ascii_strcasecmp(components[4], "normal"))
setwidthkey = 0;
else
setwidthkey = 1;
@@ -774,11 +776,16 @@ static int pangofont_check_desc_makes_se
matched = FALSE;
for (i = 0; i < nfamilies; i++) {
- if (!g_strcasecmp(pango_font_family_get_name(families[i]),
- pango_font_description_get_family(desc))) {
+ gchar *a = g_utf8_strdown(pango_font_family_get_name(families[i]), -1);
+ gchar *b = g_utf8_strdown(pango_font_description_get_family(desc), -1);
+ if (a != NULL && b != NULL && strcmp(a, b) == 0) {
+ g_free(a);
+ g_free(b);
matched = TRUE;
break;
}
+ g_free(a);
+ g_free(b);
}
g_free(families);
@@ -1375,6 +1382,7 @@ struct fontinfo_realname_find {
static int strnullcasecmp(const char *a, const char *b)
{
+ gchar *p, *q;
int i;
/*
@@ -1393,7 +1401,16 @@ static int strnullcasecmp(const char *a,
/*
* Otherwise, ordinary strcasecmp.
*/
- return g_strcasecmp(a, b);
+ p = g_utf8_strdown(a, -1);
+ q = g_utf8_strdown(b, -1);
+ if (p == NULL || q == NULL) {
+ fprintf(stderr, "%s\n", strerror(errno));
+ abort();
+ }
+ i = strcmp(p, q);
+ g_free(p);
+ g_free(q);
+ return i;
}
static int fontinfo_realname_compare(void *av, void *bv)

View File

@ -0,0 +1,32 @@
---
unix/Makefile.in | 3 ++-
unix/gtkcols.h | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
Index: putty-0.62/unix/Makefile.in
===================================================================
--- putty-0.62.orig/unix/Makefile.in
+++ putty-0.62/unix/Makefile.in
@@ -106,7 +106,8 @@
CC = @CC@
CFLAGS = @CFLAGS@ @PUTTYCFLAGS@ @CPPFLAGS@ @DEFS@ @GTK_CFLAGS@ -I.././ \
- -I../charset/ -I../windows/ -I../unix/ -I../macosx/
+ -I../charset/ -I../windows/ -I../unix/ -I../macosx/ \
+ -DGTK_DISABLE_SINGLE_INCLUDES
XLDFLAGS = @LDFLAGS@ @LIBS@ @GTK_LIBS@
ULDFLAGS = @LDFLAGS@ @LIBS@
INSTALL=@INSTALL@
Index: putty-0.62/unix/gtkcols.h
===================================================================
--- putty-0.62.orig/unix/gtkcols.h
+++ putty-0.62/unix/gtkcols.h
@@ -8,7 +8,7 @@
#define COLUMNS_H
#include <gdk/gdk.h>
-#include <gtk/gtkcontainer.h>
+#include <gtk/gtk.h>
#ifdef __cplusplus
extern "C" {

View File

@ -28,6 +28,9 @@ Source: %name-%version.tar.bz2
Patch1: putty-01-werror.diff
Patch2: putty-02-remove-gtk1.diff
Patch3: putty-03-config.diff
Patch4: putty-04-nodate.diff
Patch5: putty-05-glib-deprecated.diff
Patch6: putty-06-gtk2-indivhdr.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: autoconf
BuildRequires: automake
@ -41,7 +44,7 @@ serial console client.
%prep
%setup -q
%patch -P 1 -P 2 -P 3 -p1
%patch -P 1 -P 2 -P 3 -P 4 -P 5 -P 6 -p1
%build
pushd unix/;