@@ -50,15 +50,15 @@ using namespace Jrd;
50
50
51
51
namespace
52
52
{
53
- const unsigned MIN_COMPRESS_RUN = 8 ; // minimal length of compressable run
53
+ constexpr unsigned MIN_COMPRESS_RUN = 8 ; // minimal length of compressable run
54
54
55
- const int MAX_NONCOMP_RUN = MAX_SCHAR; // 127
55
+ constexpr int MAX_NONCOMP_RUN = MAX_SCHAR; // 127
56
56
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
60
60
61
- inline int adjustRunLength (unsigned length)
61
+ inline int adjustRunLength (unsigned length) noexcept
62
62
{
63
63
return (length <= MAX_SHORT_RUN) ? 0 :
64
64
(length <= MAX_MEDIUM_RUN) ? sizeof (USHORT) : sizeof (ULONG);
@@ -469,7 +469,7 @@ UCHAR* Compressor::unpack(ULONG inLength, const UCHAR* input,
469
469
*
470
470
**************************************/
471
471
const auto end = input + inLength;
472
- const auto output_end = output + outLength;
472
+ const auto * const output_end = output + outLength;
473
473
474
474
while (input < end)
475
475
{
@@ -526,9 +526,9 @@ ULONG Difference::apply(ULONG diffLength, ULONG outLength, UCHAR* const output)
526
526
BUGCHECK (176 ); // msg 176 bad difference record
527
527
528
528
auto differences = m_differences;
529
- const auto end = differences + diffLength;
529
+ const auto * const end = differences + diffLength;
530
530
auto p = output;
531
- const auto p_end = output + outLength;
531
+ const auto * const p_end = output + outLength;
532
532
533
533
while (differences < end && p < p_end)
534
534
{
@@ -566,15 +566,15 @@ ULONG Difference::apply(ULONG diffLength, ULONG outLength, UCHAR* const output)
566
566
return length;
567
567
}
568
568
569
- ULONG Difference::makeNoDiff (ULONG length)
569
+ ULONG Difference::makeNoDiff (ULONG length) noexcept
570
570
{
571
571
/* *************************************
572
572
*
573
573
* Generates differences record marking that there are no differences.
574
574
*
575
575
**************************************/
576
576
auto output = m_differences;
577
- const auto end = output + MAX_DIFFERENCES;
577
+ const auto * const end = output + MAX_DIFFERENCES;
578
578
579
579
while (length)
580
580
{
@@ -593,7 +593,7 @@ ULONG Difference::makeNoDiff(ULONG length)
593
593
}
594
594
595
595
ULONG Difference::make (ULONG length1, const UCHAR* rec1,
596
- ULONG length2, const UCHAR* rec2)
596
+ ULONG length2, const UCHAR* rec2) noexcept
597
597
{
598
598
/* *************************************
599
599
*
@@ -611,7 +611,7 @@ ULONG Difference::make(ULONG length1, const UCHAR* rec1,
611
611
*
612
612
**************************************/
613
613
auto output = m_differences;
614
- const auto end = output + MAX_DIFFERENCES;
614
+ const auto * const end = output + MAX_DIFFERENCES;
615
615
const auto end1 = rec1 + MIN (length1, length2);
616
616
const auto end2 = rec2 + length2;
617
617
@@ -621,7 +621,7 @@ ULONG Difference::make(ULONG length1, const UCHAR* rec1,
621
621
{
622
622
auto p = output++;
623
623
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 ;
625
625
while (rec1 <= yellow && (rec1[0 ] != rec2[0 ] || (rec1 < yellow && rec1[1 ] != rec2[1 ])))
626
626
{
627
627
if (output >= end)
@@ -654,7 +654,7 @@ ULONG Difference::make(ULONG length1, const UCHAR* rec1,
654
654
{
655
655
auto p = output++;
656
656
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 ));
658
658
while (rec2 < yellow)
659
659
{
660
660
if (output >= end)
0 commit comments