@@ -50,15 +50,15 @@ using namespace Jrd;
5050
5151namespace
5252{
53- const unsigned MIN_COMPRESS_RUN = 8 ; // minimal length of compressable run
53+ constexpr unsigned MIN_COMPRESS_RUN = 8 ; // minimal length of compressable run
5454
55- const int MAX_NONCOMP_RUN = MAX_SCHAR; // 127
55+ constexpr int MAX_NONCOMP_RUN = MAX_SCHAR; // 127
5656
57- const int MAX_SHORT_RUN = -MIN_SCHAR; // 128
58- const int MAX_MEDIUM_RUN = MAX_USHORT; // 2^16
59- const int MAX_LONG_RUN = MAX_SLONG; // 2^31
57+ constexpr int MAX_SHORT_RUN = -MIN_SCHAR; // 128
58+ constexpr int MAX_MEDIUM_RUN = MAX_USHORT; // 2^16
59+ constexpr int MAX_LONG_RUN = MAX_SLONG; // 2^31
6060
61- inline int adjustRunLength (unsigned length)
61+ inline int adjustRunLength (unsigned length) noexcept
6262 {
6363 return (length <= MAX_SHORT_RUN) ? 0 :
6464 (length <= MAX_MEDIUM_RUN) ? sizeof (USHORT) : sizeof (ULONG);
@@ -469,7 +469,7 @@ UCHAR* Compressor::unpack(ULONG inLength, const UCHAR* input,
469469 *
470470 **************************************/
471471 const auto end = input + inLength;
472- const auto output_end = output + outLength;
472+ const auto * const output_end = output + outLength;
473473
474474 while (input < end)
475475 {
@@ -526,9 +526,9 @@ ULONG Difference::apply(ULONG diffLength, ULONG outLength, UCHAR* const output)
526526 BUGCHECK (176 ); // msg 176 bad difference record
527527
528528 auto differences = m_differences;
529- const auto end = differences + diffLength;
529+ const auto * const end = differences + diffLength;
530530 auto p = output;
531- const auto p_end = output + outLength;
531+ const auto * const p_end = output + outLength;
532532
533533 while (differences < end && p < p_end)
534534 {
@@ -566,15 +566,15 @@ ULONG Difference::apply(ULONG diffLength, ULONG outLength, UCHAR* const output)
566566 return length;
567567}
568568
569- ULONG Difference::makeNoDiff (ULONG length)
569+ ULONG Difference::makeNoDiff (ULONG length) noexcept
570570{
571571/* *************************************
572572 *
573573 * Generates differences record marking that there are no differences.
574574 *
575575 **************************************/
576576 auto output = m_differences;
577- const auto end = output + MAX_DIFFERENCES;
577+ const auto * const end = output + MAX_DIFFERENCES;
578578
579579 while (length)
580580 {
@@ -593,7 +593,7 @@ ULONG Difference::makeNoDiff(ULONG length)
593593}
594594
595595ULONG Difference::make (ULONG length1, const UCHAR* rec1,
596- ULONG length2, const UCHAR* rec2)
596+ ULONG length2, const UCHAR* rec2) noexcept
597597{
598598/* *************************************
599599 *
@@ -611,7 +611,7 @@ ULONG Difference::make(ULONG length1, const UCHAR* rec1,
611611 *
612612 **************************************/
613613 auto output = m_differences;
614- const auto end = output + MAX_DIFFERENCES;
614+ const auto * const end = output + MAX_DIFFERENCES;
615615 const auto end1 = rec1 + MIN (length1, length2);
616616 const auto end2 = rec2 + length2;
617617
@@ -621,7 +621,7 @@ ULONG Difference::make(ULONG length1, const UCHAR* rec1,
621621 {
622622 auto p = output++;
623623
624- const auto yellow = (UCHAR*) MIN ((U_IPTR) end1, ((U_IPTR) rec1 + 127 )) - 1 ;
624+ const auto * const yellow = (UCHAR*) MIN ((U_IPTR) end1, ((U_IPTR) rec1 + 127 )) - 1 ;
625625 while (rec1 <= yellow && (rec1[0 ] != rec2[0 ] || (rec1 < yellow && rec1[1 ] != rec2[1 ])))
626626 {
627627 if (output >= end)
@@ -654,7 +654,7 @@ ULONG Difference::make(ULONG length1, const UCHAR* rec1,
654654 {
655655 auto p = output++;
656656
657- const auto yellow = (UCHAR*) MIN ((U_IPTR) end2, ((U_IPTR) rec2 + 127 ));
657+ const auto * const yellow = (UCHAR*) MIN ((U_IPTR) end2, ((U_IPTR) rec2 + 127 ));
658658 while (rec2 < yellow)
659659 {
660660 if (output >= end)
0 commit comments