diff options
author | Neil <nyamatongwe@gmail.com> | 2018-03-03 14:17:28 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2018-03-03 14:17:28 +1100 |
commit | dcb8510be29dd09b2ffd6e4a0e7e792ac56ce5e5 (patch) | |
tree | 0b405b9eb460013b821831ce92845677ea7f4d5e | |
parent | 3dffa9758aff8c4af834ae58fa1c27c733f9eae6 (diff) | |
download | scintilla-mirror-dcb8510be29dd09b2ffd6e4a0e7e792ac56ce5e5.tar.gz |
Backport: Promote methods from int to ptrdiff_t to allow extension to 64-bits.
Backport of changeset 6472:aa859585e0c2.
-rw-r--r-- | cocoa/ScintillaCocoa.h | 4 | ||||
-rw-r--r-- | 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<int>(tmputf.length()); + return static_cast<ptrdiff_t>(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<int>(strlen(utf8)); + const size_t inputLength = (lengthForEncode >= 0) ? lengthForEncode : strlen(utf8); if (IsUnicodeMode()) { if (encoded) memcpy(encoded, utf8, inputLength); - return inputLength; + return static_cast<ptrdiff_t>(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<int>(sEncoded.length()); + return static_cast<ptrdiff_t>(sEncoded.length()); } } |