From dcb8510be29dd09b2ffd6e4a0e7e792ac56ce5e5 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 3 Mar 2018 14:17:28 +1100 Subject: Backport: Promote methods from int to ptrdiff_t to allow extension to 64-bits. Backport of changeset 6472:aa859585e0c2. --- cocoa/ScintillaCocoa.h | 4 ++-- cocoa/ScintillaCocoa.mm | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cocoa/ScintillaCocoa.h b/cocoa/ScintillaCocoa.h index b9f851875..9673b1b50 100644 --- a/cocoa/ScintillaCocoa.h +++ b/cocoa/ScintillaCocoa.h @@ -109,8 +109,8 @@ private: bool GetPasteboardData(NSPasteboard* board, SelectionText* selectedText); void SetPasteboardData(NSPasteboard* board, const SelectionText& selectedText); - int TargetAsUTF8(char *text); - int EncodedFromUTF8(char *utf8, char *encoded) const; + ptrdiff_t TargetAsUTF8(char *text); + ptrdiff_t EncodedFromUTF8(char *utf8, char *encoded) const; int scrollSpeed; int scrollTicks; diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index ed48f82d2..c255c97c9 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -1646,7 +1646,7 @@ bool ScintillaCocoa::GetPasteboardData(NSPasteboard* board, SelectionText* selec // Returns the target converted to UTF8. // Return the length in bytes. -int ScintillaCocoa::TargetAsUTF8(char *text) +ptrdiff_t ScintillaCocoa::TargetAsUTF8(char *text) { const Sci::Position targetLength = targetEnd - targetStart; if (IsUnicodeMode()) @@ -1667,7 +1667,7 @@ int ScintillaCocoa::TargetAsUTF8(char *text) if (text) memcpy(text, tmputf.c_str(), tmputf.length()); CFRelease(cfsVal); - return static_cast(tmputf.length()); + return static_cast(tmputf.length()); } return targetLength; } @@ -1754,14 +1754,14 @@ NSRect ScintillaCocoa::GetBounds() const { // Translates a UTF8 string into the document encoding. // Return the length of the result in bytes. -int ScintillaCocoa::EncodedFromUTF8(char *utf8, char *encoded) const +ptrdiff_t ScintillaCocoa::EncodedFromUTF8(char *utf8, char *encoded) const { - const int inputLength = (lengthForEncode >= 0) ? lengthForEncode : static_cast(strlen(utf8)); + const size_t inputLength = (lengthForEncode >= 0) ? lengthForEncode : strlen(utf8); if (IsUnicodeMode()) { if (encoded) memcpy(encoded, utf8, inputLength); - return inputLength; + return static_cast(inputLength); } else { @@ -1774,7 +1774,7 @@ int ScintillaCocoa::EncodedFromUTF8(char *utf8, char *encoded) const if (encoded) memcpy(encoded, sEncoded.c_str(), sEncoded.length()); CFRelease(cfsVal); - return static_cast(sEncoded.length()); + return static_cast(sEncoded.length()); } } -- cgit v1.2.3