Subject: Re: Volunteers needed to test wide character support in curses
To: Ruibiao Qiu <ruibiao@arl.wustl.edu>
From: Bang Jun-Young <junyoung@netbsd.org>
List: current-users
Date: 08/24/2005 05:38:21
Ruibiao Qiu wrote:
> Hi all
> 
> I have just finished the code to support wide characters in the NetBSD curses 
> libraries.  It was started with the source code base from the NetBSD current 
> checked out on June 28, 2005.  I have tested with Chinese locales 
> (zh_CN.GB18030 and zh_TW.Big5), and some simple tests with Japanese locale.  I 
> would highly appreciate it if some volunteers could test it on other wide 
> character locales, such as Korean.
> 
> To test the new code, first make a copy of your current source under 
> lib/libcurses in the source tree.  Download the new sources from the sf.net CVS 
> repository.  For more details, please refer to instructions at the bottom of 
> the project page
> http://netbsd-soc.sourceforge.net/projects/wcurses/

Thanks for working on this. A couple things have been found to note (mostly
about coding style):

* The web site says that
  "See the README.NetBSD file for building and usage instructions"
  but I can't find a file of such a name. Do I miss something?

* Lots of commit logs say that
  "Adjusted indentation according to the NetBSD coding standard"
  but many of them were done incorrectly indeed. For example:

  -add_wchstr(const cchar_t *wchstr)
  +add_wchstr(const cchar_t * wchstr)

  And there are unnecessary whitespaces: 

  #endif				/* HAVE_WCHAR */

  This should be changed to

  #endif /* HAVE_WCHAR */

  See src/share/misc/style for the NetBSD coding style.

* In many places assignment operator = is used within if () statement as
  follows:

  	if (np = lp->nsp) {

  IIRC, this will cause gcc to issue a warning or an error on compilation,
  and is generally not a good way of coding since it may hide subtle bugs.

* Some code are somewhat unreadable, IMHO:

+						if ( !( tnp = ( nschar_t *)malloc( sizeof( nschar_t ))))
+							return ERR;

  Too deep indent level, unnecessary whitespaces around ( and ),
  unnecessary casting such as (nschar_t *), comparison by !, etc.

  The above code can be written as follows (ignoring indent level):

  ...	tnp = malloc(sizeof(nschar_t));
  ...	if (tnp == NULL)
  ...		return ERR;

Hope this helps,

Jun-Young