Date: Tue, 25 Feb 2003 00:57:35 +0800 (CST) From: Alex Wang <alex@alexwang.com> To: FreeBSD-gnats-submit@FreeBSD.org Cc: alex@alexwang.com Subject: gnu/48638: [PATCH] some bug fixs in libdialog Message-ID: <200302241657.h1OGvZZt009447@alexwang.com>
next in thread | raw e-mail | index | archive | help
>Number: 48638 >Category: gnu >Synopsis: [PATCH] some bug fixs in libdialog >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Feb 24 09:00:28 PST 2003 >Closed-Date: >Last-Modified: >Originator: Alex Wang >Release: FreeBSD 4.7-RELEASE i386 >Organization: >Environment: System: FreeBSD alexwang.com 4.7-RELEASE FreeBSD 4.7-RELEASE #0: Mon Oct 14 05:21:51 CST 2002 alex@alexwang.com:/usr/src/sys/compile/ALEX i386 >Description: 1.checklist.c: Enable user to set the position of checklist. 2.fselect.c: Memory leak problem in dir select memu. In dialog_dselect() menu, press cancel but return TURE, which should be FALSE. 3.menubox.c: In dialog_menu(), if we can input a (int *) to set the position of light bar. After user move the light bar, we have to change the (int *) that user input to record the current position. This enables user to memorize the selected item and places the light bar in the right position next time we show the menu. >How-To-Repeat: >Fix: ***************** For RELENG_4 ********************** Index: checklist.c =================================================================== RCS file: /home/ncvs/src/gnu/lib/libdialog/checklist.c,v retrieving revision 1.35.2.2 diff -u -b -r1.35.2.2 checklist.c --- checklist.c 2001/08/31 03:04:59 1.35.2.2 +++ checklist.c 2003/02/24 16:20:03 @@ -113,7 +113,7 @@ height = LINES; /* center dialog box on screen */ x = (COLS - width)/2; - y = (LINES - height)/2; + y = DialogY ? DialogY : (LINES - height)/2; #ifdef HAVE_NCURSES if (use_shadow) Index: fselect.c =================================================================== RCS file: /home/ncvs/src/gnu/lib/libdialog/fselect.c,v retrieving revision 1.5 diff -u -b -r1.5 fselect.c --- fselect.c 1997/02/18 14:26:19 1.5 +++ fselect.c 2003/02/24 16:20:03 @@ -210,7 +210,10 @@ * Desc: Choose a directory */ { - if (dialog_dfselect(dir, fmask, FALSE)) { + char *szSelDir; + szSelDir = dialog_dfselect(dir, fmask, FALSE); + if (szSelDir) { + free(szSelDir); return(FALSE); /* esc or cancel was pressed */ } else { return(TRUE); /* directory was selected */ @@ -391,12 +394,14 @@ FreeNames(fnames, nf); delwin(fs_win); - if (cancel || (strlen(o_sel) == 0)) { + if (is_fselect && cancel) { return(NULL); - } else { + }else if (cancel || (is_fselect &&(strlen(o_sel) != 0))) { ret_name = (char *) malloc( strlen(o_sel) + 1 ); strcpy(ret_name, o_sel); return(ret_name); + } else { + return(NULL); } } /* dialog_fselect() */ Index: menubox.c =================================================================== RCS file: /home/ncvs/src/gnu/lib/libdialog/menubox.c,v retrieving revision 1.35.2.1 diff -u -b -r1.35.2.1 menubox.c --- menubox.c 2001/07/31 20:34:00 1.35.2.1 +++ menubox.c 2003/02/24 16:20:03 @@ -392,6 +392,9 @@ delwin(menu); delwin(dialog); dialog_clear(); + if (ch) { + *ch = choice; + } goto draw; } } ***************** End of RELENG_4 **************** ***************** FOR CURRENT ****************** Index: checklist.c =================================================================== RCS file: /home/ncvs/src/gnu/lib/libdialog/checklist.c,v retrieving revision 1.38 diff -u -b -r1.38 checklist.c --- checklist.c 2001/08/31 01:56:06 1.38 +++ checklist.c 2003/02/24 16:20:51 @@ -113,7 +113,7 @@ height = LINES; /* center dialog box on screen */ x = (COLS - width)/2; - y = (LINES - height)/2; + y = DialogY ? DialogY : (LINES - height)/2; #ifdef HAVE_NCURSES if (use_shadow) Index: fselect.c =================================================================== RCS file: /home/ncvs/src/gnu/lib/libdialog/fselect.c,v retrieving revision 1.5 diff -u -b -r1.5 fselect.c --- fselect.c 1997/02/18 14:26:19 1.5 +++ fselect.c 2003/02/24 16:20:51 @@ -210,7 +210,10 @@ * Desc: Choose a directory */ { - if (dialog_dfselect(dir, fmask, FALSE)) { + char *szSelDir; + szSelDir = dialog_dfselect(dir, fmask, FALSE); + if (szSelDir) { + free(szSelDir); return(FALSE); /* esc or cancel was pressed */ } else { return(TRUE); /* directory was selected */ @@ -391,12 +394,14 @@ FreeNames(fnames, nf); delwin(fs_win); - if (cancel || (strlen(o_sel) == 0)) { + if (is_fselect && cancel) { return(NULL); - } else { + }else if (cancel || (is_fselect &&(strlen(o_sel) != 0))) { ret_name = (char *) malloc( strlen(o_sel) + 1 ); strcpy(ret_name, o_sel); return(ret_name); + } else { + return(NULL); } } /* dialog_fselect() */ Index: menubox.c =================================================================== RCS file: /home/ncvs/src/gnu/lib/libdialog/menubox.c,v retrieving revision 1.36 diff -u -b -r1.36 menubox.c --- menubox.c 2001/07/18 05:21:36 1.36 +++ menubox.c 2003/02/24 16:20:51 @@ -392,6 +392,9 @@ delwin(menu); delwin(dialog); dialog_clear(); + if (ch) { + *ch = choice; + } goto draw; } } ======================================================== >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200302241657.h1OGvZZt009447>