diff --git a/cde/include/Dt/SearchP.h b/cde/include/Dt/SearchP.h index 749c1c710..e4a1b090d 100644 --- a/cde/include/Dt/SearchP.h +++ b/cde/include/Dt/SearchP.h @@ -517,27 +517,23 @@ struct or_hwordrec { * Actual host_to_network functions defined in * which is not yet standardized. */ + +/* JET - Update 12/21/2021 - no need to define (or not) BYTE_SWAP + * anymore as we can determine that via autotools (for the code). + * Elsewhere, we can just use the systems hto*()/nto*() routines + * regardless. + */ + typedef enum {HTON=1, NTOH} SWABDIR; extern void swab_dbrec (struct or_dbrec *rec, SWABDIR direction); extern void swab_objrec (struct or_objrec *rec, SWABDIR direction); -#ifdef BYTE_SWAP /* 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 */ - /*--------------- TESKEY PARSE CHARACTER TYPES ------------ * Used in langmap.c for linguistic parsing modules. diff --git a/cde/lib/DtSearch/Makefile.am b/cde/lib/DtSearch/Makefile.am index 2ba01ebfc..cf4420072 100644 --- a/cde/lib/DtSearch/Makefile.am +++ b/cde/lib/DtSearch/Makefile.am @@ -9,34 +9,16 @@ CLEANFILES = boolyac.h boolyac.c AM_YFLAGS = -d libDtSearch_la_CFLAGS = -DI18N_MSG -DMULTIBYTE -I./raima \ - @DT_INCDIR@ + $(DT_INCDIR) libDtSearch_la_LDFLAGS = -version-info 3:0:1 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 \ diff --git a/cde/lib/DtSearch/dtsrswab.c b/cde/lib/DtSearch/dtsrswab.c index c9083285c..3cd6f37dd 100644 --- a/cde/lib/DtSearch/dtsrswab.c +++ b/cde/lib/DtSearch/dtsrswab.c @@ -52,7 +52,8 @@ * * $Log$ */ -#include "SearchP.h" +#include +#include
/********************************/ /* */ @@ -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 **********************************/ diff --git a/cde/lib/DtSearch/raima/dbswab.c b/cde/lib/DtSearch/raima/dbswab.c index a059ba9e8..5327ae4ca 100644 --- a/cde/lib/DtSearch/raima/dbswab.c +++ b/cde/lib/DtSearch/raima/dbswab.c @@ -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 */ diff --git a/cde/lib/DtSearch/raima/dbswab.h b/cde/lib/DtSearch/raima/dbswab.h index 2e53d52e7..889485241 100644 --- a/cde/lib/DtSearch/raima/dbswab.h +++ b/cde/lib/DtSearch/raima/dbswab.h @@ -68,7 +68,6 @@ #include #include -#include /* 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); diff --git a/cde/programs/dtsr/Makefile.am b/cde/programs/dtsr/Makefile.am index 657f7387e..d69064725 100644 --- a/cde/programs/dtsr/Makefile.am +++ b/cde/programs/dtsr/Makefile.am @@ -13,18 +13,6 @@ MsgCat.c: ${top_srcdir}/lib/DtSvc/DtUtil2/MsgCat.c $(RM) MsgCat.c && ln -s ${top_srcdir}/lib/DtSvc/DtUtil2/MsgCat.c MsgCat.c -if I386 -AM_CFLAGS += -DBYTE_SWAP -endif - -if X86_64 -AM_CFLAGS += -DBYTE_SWAP -endif - -if ARM -AM_CFLAGS += -DBYTE_SWAP -endif - LDADD = ../../lib/DtSearch/libDtSearch.la dtsrcreate_SOURCES = dtsrcreate.c MsgCat.c diff --git a/cde/programs/dtsr/dtsrclean.c b/cde/programs/dtsr/dtsrclean.c index 392b30de4..b0234765c 100644 --- a/cde/programs/dtsr/dtsrclean.c +++ b/cde/programs/dtsr/dtsrclean.c @@ -737,10 +737,9 @@ static void copy_new_d99 (long keyfield) * dbrec offset. */ if (validation_mode) { -#ifdef BYTE_SWAP for (swapx = 0; swapx < num_reads; swapx++) NTOHL (word_addrs[swapx]); -#endif + /* set x to number of good addrs in this block */ if (good_addrs_left > num_reads) { x = num_reads; @@ -868,10 +867,9 @@ static void copy_new_d99 (long keyfield) * dba loop for this word. */ if (good_addrs_this_block > 0) { -#ifdef BYTE_SWAP for (swapx = 0; swapx < good_addrs_this_block; swapx++) NTOHL (word_addrs_out[swapx]); -#endif + num_writes = fwrite (word_addrs_out, sizeof (DB_ADDR), (size_t)good_addrs_this_block, fp_d99_new); if (num_writes != good_addrs_this_block) diff --git a/cde/programs/dtsr/dtsrindex.c b/cde/programs/dtsr/dtsrindex.c index 79e85d200..b35361310 100644 --- a/cde/programs/dtsr/dtsrindex.c +++ b/cde/programs/dtsr/dtsrindex.c @@ -111,7 +111,8 @@ * 2.1.5b cborodin bug. Segfault due to overflowing bitvector * after many deletions and no mrclean. */ -#include "SearchP.h" +#include +#include
#include #include #include @@ -801,13 +802,11 @@ static void put_addrs_2_dtbs_addr_file ( **** num addrs in database by 1 (!?) ******/ /* (...only if prev 'overlay/compression' didn't delete all) */ -#ifdef BYTE_SWAP - /* Put both arrays in 'network' byte order */ - for (int32 = 0; int32 < nitems; int32++) - HTONL (addrs_array[int32]); - for (int32 = 0; int32 < num_addrs; int32++) - HTONL (word_addrs_ii[int32]); -#endif + /* Put both arrays in 'network' byte order */ + for (int32 = 0; int32 < nitems; int32++) + HTONL (addrs_array[int32]); + for (int32 = 0; int32 < num_addrs; int32++) + HTONL (word_addrs_ii[int32]); /* * If number of new addresses greater than number of free holes, @@ -966,11 +965,10 @@ void write_2_dtbs_addr_file (void) (long)got_word.or_hwoffset, (long)num_reads); DtSearchExit (98); } -#ifdef BYTE_SWAP + for (i = 0; i < num_addrs_ii; i++) NTOHL (word_addrs_ii[i]); /* Now both addr arrays are in 'host' byte swap order */ -#endif /* If there are only new docs, * this switch will prevent the checking for updates. @@ -1116,11 +1114,11 @@ void write_new_word_2_dtbs (void) (long)record_addr_word[int32] & 0xffL); } } -#ifdef BYTE_SWAP - /* Put addr array in 'network' byte order */ - for (int32 = 0; int32 < num_addrs_for_word; int32++) - HTONL (record_addr_word[int32]); -#endif + + /* Put addr array in 'network' byte order */ + for (int32 = 0; int32 < num_addrs_for_word; int32++) + HTONL (record_addr_word[int32]); + num_writes = fwrite (record_addr_word, sizeof(DB_ADDR), (size_t)num_addrs_for_word, dtbs_addr_fp); if (num_writes != num_addrs_for_word)