diff --git a/newt-0.52.6-countitems.patch b/newt-0.52.6-countitems.patch new file mode 100644 index 0000000..14bf78a --- /dev/null +++ b/newt-0.52.6-countitems.patch @@ -0,0 +1,63 @@ +Index: checkboxtree.c +=================================================================== +RCS file: /usr/local/CVS/newt/checkboxtree.c,v +retrieving revision 1.32 +retrieving revision 1.33 +diff -u -r1.32 -r1.33 +--- checkboxtree.c 30 Jan 2007 14:03:18 -0000 1.32 ++++ checkboxtree.c 12 Apr 2007 16:57:33 -0000 1.33 +@@ -38,8 +38,7 @@ + static struct items * findItem(struct items * items, const void * data); + static void buildFlatList(newtComponent co); + static void doBuildFlatList(struct CheckboxTree * ct, struct items * item); +-enum countWhat { COUNT_EXPOSED=0, COUNT_SELECTED=1 }; +-static int countItems(struct items * item, enum countWhat justExposed); ++static int countItems(struct items * item, int what); + static inline void updateWidth(newtComponent co, struct CheckboxTree * ct, + int maxField); + +@@ -60,13 +59,14 @@ + ct->sb->left = co->left + co->width - 1; + } + +-static int countItems(struct items * item, enum countWhat what) { ++static int countItems(struct items * item, int what) { + int count = 0; + + while (item) { +- if ((!item->branch && item->selected == what) || (what == COUNT_EXPOSED)) ++ if (what < 0 || !item->branch && (what > 0 && item->selected == what ++ || what == 0 && item->selected)) + count++; +- if (item->branch || (what == COUNT_EXPOSED && item->selected)) ++ if (item->branch && (what >= 0 || what < 0 && item->selected)) + count += countItems(item->branch, what); + item = item->next; + } +@@ -88,7 +88,7 @@ + struct CheckboxTree * ct = co->data; + + if (ct->flatList) free(ct->flatList); +- ct->flatCount = countItems(ct->itemlist, COUNT_EXPOSED); ++ ct->flatCount = countItems(ct->itemlist, -1); + + ct->flatList = malloc(sizeof(*ct->flatList) * (ct->flatCount+1)); + ct->flatCount = 0; +@@ -273,7 +273,7 @@ + + static void listSelected(struct items * items, int * num, const void ** list, int seqindex) { + while (items) { +- if ((seqindex ? items->selected==seqindex : items->selected) && !items->branch) ++ if ((seqindex ? items->selected==seqindex : items->selected) && !items->branch) + list[(*num)++] = (void *) items->data; + if (items->branch) + listSelected(items->branch, num, list, seqindex); +@@ -312,7 +312,7 @@ + seqindex = 0; + } + +- *numitems = countItems(ct->itemlist, (seqindex ? seqindex : COUNT_SELECTED)); ++ *numitems = countItems(ct->itemlist, seqindex); + if (!*numitems) return NULL; + + retval = malloc(*numitems * sizeof(void *)); diff --git a/newt-0.52.6-cursor.patch b/newt-0.52.6-cursor.patch new file mode 100644 index 0000000..141841d --- /dev/null +++ b/newt-0.52.6-cursor.patch @@ -0,0 +1,24 @@ +Index: newt.c +=================================================================== +RCS file: /usr/local/CVS/newt/newt.c,v +retrieving revision 1.75 +retrieving revision 1.76 +diff -u -r1.75 -r1.76 +--- newt.c 28 Feb 2007 17:35:01 -0000 1.75 ++++ newt.c 11 Apr 2007 14:31:40 -0000 1.76 +@@ -778,8 +778,13 @@ + } + + void newtGetrc(int * row, int * col) { +- *row = cursorRow; +- *col = cursorCol; ++ *row = cursorRow; ++ *col = cursorCol; ++ ++ if (currentWindow) { ++ *row -= currentWindow->top; ++ *col -= currentWindow->left; ++ } + } + + void newtGotorc(int newRow, int newCol) { diff --git a/newt-0.52.6-memleaks.patch b/newt-0.52.6-memleaks.patch new file mode 100644 index 0000000..463cbf9 --- /dev/null +++ b/newt-0.52.6-memleaks.patch @@ -0,0 +1,67 @@ +Index: checkboxtree.c +=================================================================== +RCS file: /usr/local/CVS/newt/checkboxtree.c,v +retrieving revision 1.33 +retrieving revision 1.34 +diff -u -r1.33 -r1.34 +--- checkboxtree.c 12 Apr 2007 16:57:33 -0000 1.33 ++++ checkboxtree.c 12 Apr 2007 17:03:57 -0000 1.34 +@@ -531,19 +531,26 @@ + (*ct->currItem ? (*ct->currItem)->depth : 0) * 3 + 4); + } + +-static void ctDestroy(newtComponent co) { +- struct CheckboxTree * ct = co->data; +- struct items * item, * nextitem; +- +- nextitem = item = ct->itemlist; ++static void destroyItems(struct items * item) { ++ struct items * nextitem; + + while (item != NULL) { + nextitem = item->next; + free(item->text); ++ if (item->branch) ++ destroyItems(item->branch); + free(item); + item = nextitem; + } ++} ++ ++static void ctDestroy(newtComponent co) { ++ struct CheckboxTree * ct = co->data; + ++ destroyItems(ct->itemlist); ++ free(ct->flatList); ++ if (ct->sb) ++ ct->sb->ops->destroy(ct->sb); + free(ct->seq); + free(ct); + free(co); +@@ -802,6 +809,7 @@ + treeTop = item->branch; + } + ++ free(path); + buildFlatList(co); + + item = findItem(ct->itemlist, data); +Index: textbox.c +=================================================================== +RCS file: /usr/local/CVS/newt/textbox.c,v +retrieving revision 1.38 +retrieving revision 1.39 +diff -u -r1.38 -r1.39 +--- textbox.c 12 Oct 2006 14:18:38 -0000 1.38 ++++ textbox.c 12 Apr 2007 17:03:57 -0000 1.39 +@@ -451,6 +451,10 @@ + int i; + struct textbox * tb = co->data; + ++ if (tb->sb) ++ tb->sb->ops->destroy(tb->sb); ++ if (tb->sb_act) ++ tb->sb_act->ops->destroy(tb->sb_act); + for (i = 0; i < tb->numLines; i++) + free(tb->lines[i]); + free(tb->lines); diff --git a/newt.spec b/newt.spec index bc9fe78..c939784 100644 --- a/newt.spec +++ b/newt.spec @@ -1,7 +1,7 @@ Summary: A development library for text mode user interfaces Name: newt Version: 0.52.6 -Release: 2%{?dist} +Release: 3%{?dist} License: LGPL Group: System Environment/Libraries # The source for this package was pulled from upstream's vcs. Use the @@ -13,6 +13,9 @@ BuildRequires: python, python-devel, slang-devel Provides: snack = %{version}-%{release} BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Patch1: newt-0.52.6-entry.patch +Patch2: newt-0.52.6-cursor.patch +Patch3: newt-0.52.6-countitems.patch +Patch4: newt-0.52.6-memleaks.patch %package devel Summary: Newt windowing toolkit development files @@ -51,6 +54,9 @@ Install it if you need to link statically with libnewt. %prep %setup -q %patch1 -p0 -b .entry +%patch2 -p0 -b .cursor +%patch3 -p0 -b .countitems +%patch4 -p0 -b .memleaks %build # gpm support seems to smash the stack w/ we use help in anaconda?? @@ -90,6 +96,11 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/libnewt.a %changelog +* Thu Apr 12 2007 Miroslav Lichvar - 0.52.6-3 +- fix cursor positioning when setting entry or checkbox flags +- fix counting of items in checkboxtree +- fix some memory leaks + * Wed Apr 04 2007 Miroslav Lichvar - 0.52.6-2 - fix entry scrolling (#234829) - fix multibyte character handling in entry