diff --git a/src/jrd/sort.cpp b/src/jrd/sort.cpp index e97e11c553..ad5b65bb11 100644 --- a/src/jrd/sort.cpp +++ b/src/jrd/sort.cpp @@ -95,7 +95,7 @@ const ULONG MAX_TEMPFILE_SIZE = 1073741824; // 1GB // the size of sr_bckptr in # of 32 bit longwords #define SIZEOF_SR_BCKPTR_IN_LONGS (SIZEOF_SR_BCKPTR / sizeof(SLONG)) // offset in array of pointers to back record pointer (sr_bckptr) -#define BACK_OFFSET (-(ALIGNMENT / sizeof(SLONG*))) +#define BACK_OFFSET (-(SIZEOF_SR_BCKPTR / sizeof(SLONG*))) #define DIFF_LONGS(a, b) ((a) - (b)) #define SWAP_LONGS(a, b, t) {t = a; a = b; b = t;} @@ -732,7 +732,7 @@ sort_context* SORT_init(ISC_STATUS* status_vector, scb->scb_status_vector = status_vector; //scb->scb_length = record_length; scb->scb_longs = - ROUNDUP(record_length + ALIGNMENT, ALIGNMENT) >> SHIFTLONG; + ROUNDUP(record_length + SIZEOF_SR_BCKPTR, ALIGNMENT) >> SHIFTLONG; scb->scb_dup_callback = call_back; scb->scb_dup_callback_arg = user_arg; scb->scb_keys = keys; diff --git a/src/jrd/sort.h b/src/jrd/sort.h index e745f34868..c2a76ad811 100644 --- a/src/jrd/sort.h +++ b/src/jrd/sort.h @@ -73,10 +73,7 @@ typedef IPTR sort_ptr_t; struct sort_record { - union { - ULONG sort_record_key[1]; - UINT64 dummy_alignment_force; - }; + ULONG sort_record_key[1]; /* Sorting key. Mangled by diddle_key to compare using ULONG word compares (size is rounded upwards if necessary). @@ -111,7 +108,10 @@ const ULONG MAX_SORT_RECORD = 65535; /* bytes */ typedef struct sr { sort_record** sr_bckptr; /* Pointer back to sort list entry */ - sort_record sr_sort_record; + union { + sort_record sr_sort_record; + UINT64 dummy_alignment_force; + }; } SR; /* scb_longs includes the size of sr_bckptr. */