From dc7c28cfcf21c18f96a49f2cc0818d4f676bd301 Mon Sep 17 00:00:00 2001 From: Neil Hodgson Date: Sun, 22 Apr 2018 08:29:01 +1000 Subject: Fix problems with 64-bit positions by using types that expand to 64-bits and removing casts to int. --- cocoa/ScintillaView.mm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cocoa/ScintillaView.mm') diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index c19c976f7..aad9b0c9a 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -600,7 +600,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) { NSRange posRangeCurrent = mOwner.backend->PositionsFromCharacters(NSMakeRange(replacementRange.location, 0)); // Note: Scintilla internally works almost always with bytes instead chars, so we need to take // this into account when determining selection ranges and such. - int lengthInserted = mOwner.backend->InsertText(newText); + ptrdiff_t lengthInserted = mOwner.backend->InsertText(newText); posRangeCurrent.length = lengthInserted; mMarkedTextRange = mOwner.backend->CharactersFromPositions(posRangeCurrent); // Mark the just inserted text. Keep the marked range for later reset. @@ -941,7 +941,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) { */ - (id) accessibilityValue { const sptr_t length = [mOwner message: SCI_GETLENGTH]; - return mOwner.backend->RangeTextAsString(NSMakeRange(0, static_cast(length))); + return mOwner.backend->RangeTextAsString(NSMakeRange(0, length)); } //-------------------------------------------------------------------------------------------------- @@ -950,7 +950,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) { * NSAccessibility : Line of the caret. */ - (NSInteger) accessibilityInsertionPointLineNumber { - const int caret = static_cast([mOwner message: SCI_GETCURRENTPOS]); + const Sci::Position caret = [mOwner message: SCI_GETCURRENTPOS]; const NSRange rangeCharactersCaret = mOwner.backend->CharactersFromPositions(NSMakeRange(caret, 0)); return mOwner.backend->VisibleLineForIndex(rangeCharactersCaret.location); } -- cgit v1.2.3