[GRASS5] Undefined `NAME_LEN' in Imagery lib on current CVS

This is the error in the current CVS grass 5.3 version.

   SRC = /home/riade/src/grass/grass-5.3_exp_13052004/src
   CMD = /home/riade/src/grass/grass-5.3_exp_13052004/src/CMD
   UNUSED = /home/riade/src/grass/grass-5.3_exp_13052004/unused
   HEADER = head.i686-pc-linux-gnu
   ARCH = i686-pc-linux-gnu
   GISBASE = /home/riade/src/grass/grass-5.3_exp_13052004/dist.i686-pc-linux-gnu
   VERSION = 5.3-cvs 2004
#################################################################
/home/riade/src/grass/grass-5.3_exp_13052004/src/libes/imagery
   make -f OBJ.i686-pc-linux-gnu/make.rules

gcc -I/home/riade/src/grass/grass-5.3_exp_13052004/src/include -g -O2 -c ask_bands.c -o OBJ.i686-pc-linux-gnu/ask_bands.o
ask_bands.c: In function `I_bandname':
ask_bands.c:14: error: `NAME_LEN' undeclared (first use in this function)
ask_bands.c:14: error: (Each undeclared identifier is reported only once
ask_bands.c:14: error: for each function it appears in.)
ask_bands.c:14: error: storage size of `name' isn't known
make: *** [OBJ.i686-pc-linux-gnu/ask_bands.o] Error 1

It is used only in Imagery Lib as shown:

imagery/i.tape.tm.fast/cmd/tape.h:#define MAX_NAME_LENGTH 11
imagery/i.tape.tm.fast/cmd/tape.h: char name[MAX_NAME_LENGTH];
imagery/i.tape.tm.fast/cmd/tape.h: char grp_name[MAX_NAME_LENGTH];
imagery/i.tape.tm3/fileseq.c: fileseq->name = malloc(FILENAME_LEN);
imagery/i.tape.tm3/fileseq.c: fgets(fileseq->name, FILENAME_LEN, stdin);
imagery/i.tape.tm3/fileseq.h:#define FILENAME_LEN 100
include/vect/dig_head.h:#define DIG_YOUR_NAME_LEN 20
include/vect/dig_head.h:#define DIG_MAP_NAME_LEN 41
libes/dbmi/drivers/odbc/listtab.c: SQLCHAR tableName[SQL_MAX_TABLE_NAME_LEN];
libes/imagery/ask_bands.c: static char name[NAME_LEN];
libes/imagery/group.c: char name[NAME_LEN], mapset[NAME_LEN];
libes/imagery/nfiles.c: char name[NAME_LEN], mapset[NAME_LEN];
libes/imagery/vask_group.c: char tgroup[NAME_LEN], tsubgroup[NAME_LEN];
libes/imagery/vask_group.c: V_ques (group, 's', line++, 10, NAME_LEN);
libes/imagery/vask_group.c: V_const (group, 's', line++, 10, NAME_LEN);
libes/imagery/vask_group.c: V_ques (subgroup, 's', line++, 10, NAME_LEN);
libes/vect32/Vlib/init_head.c:#define DIG_YOUR_NAME_LEN 20
libes/vect32/Vlib/init_head.c:#define DIG_MAP_NAME_LEN 41
libes/vect32/Vlib/init_head.c: strncpy (to->your_name, from->your_name, DIG_YOUR_NAME_LEN);
libes/vect32/Vlib/init_head.c: strncpy (to->map_name, from->map_name, DIG_MAP_NAME_LEN);
libes/vect32/Vlib/x_rw_binary.c: dhead->your_name[DIG_YOUR_NAME_LEN-1] = 0;
libes/vect32/Vlib/x_rw_binary.c: dhead->map_name[DIG_MAP_NAME_LEN-1] = 0;
libes/vect32_64/Vlib/init_head.c:#define DIG_YOUR_NAME_LEN 20
libes/vect32_64/Vlib/init_head.c:#define DIG_MAP_NAME_LEN 41
libes/vect32_64/Vlib/init_head.c: strncpy (to->your_name, from->your_name, DIG_YOUR_NAME_LEN);
libes/vect32_64/Vlib/init_head.c: strncpy (to->map_name, from->map_name, DIG_MAP_NAME_LEN);
libes/vect32_64/Vlib/x_rw_binary.c: dhead->your_name[DIG_YOUR_NAME_LEN-1] = 0;
libes/vect32_64/Vlib/x_rw_binary.c: dhead->map_name[DIG_MAP_NAME_LEN-1] = 0;
mapdev/v.transform/main.c: /* truncate if string > DIG_MAP_NAME_LEN-1 */
mapdev/v.transform/main.c: buf[DIG_MAP_NAME_LEN-1] = '\0';
raster/r.contour/main.c: strncpy (Head.map_name, mapname, DIG_MAP_NAME_LEN); /* uses GISLIB strncpy() */
raster/r.contour/main.c: mapname[DIG_MAP_NAME_LEN - 1] = '\0'; /* ensure that mapname is properly terminated */

Where is the problem? some missed in imagery.h?

BeSoS Luis

Sorry for this, I forgot to upload the updated
src/include/imagery.h

Should be fixed now,

Markus

PS: Was a bug for a few hours...

On Thu, May 13, 2004 at 03:27:07PM +0200, Luigi Pirelli wrote:

