Skip to content

Commit f8a2c9f

Browse files
committed
Minor postfix for #8366: Improve readability
1 parent 3a03a8a commit f8a2c9f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

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(-static_cast<SINT64>(window->getRecordPosition() - window->getFrameStart())))
435+
if (!window->moveWithinFrame(-window->getInFrameOffset()))
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 += -static_cast<SINT64>(window->getRecordPosition() - window->getFrameStart()) - 1;
586+
records -= window->getInFrameOffset() + 1;
587587
else
588588
records = window->getFrameEnd() - window->getRecordPosition() - records + 1;
589589

src/jrd/recsrc/RecordSource.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,11 @@ namespace Jrd
798798
return savedPosition;
799799
}
800800

801+
SINT64 getInFrameOffset() const
802+
{
803+
return savedPosition - frameStart;
804+
}
805+
801806
void restore()
802807
{
803808
if (!moved)

0 commit comments

Comments
 (0)