PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ goodDBFValue()

static char * goodDBFValue ( char *  in,
char  fieldType 
)
static

Make appropriate formatting of a DBF value based on type.

Might return untouched input or pointer to static private buffer: use return value right away.

Definition at line 653 of file pgsql2shp-core.c.

Referenced by ShpLoaderGenerateShapeRow().

654 {
655  /*
656  * We only work on FTLogical and FTDate.
657  * FTLogical is 1 byte, FTDate is 8 byte (YYYYMMDD)
658  * We allocate space for 9 bytes to take
659  * terminating null into account
660  */
661  static char buf[9];
662 
663  switch (fieldType)
664  {
665  case FTLogical:
666  buf[0] = toupper(in[0]);
667  buf[1]='\0';
668  return buf;
669  case FTDate:
670  buf[0]=in[0]; /* Y */
671  buf[1]=in[1]; /* Y */
672  buf[2]=in[2]; /* Y */
673  buf[3]=in[3]; /* Y */
674  buf[4]=in[5]; /* M */
675  buf[5]=in[6]; /* M */
676  buf[6]=in[8]; /* D */
677  buf[7]=in[9]; /* D */
678  buf[8]='\0';
679  return buf;
680  default:
681  return in;
682  }
683 }
Here is the caller graph for this function: