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 | 26537cf9042a01e80b1b6fa750cfb2ecdc46804b (patch) | |
tree | 4a361b4407108e050c098c5591f129ba378a8acf | |
parent | 26a79131bc1d5a7e43dff193ac71b0c998764964 (diff) | |
download | scintilla-mirror-26537cf9042a01e80b1b6fa750cfb2ecdc46804b.tar.gz |
Promote methods from int to ptrdiff_t to allow extension to 64-bits.
-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 37d46726b..9ef83e8b0 100644 --- a/cocoa/ScintillaCocoa.h +++ b/cocoa/ScintillaCocoa.h @@ -107,8 +107,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 c731a1adb..c60825e04 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -1572,7 +1572,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()) { if (text) @@ -1589,7 +1589,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; } @@ -1673,12 +1673,12 @@ 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 { - const int inputLength = (lengthForEncode >= 0) ? lengthForEncode : static_cast<int>(strlen(utf8)); +ptrdiff_t ScintillaCocoa::EncodedFromUTF8(char *utf8, char *encoded) const { + 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 { // Need to convert const CFStringEncoding encoding = EncodingFromCharacterSet(IsUnicodeMode(), @@ -1689,7 +1689,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()); } } |