Skip to content

Commit 3a03a8a

Browse files
authored
Fix MSVC C4146 warnings (#8366)
* Fix MSVC C4146 warnings The warning description: "unary minus operator applied to unsigned type, result still unsigned". * Fix another bunch of C4146 warnings
1 parent 1985b88 commit 3a03a8a

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/burp/backup.epp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ void compress(const UCHAR* data, ULONG length)
547547
{
548548
for (q = p + 2; q < end && (q[-2] != q[-1] || q[-1] != q[0]); q++)
549549
;
550-
ULONG run = (q < end) ? q - p - 2 : end - p;
550+
SLONG run = (q < end) ? q - p - 2 : end - p;
551551
if (run)
552552
{
553553
for (; run > 127; run -= 127)

src/dsql/WinNodes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ void FirstValueWinNode::aggInit(thread_db* tdbb, Request* request) const
432432

433433
dsc* FirstValueWinNode::winPass(thread_db* tdbb, Request* request, SlidingWindow* window) const
434434
{
435-
if (!window->moveWithinFrame(-(window->getRecordPosition() - window->getFrameStart())))
435+
if (!window->moveWithinFrame(-static_cast<SINT64>(window->getRecordPosition() - window->getFrameStart())))
436436
return NULL;
437437

438438
dsc* desc = EVL_expr(tdbb, request, arg);
@@ -583,7 +583,7 @@ dsc* NthValueWinNode::winPass(thread_db* tdbb, Request* request, SlidingWindow*
583583
const SLONG fromPos = desc ? MOV_get_long(tdbb, desc, 0) : FROM_FIRST;
584584

585585
if (fromPos == FROM_FIRST)
586-
records += -(window->getRecordPosition() - window->getFrameStart()) - 1;
586+
records += -static_cast<SINT64>(window->getRecordPosition() - window->getFrameStart()) - 1;
587587
else
588588
records = window->getFrameEnd() - window->getRecordPosition() - records + 1;
589589

src/jrd/sqz.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ ULONG Difference::makeNoDiff(ULONG length)
581581
if (output >= end)
582582
return 0;
583583

584-
const auto max = MIN(length, 127);
584+
const int max = MIN(length, 127);
585585
*output++ = -max;
586586
length -= max;
587587
}
@@ -644,7 +644,7 @@ ULONG Difference::make(ULONG length1, const UCHAR* rec1,
644644
if (output >= end)
645645
return 0;
646646

647-
const auto max = MIN(count, 127);
647+
const int max = MIN(count, 127);
648648
*output++ = -max;
649649
count -= max;
650650
}

0 commit comments

Comments
 (0)