This is the error in the current CVS grass 5.3 version.

  SRC = /home/riade/src/grass/grass-5.3_exp_13052004/src
  CMD = /home/riade/src/grass/grass-5.3_exp_13052004/src/CMD
  UNUSED = /home/riade/src/grass/grass-5.3_exp_13052004/unused
  HEADER = head.i686-pc-linux-gnu
  ARCH = i686-pc-linux-gnu
  GISBASE =
  /home/riade/src/grass/grass-5.3_exp_13052004/dist.i686-pc-linux-gnu
  VERSION = 5.3-cvs 2004
#################################################################
/home/riade/src/grass/grass-5.3_exp_13052004/src/libes/imagery
  make -f OBJ.i686-pc-linux-gnu/make.rules

gcc -I/home/riade/src/grass/grass-5.3_exp_13052004/src/include -g -O2
-c ask_bands.c -o OBJ.i686-pc-linux-gnu/ask_bands.o
ask_bands.c: In function `I_bandname':
ask_bands.c:14: error: `NAME_LEN' undeclared (first use in this function)
ask_bands.c:14: error: (Each undeclared identifier is reported only once
ask_bands.c:14: error: for each function it appears in.)
ask_bands.c:14: error: storage size of `name' isn't known
make: *** [OBJ.i686-pc-linux-gnu/ask_bands.o] Error 1

It is used only in Imagery Lib as shown:

imagery/i.tape.tm.fast/cmd/tape.h:#define MAX_NAME_LENGTH 11
imagery/i.tape.tm.fast/cmd/tape.h: char name[MAX_NAME_LENGTH];
imagery/i.tape.tm.fast/cmd/tape.h: char grp_name[MAX_NAME_LENGTH];
imagery/i.tape.tm3/fileseq.c: fileseq->name = malloc(FILENAME_LEN);
imagery/i.tape.tm3/fileseq.c: fgets(fileseq->name, FILENAME_LEN, stdin);
imagery/i.tape.tm3/fileseq.h:#define FILENAME_LEN 100
include/vect/dig_head.h:#define DIG_YOUR_NAME_LEN 20
include/vect/dig_head.h:#define DIG_MAP_NAME_LEN 41
libes/dbmi/drivers/odbc/listtab.c: SQLCHAR
tableName[SQL_MAX_TABLE_NAME_LEN];
libes/imagery/ask_bands.c: static char name[NAME_LEN];
libes/imagery/group.c: char name[NAME_LEN], mapset[NAME_LEN];
libes/imagery/nfiles.c: char name[NAME_LEN], mapset[NAME_LEN];
libes/imagery/vask_group.c: char tgroup[NAME_LEN], tsubgroup[NAME_LEN];
libes/imagery/vask_group.c: V_ques (group, 's', line++, 10, NAME_LEN);
libes/imagery/vask_group.c: V_const (group, 's', line++, 10, NAME_LEN);
libes/imagery/vask_group.c: V_ques (subgroup, 's', line++, 10,
NAME_LEN);
libes/vect32/Vlib/init_head.c:#define DIG_YOUR_NAME_LEN 20
libes/vect32/Vlib/init_head.c:#define DIG_MAP_NAME_LEN 41
libes/vect32/Vlib/init_head.c: strncpy (to->your_name, from->your_name,
DIG_YOUR_NAME_LEN);
libes/vect32/Vlib/init_head.c: strncpy (to->map_name, from->map_name,
DIG_MAP_NAME_LEN);
libes/vect32/Vlib/x_rw_binary.c:
dhead->your_name[DIG_YOUR_NAME_LEN-1] = 0;
libes/vect32/Vlib/x_rw_binary.c: dhead->map_name[DIG_MAP_NAME_LEN-1]
= 0;
libes/vect32_64/Vlib/init_head.c:#define DIG_YOUR_NAME_LEN 20
libes/vect32_64/Vlib/init_head.c:#define DIG_MAP_NAME_LEN 41
libes/vect32_64/Vlib/init_head.c: strncpy (to->your_name,
from->your_name, DIG_YOUR_NAME_LEN);
libes/vect32_64/Vlib/init_head.c: strncpy (to->map_name, from->map_name,
DIG_MAP_NAME_LEN);
libes/vect32_64/Vlib/x_rw_binary.c:
dhead->your_name[DIG_YOUR_NAME_LEN-1] = 0;
libes/vect32_64/Vlib/x_rw_binary.c: dhead->map_name[DIG_MAP_NAME_LEN-1]
= 0;
mapdev/v.transform/main.c: /* truncate if string >
DIG_MAP_NAME_LEN-1 */
mapdev/v.transform/main.c: buf[DIG_MAP_NAME_LEN-1] = '\0';
raster/r.contour/main.c: strncpy (Head.map_name, mapname,
DIG_MAP_NAME_LEN); /* uses GISLIB strncpy() */
raster/r.contour/main.c: mapname[DIG_MAP_NAME_LEN - 1] = '\0'; /* ensure
that mapname is properly terminated */

Where is the problem? some missed in imagery.h?

BeSoS Luis

--
Markus Neteler <neteler itc it> http://mpa.itc.it
ITC-irst - Centro per la Ricerca Scientifica e Tecnologica
MPBA - Predictive Models for Biol. & Environ. Data Analysis
Via Sommarive, 18 - 38050 Povo (Trento), Italy