965 unsigned char *pabyRec;
966 void *pReturnField = NULL;
971 if( hEntity < 0 || hEntity >= psDBF->nRecords )
974 if( iField < 0 || iField >= psDBF->nFields )
983 pabyRec = (
unsigned char *) psDBF->pszCurrentRecord;
988 if( psDBF->panFieldSize[iField] >= psDBF->nWorkFieldLength )
990 psDBF->nWorkFieldLength = psDBF->panFieldSize[iField] + 100;
991 if( psDBF->pszWorkField == NULL )
992 psDBF->pszWorkField = (
char *)
malloc(psDBF->nWorkFieldLength);
994 psDBF->pszWorkField = (
char *) realloc(psDBF->pszWorkField,
995 psDBF->nWorkFieldLength);
1001 strncpy( psDBF->pszWorkField,
1002 ((
const char *) pabyRec) + psDBF->panFieldOffset[iField],
1003 psDBF->panFieldSize[iField] );
1004 psDBF->pszWorkField[psDBF->panFieldSize[iField]] =
'\0';
1006 pReturnField = psDBF->pszWorkField;
1011 if( chReqType ==
'N' )
1013 psDBF->dfDoubleField = psDBF->sHooks.Atof(psDBF->pszWorkField);
1015 pReturnField = &(psDBF->dfDoubleField);
1021 #ifdef TRIM_DBF_WHITESPACE 1024 char *pchSrc, *pchDst;
1026 pchDst = pchSrc = psDBF->pszWorkField;
1027 while( *pchSrc ==
' ' )
1030 while( *pchSrc !=
'\0' )
1031 *(pchDst++) = *(pchSrc++);
1034 while( pchDst != psDBF->pszWorkField && *(--pchDst) ==
' ' )
1039 return( pReturnField );
static int DBFLoadRecord(DBFHandle psDBF, int iRecord)