[GRASS5] PATCH: Remove Tape_Info and related funcs

Brad Douglas rez at touchofmadness.com
Wed Mar 30 10:38:49 EST 2005


On Wed, 2005-03-30 at 18:28 +1200, Hamish wrote:
> > The attached patches will remove the legacy Tape_Info struct and
> > associated functions from lib/imagery.
> > 
> > After applied, the files advance.c, band_io.c and tape_info.c can be
> > removed.
> 
> 
> 3 comments:
> 
> a) what functionality is lost? (which modules would be removed from the
> to-be-ported list?) Can anyone comment on Tape storage functions used in
> historical versions of GRASS?

I assume you are talking about the TODO file that shows the to-be-ported
list?  The only modules to use Tape_Info were the i.tape.* commands.  I
asked Markus about it and he seemed to think it was legacy code.

> b) It is nice to keep cosmetic / simple fixes separate from functional
> changes in the diff files. This makes understanding and tracking 
> fundamental changes in the CVS easier (also makes it easier to back them
> out later if needed). On the other side, the small changes can be
> applied quickly without much debate and less review.

I'm sorry.  I also included a couple compiler compaints, as well.  I'll
submit them separately from now on.  I'll make the changes noted below
and resubmit properly.

> c) I take it this fixes a "reached the end of non-void fn" warning.
>  i)  this fn can probably be replaced by G_percent() and removed.
>  ii) an exit code of 0 should be used, not 1. The UNIX convention is
>      zero means success, else means failed. (many ways to fail)
> 
> Index: lib/imagery/percent.c
> ===================================================================
> RCS file: /home/grass/grassrepository/grass6/lib/imagery/percent.c,v
> retrieving revision 2.0
> diff -u -u -r2.0 percent.c
> --- lib/imagery/percent.c	9 Nov 2004 12:27:57 -0000	2.0
> +++ lib/imagery/percent.c	28 Mar 2005 00:46:37 -0000
> @@ -24,7 +24,7 @@
>      register int x;
>  
>      x = n*100/d ;
> -    if (x % s) return;
> +    if (x % s) return 1;
>      if (n <= 0 || n >= d || x != prev)
>      {
>  	prev = x;
> @@ -36,4 +36,6 @@
>  	fprintf (stdout,"\n");
>  	prev = -1;
>      }
> +
> +    return 1;
>  }

Yes, it was a fix for "end of non-void fn".  Generally, I use
EXIT_SUCCESS or EXIT_FAILURE to avoid such things, but I was trying to
keep to GRASS style.  I'll look into replacing with G_percent().


-- 
Brad Douglas <rez at touchofmadness.com>




More information about the grass-dev mailing list