diff options
author | Neil <nyamatongwe@gmail.com> | 2018-04-25 16:26:57 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2018-04-25 16:26:57 +1000 |
commit | e5bf102b598a88c1c13e4f83264b652e85c75f22 (patch) | |
tree | dde6b05c11bc47d544b352ce2df837e97f73ff74 | |
parent | acdf3d281be64973db955a6ae6ef4e1d5dac9a5c (diff) | |
download | scintilla-mirror-e5bf102b598a88c1c13e4f83264b652e85c75f22.tar.gz |
Backport: Standardized signature of TargetAsUTF8 and EncodedFromUTF8.
Backport of changeset 6737:5c4aea8a1e8a.
-rw-r--r-- | cocoa/ScintillaCocoa.h | 4 | ||||
-rw-r--r-- | cocoa/ScintillaCocoa.mm | 4 | ||||
-rw-r--r-- | gtk/ScintillaGTK.cxx | 8 | ||||
-rw-r--r-- | gtk/ScintillaGTK.h | 4 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 4 |
5 files changed, 12 insertions, 12 deletions
diff --git a/cocoa/ScintillaCocoa.h b/cocoa/ScintillaCocoa.h index c893cf72e..ddfa205d6 100644 --- a/cocoa/ScintillaCocoa.h +++ b/cocoa/ScintillaCocoa.h @@ -108,8 +108,8 @@ private: bool GetPasteboardData(NSPasteboard* board, SelectionText* selectedText); void SetPasteboardData(NSPasteboard* board, const SelectionText& selectedText); - ptrdiff_t TargetAsUTF8(char *text); - ptrdiff_t EncodedFromUTF8(char *utf8, char *encoded) const; + Sci::Position TargetAsUTF8(char *text) const; + Sci::Position EncodedFromUTF8(const char *utf8, char *encoded) const; int scrollSpeed; int scrollTicks; diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index 8f6d2059f..b24e29a49 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -1648,7 +1648,7 @@ bool ScintillaCocoa::GetPasteboardData(NSPasteboard* board, SelectionText* selec // Returns the target converted to UTF8. // Return the length in bytes. -ptrdiff_t ScintillaCocoa::TargetAsUTF8(char *text) +Sci::Position ScintillaCocoa::TargetAsUTF8(char *text) const { const Sci::Position targetLength = targetEnd - targetStart; if (IsUnicodeMode()) @@ -1756,7 +1756,7 @@ NSRect ScintillaCocoa::GetBounds() const { // Translates a UTF8 string into the document encoding. // Return the length of the result in bytes. -ptrdiff_t ScintillaCocoa::EncodedFromUTF8(char *utf8, char *encoded) const +Sci::Position ScintillaCocoa::EncodedFromUTF8(const char *utf8, char *encoded) const { const size_t inputLength = (lengthForEncode >= 0) ? lengthForEncode : strlen(utf8); if (IsUnicodeMode()) diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index a8b34e01b..47975d2ed 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -741,8 +741,8 @@ std::string ConvertText(const char *s, size_t len, const char *charSetDest, // Returns the target converted to UTF8. // Return the length in bytes. -int ScintillaGTK::TargetAsUTF8(char *text) { - int targetLength = targetEnd - targetStart; +Sci::Position ScintillaGTK::TargetAsUTF8(char *text) const { + Sci::Position targetLength = targetEnd - targetStart; if (IsUnicodeMode()) { if (text) { pdoc->GetCharRange(text, targetStart, targetLength); @@ -768,8 +768,8 @@ int ScintillaGTK::TargetAsUTF8(char *text) { // Translates a nul terminated UTF8 string into the document encoding. // Return the length of the result in bytes. -int ScintillaGTK::EncodedFromUTF8(char *utf8, char *encoded) const { - int inputLength = (lengthForEncode >= 0) ? lengthForEncode : strlen(utf8); +Sci::Position ScintillaGTK::EncodedFromUTF8(const char *utf8, char *encoded) const { + Sci::Position inputLength = (lengthForEncode >= 0) ? lengthForEncode : strlen(utf8); if (IsUnicodeMode()) { if (encoded) { memcpy(encoded, utf8, inputLength); diff --git a/gtk/ScintillaGTK.h b/gtk/ScintillaGTK.h index 07456a689..8a72b4002 100644 --- a/gtk/ScintillaGTK.h +++ b/gtk/ScintillaGTK.h @@ -85,8 +85,8 @@ private: void DisplayCursor(Window::Cursor c) override; bool DragThreshold(Point ptStart, Point ptNow) override; void StartDrag() override; - int TargetAsUTF8(char *text); - int EncodedFromUTF8(char *utf8, char *encoded) const; + Sci::Position TargetAsUTF8(char *text) const; + Sci::Position EncodedFromUTF8(const char *utf8, char *encoded) const; bool ValidCodePage(int codePage) const override; public: // Public for scintilla_send_message sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) override; diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 9a44e71b6..45b1f0d4a 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -306,7 +306,7 @@ class ScintillaWin : void StartDrag() override; static int MouseModifiers(uptr_t wParam); - Sci::Position TargetAsUTF8(char *text); + Sci::Position TargetAsUTF8(char *text) const; void AddCharUTF16(wchar_t const *wcs, unsigned int wclen); Sci::Position EncodedFromUTF8(const char *utf8, char *encoded) const; sptr_t WndPaint(uptr_t wParam); @@ -747,7 +747,7 @@ static std::wstring StringMapCase(const std::wstring &ws, DWORD mapFlags) { // Returns the target converted to UTF8. // Return the length in bytes. -Sci::Position ScintillaWin::TargetAsUTF8(char *text) { +Sci::Position ScintillaWin::TargetAsUTF8(char *text) const { Sci::Position targetLength = targetEnd - targetStart; if (IsUnicodeMode()) { if (text) { |