rpms/newt/devel newt-0.52.6-countitems.patch, NONE, 1.1 newt-0.52.6-cursor.patch, NONE, 1.1 newt-0.52.6-memleaks.patch, NONE, 1.1 newt.spec, 1.47, 1.48
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Thu Apr 12 17:30:46 UTC 2007
Author: mlichvar
Update of /cvs/dist/rpms/newt/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv18049
Modified Files:
newt.spec
Added Files:
newt-0.52.6-countitems.patch newt-0.52.6-cursor.patch
newt-0.52.6-memleaks.patch
Log Message:
- fix cursor positioning when setting entry or checkbox flags
- fix counting of items in checkboxtree
- fix some memory leaks
newt-0.52.6-countitems.patch:
checkboxtree.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
--- NEW FILE newt-0.52.6-countitems.patch ---
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 *));
newt-0.52.6-cursor.patch:
newt.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
--- NEW FILE newt-0.52.6-cursor.patch ---
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) {
newt-0.52.6-memleaks.patch:
checkboxtree.c | 18 +++++++++++++-----
textbox.c | 4 ++++
2 files changed, 17 insertions(+), 5 deletions(-)
--- NEW FILE newt-0.52.6-memleaks.patch ---
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);
Index: newt.spec
===================================================================
RCS file: /cvs/dist/rpms/newt/devel/newt.spec,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- newt.spec 4 Apr 2007 16:06:20 -0000 1.47
+++ newt.spec 12 Apr 2007 17:30:43 -0000 1.48
@@ -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 @@
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 @@
%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 @@
%{_libdir}/libnewt.a
%changelog
+* Thu Apr 12 2007 Miroslav Lichvar <mlichvar at redhat.com> - 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 <mlichvar at redhat.com> - 0.52.6-2
- fix entry scrolling (#234829)
- fix multibyte character handling in entry
More information about the fedora-cvs-commits
mailing list