From e31eefb8d90c24b1437bd1eca1d2bf6ac8cc7503 Mon Sep 17 00:00:00 2001 From: Adriano dos Santos Fernandes Date: Thu, 4 May 2017 23:08:45 -0300 Subject: [PATCH] Misc. --- src/include/types_pub.h | 1 + src/jrd/SysFunction.cpp | 11 ++++++++--- src/jrd/cvt.cpp | 4 ++-- src/jrd/fun.epp | 6 +++--- src/jrd/mov.cpp | 14 ++------------ src/jrd/sort.cpp | 20 ++++++++++++-------- src/jrd/sort.h | 2 ++ 7 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/include/types_pub.h b/src/include/types_pub.h index 95ec75ad85..a3adda32e6 100644 --- a/src/include/types_pub.h +++ b/src/include/types_pub.h @@ -173,6 +173,7 @@ typedef int (*FB_SHUTDOWN_CALLBACK)(const int reason, const int mask, void* arg) struct FB_DEC16_t { ISC_UINT64 fb_data[1]; }; + struct FB_DEC34_t { ISC_UINT64 fb_data[2]; }; diff --git a/src/jrd/SysFunction.cpp b/src/jrd/SysFunction.cpp index f8509674fa..9797d97f3b 100644 --- a/src/jrd/SysFunction.cpp +++ b/src/jrd/SysFunction.cpp @@ -316,6 +316,7 @@ template bool areParamsDouble(int argsCount, DSC** args) { bool decSeen = false; + for (int i = 0; i < argsCount; ++i) { if (args[i]->isApprox()) @@ -323,6 +324,7 @@ bool areParamsDouble(int argsCount, DSC** args) if (args[i]->isDecFloat()) decSeen = true; } + return !decSeen; } @@ -2885,7 +2887,8 @@ dsc* evlQuantize(thread_db* tdbb, const SysFunction* function, const NestValueAr impure->vlu_misc.vlu_dec64 = v1.quantize(decSt, v2); impure->vlu_desc.makeDecimal64(&impure->vlu_misc.vlu_dec64); } - else { + else + { Decimal128 v1 = MOV_get_dec128(tdbb, value[0]); Decimal128 v2 = MOV_get_dec128(tdbb, value[1]); @@ -2930,7 +2933,8 @@ dsc* evlCompare(thread_db* tdbb, const SysFunction* function, const NestValueArr fb_assert(false); } } - else { + else + { Decimal128 v1 = MOV_get_dec128(tdbb, value[0]); Decimal128 v2 = MOV_get_dec128(tdbb, value[1]); @@ -2973,7 +2977,8 @@ dsc* evlNormDec(thread_db* tdbb, const SysFunction* function, const NestValueArr impure->vlu_misc.vlu_dec64 = v.normalize(decSt); impure->vlu_desc.makeDecimal64(&impure->vlu_misc.vlu_dec64); } - else { + else + { Decimal128 v = MOV_get_dec128(tdbb, value); impure->vlu_misc.vlu_dec128 = v.normalize(decSt); diff --git a/src/jrd/cvt.cpp b/src/jrd/cvt.cpp index 5fc470f5c2..aa9ad6374b 100644 --- a/src/jrd/cvt.cpp +++ b/src/jrd/cvt.cpp @@ -265,7 +265,7 @@ UCHAR CVT_get_numeric(const UCHAR* string, const USHORT length, SSHORT* scale, v ((value < 0) && (sign != -1)))) // MAX_SINT64+1 wrapped around { // convert to double - *(double *) ptr = CVT_get_double(&desc, 0, ERR_post, &over); + *(double*) ptr = CVT_get_double(&desc, 0, ERR_post, &over); if (!over) return dtype_double; } @@ -273,7 +273,7 @@ UCHAR CVT_get_numeric(const UCHAR* string, const USHORT length, SSHORT* scale, v if (over) { thread_db* tdbb = JRD_get_thread_data(); - *(Decimal128 *) ptr = CVT_get_dec128(&desc, tdbb->getAttachment()->att_dec_status, ERR_post); + *(Decimal128*) ptr = CVT_get_dec128(&desc, tdbb->getAttachment()->att_dec_status, ERR_post); return dtype_dec128; } diff --git a/src/jrd/fun.epp b/src/jrd/fun.epp index 6ff9c3d768..13521232ec 100644 --- a/src/jrd/fun.epp +++ b/src/jrd/fun.epp @@ -772,7 +772,7 @@ void FUN_evaluate(thread_db* tdbb, const Function* function, const NestValueArra } else { - switch(value->vlu_desc.dsc_dtype) + switch (value->vlu_desc.dsc_dtype) { case dtype_double: if (isinf(value->vlu_misc.vlu_double)) @@ -819,13 +819,13 @@ void FUN_evaluate(thread_db* tdbb, const Function* function, const NestValueArra } break; } + request->req_flags &= ~req_null; } while (array_stack.hasData()) - { delete[] array_stack.pop(); - } + blob_stack.close(); } // try diff --git a/src/jrd/mov.cpp b/src/jrd/mov.cpp index ce3874659c..1b9d85803c 100644 --- a/src/jrd/mov.cpp +++ b/src/jrd/mov.cpp @@ -420,12 +420,7 @@ Decimal64 MOV_get_dec64(Jrd::thread_db* tdbb, const dsc* desc) { /************************************** * - * M O V _ g e t _ d o u b l e - * - ************************************** - * - * Functional description - * Convert something arbitrary to a double precision number + * M O V _ g e t _ d e c 6 4 * **************************************/ @@ -437,12 +432,7 @@ Decimal128 MOV_get_dec128(Jrd::thread_db* tdbb, const dsc* desc) { /************************************** * - * M O V _ g e t _ d o u b l e - * - ************************************** - * - * Functional description - * Convert something arbitrary to a double precision number + * M O V _ g e t _ d e c 1 2 8 * **************************************/ diff --git a/src/jrd/sort.cpp b/src/jrd/sort.cpp index 7f370cd604..8a5e03cfa2 100644 --- a/src/jrd/sort.cpp +++ b/src/jrd/sort.cpp @@ -809,7 +809,7 @@ void Sort::diddleKey(UCHAR* record, bool direction) case SKD_dec64: if (direction) { - ((Decimal64*)p)->makeKey(lwp); + ((Decimal64*) p)->makeKey(lwp); *p ^= 1 << 7; } else @@ -821,8 +821,9 @@ void Sort::diddleKey(UCHAR* record, bool direction) *pp++ ^= -1; } while (--n); } + *p ^= 1 << 7; - ((Decimal64*)p)->grabKey(lwp); + ((Decimal64*) p)->grabKey(lwp); } break; @@ -830,7 +831,7 @@ void Sort::diddleKey(UCHAR* record, bool direction) fb_assert(false); // diddleKey for Dec64/128 not tested on bigendians! if (direction) { - ((Decimal128*)p)->makeKey(lwp); + ((Decimal128*) p)->makeKey(lwp); *p ^= 1 << 7; } else @@ -842,8 +843,9 @@ void Sort::diddleKey(UCHAR* record, bool direction) *pp++ ^= -1; } while (--n); } + *p ^= 1 << 7; - ((Decimal128*)p)->grabKey(lwp); + ((Decimal128*) p)->grabKey(lwp); } break; @@ -1083,7 +1085,7 @@ void Sort::diddleKey(UCHAR* record, bool direction) case SKD_dec64: if (direction) { - ((Decimal64*)p)->makeKey(lwp); + ((Decimal64*) p)->makeKey(lwp); p[3] ^= 1 << 7; } else @@ -1095,15 +1097,16 @@ void Sort::diddleKey(UCHAR* record, bool direction) *pp++ ^= -1; } while (--n); } + p[3] ^= 1 << 7; - ((Decimal64*)p)->grabKey(lwp); + ((Decimal64*) p)->grabKey(lwp); } break; case SKD_dec128: if (direction) { - ((Decimal128*)p)->makeKey(lwp); + ((Decimal128*) p)->makeKey(lwp); p[3] ^= 1 << 7; } else @@ -1115,8 +1118,9 @@ void Sort::diddleKey(UCHAR* record, bool direction) *pp++ ^= -1; } while (--n); } + p[3] ^= 1 << 7; - ((Decimal128*)p)->grabKey(lwp); + ((Decimal128*) p)->grabKey(lwp); } break; diff --git a/src/jrd/sort.h b/src/jrd/sort.h index 20baaf5a0a..e6e95ac151 100644 --- a/src/jrd/sort.h +++ b/src/jrd/sort.h @@ -164,6 +164,7 @@ public: ULONG skd_vary_offset; // Offset to varying/cstring length USHORT getSkdLength() const { return skd_length; } + void setSkdLength(UCHAR dtype, USHORT v) { skd_dtype = dtype; @@ -178,6 +179,7 @@ public: } ULONG getSkdOffset() const { return skd_offset; } + void setSkdOffset(const sort_key_def* prev = nullptr, dsc* desc = nullptr) { skd_offset = 0;