Merge branch 'master' into dtdocbook

This commit is contained in:
Liang Chang
2022-01-30 08:04:32 +08:00
285 changed files with 778 additions and 838 deletions

View File

@@ -9,34 +9,22 @@ CLEANFILES = boolyac.h boolyac.c
AM_YFLAGS = -d
libDtSearch_la_CFLAGS = -DI18N_MSG -DMULTIBYTE -I./raima \
@DT_INCDIR@
$(DT_INCDIR)
# in order to try to keep lib versions the same across platforms, (2.1.0)
if BSD
libDtSearch_la_LDFLAGS = -version-info 2:1:0
else
libDtSearch_la_LDFLAGS = -version-info 3:0:1
endif
libDtSearch_la_LIBADD = raima/libraima.la
if LINUX
libDtSearch_la_CFLAGS += -DBYTE_SWAP
libDtSearch_la_LIBADD += -lm
endif
if BSD
libDtSearch_la_CFLAGS += -DBYTE_SWAP
endif
if SOLARIS
libDtSearch_la_CFLAGS += -DBYTE_SWAP
libDtSearch_la_LIBADD += -lm -lc
endif
if AIX
libDtSearch_la_LIBADD += -lisode
endif
if HPUX
libDtSearch_la_LIBADD += -lm
endif
libDtSearch_la_SOURCES = apndext.c ausdopen.c ausexit.c \
bmstrstr.c boolpars.c boolsrch.c \
boolyac.y cuslang.c dbchange.c \

View File

@@ -52,7 +52,8 @@
*
* $Log$
*/
#include "SearchP.h"
#include <cde_config.h>
#include <Dt/SearchP.h>
/********************************/
/* */
@@ -61,7 +62,7 @@
/********************************/
void swab_objrec (struct or_objrec *rec, SWABDIR direction)
{
#ifndef BYTE_SWAP
#if defined(WORDS_BIGENDIAN)
return;
#else
if (direction == NTOH) {
@@ -91,7 +92,7 @@ void swab_objrec (struct or_objrec *rec, SWABDIR direction)
HTONS (rec->or_objeureka);
}
return;
#endif /* BYTE_SWAP */
#endif /* WORDS_BIGENDIAN */
} /* swab_objrec() */
@@ -102,7 +103,7 @@ void swab_objrec (struct or_objrec *rec, SWABDIR direction)
/********************************/
void swab_dbrec (struct or_dbrec *rec, SWABDIR direction)
{
#ifndef BYTE_SWAP
#if defined(WORDS_BIGENDIAN)
return;
#else
if (direction == NTOH) {
@@ -147,7 +148,7 @@ void swab_dbrec (struct or_dbrec *rec, SWABDIR direction)
HTONS (rec->or_language);
}
return;
#endif /* BYTE_SWAP */
#endif /* WORDS_BIGENDIAN */
} /* swab_dbrec() */
/********************* DTSRSWAB.C **********************************/

View File

@@ -94,7 +94,7 @@ long hilite_cleartext (int parse_type, char *stems, int stemcount)
PARG parg;
char * (*parser)() = usrblk.dblk->parser;
char * (*stemmer)() = usrblk.dblk->stemmer;
DtSrHitword *hitwords;
DtSrHitword *hitwords = NULL;
size_t hitwords_size = 0;
long hitwcount = 0;
long offset;
@@ -158,10 +158,10 @@ long hilite_cleartext (int parse_type, char *stems, int stemcount)
hitwords = realloc (hitwords,
hitwords_size * sizeof(DtSrHitword) + 16);
}
if (!hitwords) {
fputs (PROGNAME"091 Out of Memory!\n", aa_stderr);
DtSearchExit (91);
}
}
if (!hitwords) {
fputs (PROGNAME"091 Out of Memory!\n", aa_stderr);
DtSearchExit (91);
}
hitwords[hitwcount].offset = offset;
hitwords[hitwcount].length = wordlen;

View File

@@ -2,10 +2,8 @@ MAINTAINERCLEANFILES = Makefile.in
noinst_LTLIBRARIES = libraima.la
libraima_la_LIBADD = -lc -lm
libraima_la_CFLAGS = -DCDE_INSTALLATION_TOP=\"$(CDE_INSTALLATION_TOP)\" \
@DT_INCDIR@ -I$(top_srcdir)/include \
$(DT_INCDIR) -I$(top_srcdir)/include \
-DCDE_CONFIGURATION_TOP=\"$(CDE_CONFIGURATION_TOP)\" \
-DNO_TRANS -DUNIX -D_POSIX_SOURCE -DMULTIBYTE
@@ -21,10 +19,6 @@ if SOLARIS
libraima_la_CFLAGS += -D_XOPEN_SOURCE=500 -DNO_REGCOMP
endif
if HPUX
libraima_la_CFLAGS += -DMESSAGE_CAT
endif
libraima_la_SOURCES = alloc.c cmtype.c connect.c \
cotype.c crget.c crread.c crset.c \

View File

