From afc970676779b221d5242e7bc56d4a401c832bac Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Thu, 4 Oct 2007 15:39:24 +0000 Subject: [PATCH] - fix comp_hash string output - avoid comparing padding in cchar_t structure - remove gawk from buildrequires --- ncurses-5.6-20070812-comphash.patch | 35 +++++++++++++++++++++++ ncurses-5.6-20070812-pad.patch | 44 +++++++++++++++++++++++++++++ ncurses.spec | 13 +++++++-- 3 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 ncurses-5.6-20070812-comphash.patch create mode 100644 ncurses-5.6-20070812-pad.patch diff --git a/ncurses-5.6-20070812-comphash.patch b/ncurses-5.6-20070812-comphash.patch new file mode 100644 index 0000000..b781662 --- /dev/null +++ b/ncurses-5.6-20070812-comphash.patch @@ -0,0 +1,35 @@ +Index: ncurses/tinfo/comp_hash.c +Prereq: 1.32 +--- ncurses-5.6-20070812+/ncurses/tinfo/comp_hash.c 2007-08-12 00:40:27.000000000 +0000 ++++ ncurses-5.6-20070818/ncurses/tinfo/comp_hash.c 2007-08-18 21:42:25.000000000 +0000 +@@ -50,7 +50,7 @@ + #define DEBUG(level, params) /*nothing */ + #endif + +-MODULE_ID("$Id: comp_hash.c,v 1.32 2007/08/12 00:40:27 tom Exp $") ++MODULE_ID("$Id: comp_hash.c,v 1.33 2007/08/18 21:42:25 tom Exp $") + + static int hash_function(const char *); + +@@ -299,17 +299,17 @@ + int len = 0; + int nxt; + +- printf("static const char %s_names_text[] = \"\\\n", root_name); ++ printf("static const char %s_names_text[] = \\\n", root_name); + for (n = 0; n < CAPTABSIZE; n++) { +- nxt = strlen(name_table[n].nte_name) + 2; ++ nxt = strlen(name_table[n].nte_name) + 5; + if (nxt + len > 72) { + printf("\\\n"); + len = 0; + } +- printf("%s\\0", name_table[n].nte_name); ++ printf("\"%s\\0\" ", name_table[n].nte_name); + len += nxt; + } +- printf("\";\n\n"); ++ printf(";\n\n"); + + len = 0; + printf("static name_table_data const %s_names_data[] =\n", diff --git a/ncurses-5.6-20070812-pad.patch b/ncurses-5.6-20070812-pad.patch new file mode 100644 index 0000000..32c8c91 --- /dev/null +++ b/ncurses-5.6-20070812-pad.patch @@ -0,0 +1,44 @@ +diff -up ncurses-5.6/ncurses/tty/hashmap.c.pad ncurses-5.6/ncurses/tty/hashmap.c +--- ncurses-5.6/ncurses/tty/hashmap.c.pad 2007-10-04 10:08:40.000000000 +0200 ++++ ncurses-5.6/ncurses/tty/hashmap.c 2007-10-04 10:08:40.000000000 +0200 +@@ -131,8 +131,8 @@ update_cost(NCURSES_CH_T * from, NCURSES + int cost = 0; + int i; + +- for (i = TEXTWIDTH; i > 0; i--) +- if (!(CharEq(*from++, *to++))) ++ for (i = TEXTWIDTH; i > 0; i--, from++, to++) ++ if (!(CharEq(*from, *to))) + cost++; + + return cost; +@@ -148,8 +148,8 @@ update_cost_from_blank(NCURSES_CH_T * to + if (back_color_erase) + SetPair(blank, GetPair(stdscr->_nc_bkgd)); + +- for (i = TEXTWIDTH; i > 0; i--) +- if (!(CharEq(blank, *to++))) ++ for (i = TEXTWIDTH; i > 0; i--, to++) ++ if (!(CharEq(blank, *to))) + cost++; + + return cost; +diff -up ncurses-5.6/ncurses/curses.priv.h.pad ncurses-5.6/ncurses/curses.priv.h +--- ncurses-5.6/ncurses/curses.priv.h.pad 2007-10-04 10:08:40.000000000 +0200 ++++ ncurses-5.6/ncurses/curses.priv.h 2007-10-04 10:38:33.000000000 +0200 +@@ -902,7 +902,14 @@ extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) + #define SetAttr(c,a) AttrOf(c) = ((a) & A_ATTRIBUTES) | WidecExt(c) + #define NewChar2(c,a) { a, { c, NulChar } NulColor } + #define NewChar(ch) NewChar2(ChCharOf(ch), ChAttrOf(ch)) +-#define CharEq(a,b) (!memcmp(&(a), &(b), sizeof(a))) ++#if CCHARW_MAX == 5 ++#define CharEq(a,b) ((a).attr == (b).attr && (a).chars[0] == (b).chars[0] \ ++ && (a).chars[1] == (b).chars[1] && (a).chars[2] == (b).chars[2] \ ++ && (a).chars[3] == (b).chars[3] && (a).chars[4] == (b).chars[4] \ ++ if_EXT_COLORS(&& (a).ext_color == (b).ext_color)) ++#else ++#error CCHARW_MAX != 5 ++#endif + #define SetChar(ch,c,a) do { \ + NCURSES_CH_T *_cp = &ch; \ + memset(_cp, 0, sizeof(ch)); \ diff --git a/ncurses.spec b/ncurses.spec index a0d7472..1e6bb76 100644 --- a/ncurses.spec +++ b/ncurses.spec @@ -1,7 +1,7 @@ Summary: A terminal handling library Name: ncurses Version: 5.6 -Release: 9.20070812%{?dist} +Release: 10.20070812%{?dist} License: MIT Group: System Environment/Libraries URL: http://invisible-island.net/ncurses/ncurses.html @@ -14,7 +14,9 @@ Patch8: ncurses-5.5-20061209-config.patch Patch9: ncurses-5.6-20070612-libs.patch Patch10: ncurses-5.5-20061209-xterm.patch Patch11: ncurses-5.6-20070120-urxvt.patch -BuildRequires: gpm-devel gawk +Patch12: ncurses-5.6-20070812-comphash.patch +Patch13: ncurses-5.6-20070812-pad.patch +BuildRequires: gpm-devel BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %description @@ -55,6 +57,8 @@ rm -rf tack %patch9 -p1 -b .libs %patch10 -p1 -b .xterm %patch11 -p1 -b .urxvt +%patch12 -p1 -b .comphash +%patch13 -p1 -b .pad # this will be in documentation, drop executable bits chmod 644 test/* @@ -184,6 +188,11 @@ rm -f ${RPM_BUILD_ROOT}%{_libdir}/terminfo rm -rf ${RPM_BUILD_ROOT} %changelog +* Thu Oct 04 2007 Miroslav Lichvar 5.6-10.20070812 +- fix comp_hash string output +- avoid comparing padding in cchar_t structure +- remove gawk from buildrequires + * Thu Aug 23 2007 Miroslav Lichvar 5.6-9.20070812 - rebuild - buildrequire gawk