dtsr, DtSearch: finish removing need for BYTE_SWAP define

This commit is contained in:
Jon Trulson
2021-12-21 15:45:35 -07:00
parent 3a0c2ae879
commit 931bcaa494
8 changed files with 34 additions and 83 deletions

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);