@@ -84,8 +84,8 @@ int dbn /* Database number */
char *orec; /* ptr to current owner record contents in cache */
char *mrec; /* ptr to current member record contents in cache */
char *nrec; /* ptr to next member record contents in cache */
DB_ADDR mdba; /* db address of current member record */
DB_ADDR ndba; /* db address of next member record */
DB_ADDR mdba = NULL; /* db address of current member record */
DB_ADDR ndba = NULL; /* db address of next member record */
INT ordering; /* set order control variable */
int stat, compare; /* status code & sort comparison result */
SET_ENTRY *set_ptr;

View File

@@ -137,7 +137,7 @@ void swab_page (char *pgbuf, FILE_ENTRY *file_ptr, SWABDIR direction)
/* dba, or delete chain ptr */
memcpy (&align_LONG, slotptr + sizeof(INT), sizeof(LONG));
align_LONG = HTONL (align_LONG);
HTONL (align_LONG);
memcpy (slotptr + sizeof(INT), &align_LONG, sizeof(LONG));
/* If this is a deleted record, we're done */
@@ -151,7 +151,7 @@ void swab_page (char *pgbuf, FILE_ENTRY *file_ptr, SWABDIR direction)
curr_offset < data_offset;
curr_offset += sizeof(LONG)) {
memcpy (&align_LONG, slotptr + curr_offset, sizeof(LONG));
align_LONG = HTONL (align_LONG);
HTONL (align_LONG);
memcpy (slotptr + curr_offset, &align_LONG, sizeof(LONG));
}
} /* end loop on each slot */
@@ -183,7 +183,7 @@ void swab_page (char *pgbuf, FILE_ENTRY *file_ptr, SWABDIR direction)
/* 'orphan' ptr or 'delete chain' ptr */
memcpy (&align_LONG, pgbuf + 6, sizeof(LONG));
align_LONG = HTONL (align_LONG);
HTONL (align_LONG);
memcpy (pgbuf + 6, &align_LONG, sizeof(LONG));
#ifdef DEBUG_DBSWAB
@@ -234,7 +234,7 @@ void swab_page (char *pgbuf, FILE_ENTRY *file_ptr, SWABDIR direction)
cptr = slotptr + slsize - 8;
memcpy (&align_LONG, cptr, sizeof(LONG));
align_LONG = HTONL (align_LONG);
HTONL (align_LONG);
memcpy (cptr, &align_LONG, sizeof(LONG));
#ifdef DEBUG_DBSWAB
@@ -249,7 +249,7 @@ void swab_page (char *pgbuf, FILE_ENTRY *file_ptr, SWABDIR direction)
/* 'child ptr'. after dba, 4 bytes before end of slot. */
cptr += 4;
memcpy (&align_LONG, cptr, sizeof(LONG));
align_LONG = HTONL (align_LONG);
HTONL (align_LONG);
memcpy (cptr, &align_LONG, sizeof(LONG));
} /* end loop on each slot */

View File

@@ -68,7 +68,6 @@
#include <sys/types.h>
#include <netinet/in.h>
#include <autotools_config.h>
/* Record number for OR_MISCREC DtSearch record */
#define MISCREC_RECNO 3
@@ -81,22 +80,11 @@ typedef enum {HTON=1, NTOH} SWABDIR;
extern void swab_page (char *pgbuf, FILE_ENTRY *file_ptr, SWABDIR direction);
#if !defined(WORDS_BIGENDIAN) /* ie (BYTE_ORDER != BIG_ENDIAN) */
#define HTONL(x) x = htonl(x)
#define HTONS(x) x = htons(x)
#define NTOHL(x) x = ntohl(x)
#define NTOHS(x) x = ntohs(x)
#else /* !BYTE_SWAP, ie (BYTE_ORDER == BIG_ENDIAN) */
#define HTONL(x)
#define HTONS(x)
#define NTOHL(x)
#define NTOHS(x)
#endif /* BYTE_SWAP */
/******** debug stuff *******/
extern char *debug_keyslot_ptr;
extern void snap_dump (char *label, void *ptr, int len);

View File

