Skip to content

Commit 47dc1f3

Browse files
committed
Fixed signed/unsigned issues with pymlreplace (hopefully)
This should fix signed/unsigned comparison/assignment issues with the new offset_t type used in pymlreplace
1 parent d60865f commit 47dc1f3

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

PythonScript/src/ScintillaWrapper.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ void ScintillaWrapper::pymlreplace(boost::python::object searchExp, boost::pytho
579579

580580
if (!endPosition.is_none())
581581
{
582-
range.chrg.cpMax =boost::python::extract<int>(endPosition);
582+
range.chrg.cpMax = boost::python::extract<int>(endPosition);
583583
}
584584
else
585585
{
@@ -644,14 +644,14 @@ void ScintillaWrapper::pymlreplace(boost::python::object searchExp, boost::pytho
644644
replacementLength = _len(oreplacement);
645645

646646
// Replace text in Scintilla
647-
callScintilla(SCI_SETTARGETSTART, matchStart + currentOffset);
648-
callScintilla(SCI_SETTARGETEND, matchEnd + currentOffset);
647+
callScintilla(SCI_SETTARGETSTART, static_cast<offset_t>(matchStart) + currentOffset);
648+
callScintilla(SCI_SETTARGETEND, static_cast<offset_t>(matchEnd) + currentOffset);
649649
callScintilla(SCI_REPLACETARGET, replacementLength, reinterpret_cast<LPARAM>(replacement));
650650

651651

652652
// Calculate the difference between the old string,
653653
// and the new replacement, and add it to the currentOffset
654-
currentOffset += replacementLength - (matchEnd - matchStart);
654+
currentOffset += static_cast<offset_t>(replacementLength - (matchEnd - matchStart));
655655

656656

657657
// Set startPos to the end of the last match - startPos is with the original document

0 commit comments

Comments
 (0)