aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa/PlatCocoa.mm
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-03-29 09:03:04 +1100
committerNeil <nyamatongwe@gmail.com>2021-03-29 09:03:04 +1100
commitf1ad63380ea954ae42c26d0a4fc0e46574cd9e5f (patch)
treed0b95dd1e509cc0eca7a353520e9c409c0497195 /cocoa/PlatCocoa.mm
parentab70e1041cb40c9d807a18ca7abb5c000adf2fdf (diff)
downloadscintilla-mirror-f1ad63380ea954ae42c26d0a4fc0e46574cd9e5f.tar.gz
Modify ListBox::GetValue to return a std::string to avoid fixed size buffers
and the possibility of truncation.
Diffstat (limited to 'cocoa/PlatCocoa.mm')
-rw-r--r--cocoa/PlatCocoa.mm11
1 files changed, 5 insertions, 6 deletions
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index bec70e8b9..af420c47b 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -1923,7 +1923,7 @@ public:
void Select(int n) override;
int GetSelection() override;
int Find(const char *prefix) override;
- void GetValue(int n, char *value, int len) override;
+ std::string GetValue(int n) override;
void RegisterImage(int type, const char *xpm_data) override;
void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) override;
void ClearRegisteredImages() override;
@@ -2145,13 +2145,12 @@ int ListBoxImpl::Find(const char *prefix) {
return - 1;
}
-void ListBoxImpl::GetValue(int n, char *value, int len) {
+std::string ListBoxImpl::GetValue(int n) {
const char *textString = ld.GetString(n);
- if (textString == NULL) {
- value[0] = '\0';
- return;
+ if (textString) {
+ return textString;
}
- strlcpy(value, textString, len);
+ return std::string();
}
void ListBoxImpl::RegisterImage(int type, const char *xpm_data) {