@@ -811,10 +811,10 @@ LOOKUP_ENTRY * *xlu_ptr /* pointer to lookup table slot for found page*/
{
LOOKUP_ENTRY *lookup; /* = db_lookup or ix_lookup */
int pgtab_sz; /* = db_pgtab_sz or ix_pgtab_sz */
long cmp;
long cmp = 0;
int cnt;
int lu_slot, l, u;
LOOKUP_ENTRY *lu_ptr, *replu_ptr;
int lu_slot = 0, l, u;
LOOKUP_ENTRY *lu_ptr = NULL, *replu_ptr;
PAGE_ENTRY *pg_ptr;
int *lru_ptr;
int pg_slot;

View File

@@ -55,7 +55,7 @@
/*---------------------------------------------------------------------------
db_VISTA Key File/Field Manipulation Functions
----------------------------------------------
An implementation of the B-tree indexing method described in
An implementation of the B-tree indexing method described in
"Sorting and Searching: The Art of Computer Programming, Vol III",
Knuth, Donald E., Addison-Wesley, 1975. pp 473-480.
@@ -164,12 +164,12 @@ key_open(void)
}
if ( no_of_keys ) {
key_info =
/* Macro references must be on one line for some compilers */
/* Macro references must be on one line for some compilers */
(KEY_INFO *)
ALLOC(&db_global.Key_info, no_of_keys*sizeof(KEY_INFO), "key_info");
if ( ! key_info )
return( dberr(S_NOMEMORY) );
for (i = 0, fld_ptr = &field_table[old_size_fd];
for (i = 0, fld_ptr = &field_table[old_size_fd];
i < size_fd; ++i, ++fld_ptr) {
if ( fld_ptr->fd_key != NOKEY ) {
ki_ptr = &key_info[fld_ptr->fd_keyno];
@@ -180,7 +180,7 @@ key_open(void)
ki_ptr->dba = NULL_DBA;
file_ptr = &file_table[fld_ptr->fd_keyfile];
ki_ptr->keyval =
/* Macro references must be on one line for some compilers */
/* Macro references must be on one line for some compilers */
ALLOC(&ki_ptr->Keyval, file_ptr->ft_slsize, db_avname);
if ( ! ki_ptr->keyval )
return( dberr(S_NOMEMORY) );
@@ -258,7 +258,7 @@ int field /* field number to be processed */
/* Reset key_info last status to reposition keys on file "fno"
/* Reset key_info last status to reposition keys on file "fno"
*/
int
key_reset(FILE_NO fno)
@@ -267,7 +267,7 @@ key_reset(FILE_NO fno)
KEY_INFO *ki_ptr;
for (i = 0, ki_ptr = key_info; i < no_of_keys; ++i, ++ki_ptr) {
if (((fno == size_ft) || (ki_ptr->keyfile == fno)) &&
if (((fno == size_ft) || (ki_ptr->keyfile == fno)) &&
((ki_ptr->lstat == KEYFOUND) || (ki_ptr->lstat == KEYNOTFOUND)))
ki_ptr->lstat = KEYREPOS;
}
@@ -363,7 +363,7 @@ DB_ADDR *dba /* database address of located key */
/* return database address for d_keyfind */
if ( *dba == NULL_DBA )
bytecpy(dba, &curkey->dba, sizeof(DB_ADDR));
return( db_status );
}
@@ -380,8 +380,8 @@ int *slot_offset, /* slot position offset */
F_ADDR *child /* child ptr of located key */
)
{
int cmp, i, l, u, slot_pos;
char *node_slot_ptr;
int cmp = 0, i = 0, l, u, slot_pos = 0;
char *node_slot_ptr = NULL;
/* perform binary search on node */
l = 0;
@@ -432,7 +432,7 @@ KEY_SLOT *slot, /* pointer to key slot to be compared */
DB_ADDR *dba /* database address included in comparison if not null */
)
{
/*
/*
returns < 0 if key_val < slot
> 0 if key_val > slot
= 0 if key_val == slot
@@ -529,7 +529,7 @@ DB_ADDR *dba /* db address of scanned record */
node_slot_ptr = &node->slots[np_ptr->slot*slot_len];
}
bytecpy(&child, node_slot_ptr, sizeof(F_ADDR));
} while ( child != NULL_NODE );
} while ( child != NULL_NODE );
if (np_ptr->slot == node->used_slots) {
--np_ptr->slot;
@@ -686,9 +686,9 @@ DB_ADDR dba /* record's database address */
}
db_status = stat;
}
else if ( db_status == S_OKAY )
else if ( db_status == S_OKAY )
dberr(S_SYSERR);
return( db_status );
}
@@ -925,7 +925,7 @@ static int delete(void)
r_node_slot_ptr = &r_node->slots[sizeof(F_ADDR)];
bytecpy(node_slot_ptr, r_node_slot_ptr, slot_len - sizeof(F_ADDR));
dio_touch(pg);
/* set up to delete key from leaf */
/* (this is more efficient than a recursive call) */
slot_pos = 0;
@@ -1158,7 +1158,7 @@ d_keyread(char *key_val)
if ( cfld_ptr->fd_type == COMKEY ) {
/* copy compound key fields */
for (kt_lc = size_kt - cfld_ptr->fd_ptr,
key_ptr = &key_table[cfld_ptr->fd_ptr];
key_ptr = &key_table[cfld_ptr->fd_ptr];
(--kt_lc >= 0) && (key_ptr->kt_key == fldno); ++key_ptr) {
fld_ptr = &field_table[key_ptr->kt_field];
fptr = key_type.ks.data + key_ptr->kt_ptr;

View File

@@ -303,7 +303,7 @@ DB_ADDR *db_addr
char *fptr;
const char *tfptr;
int s, i, strfld;
FIELD_ENTRY *sfld_ptr;
FIELD_ENTRY *sfld_ptr = NULL;
SORT_ENTRY *srt_ptr;
DB_ADDR *co_ptr, *cm_ptr;
@@ -402,7 +402,7 @@ DB_ADDR *db_addr
}
}
}
if ( strfld >= 0 ) {
if ( strfld >= 0 && sfld_ptr) {
/* insert the new struct key */
if ( key_insert( strfld, rec + sfld_ptr->fd_ptr, dba ) != S_OKAY )
return( db_status );