Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2015-06-15 03:00:00 +0300
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:16:54 +0300
commit54490d51d5c6b0d794dcbad2d634d4c95fc25b6c (patch)
treec3c413656432c0ef87b2841c80e42b55ad17d4e8 /CPP/Windows/Control
parent0713a3ab803e57401f18432148b4139e5fe6e5dd (diff)
15.0515.05
Diffstat (limited to 'CPP/Windows/Control')
-rw-r--r--CPP/Windows/Control/ComboBox.cpp18
-rw-r--r--CPP/Windows/Control/Dialog.h4
-rw-r--r--CPP/Windows/Control/Window2.h2
3 files changed, 16 insertions, 8 deletions
diff --git a/CPP/Windows/Control/ComboBox.cpp b/CPP/Windows/Control/ComboBox.cpp
index 9b458fe4..3c08309b 100644
--- a/CPP/Windows/Control/ComboBox.cpp
+++ b/CPP/Windows/Control/ComboBox.cpp
@@ -18,11 +18,15 @@ namespace NControl {
LRESULT CComboBox::GetLBText(int index, CSysString &s)
{
s.Empty();
- LRESULT len = GetLBTextLen(index);
+ LRESULT len = GetLBTextLen(index); // length, excluding the terminating null character
if (len == CB_ERR)
return len;
- len = GetLBText(index, s.GetBuffer((int)len + 1));
- s.ReleaseBuffer();
+ LRESULT len2 = GetLBText(index, s.GetBuf((unsigned)len));
+ if (len2 == CB_ERR)
+ return len;
+ if (len > len2)
+ len = len2;
+ s.ReleaseBuf_CalcLen((unsigned)len);
return len;
}
@@ -42,8 +46,12 @@ LRESULT CComboBox::GetLBText(int index, UString &s)
LRESULT len = SendMessageW(CB_GETLBTEXTLEN, index, 0);
if (len == CB_ERR)
return len;
- len = SendMessageW(CB_GETLBTEXT, index, (LPARAM)s.GetBuffer((int)len + 1));
- s.ReleaseBuffer();
+ LRESULT len2 = SendMessageW(CB_GETLBTEXT, index, (LPARAM)s.GetBuf((unsigned)len));
+ if (len2 == CB_ERR)
+ return len;
+ if (len > len2)
+ len = len2;
+ s.ReleaseBuf_CalcLen(len);
return len;
}
AString sa;
diff --git a/CPP/Windows/Control/Dialog.h b/CPP/Windows/Control/Dialog.h
index b450266b..59b9f419 100644
--- a/CPP/Windows/Control/Dialog.h
+++ b/CPP/Windows/Control/Dialog.h
@@ -95,9 +95,9 @@ public:
/*
#ifdef UNDER_CE
- virtual void OnHelp(void *) { OnHelp(); };
+ virtual void OnHelp(void *) { OnHelp(); }
#else
- virtual void OnHelp(LPHELPINFO) { OnHelp(); };
+ virtual void OnHelp(LPHELPINFO) { OnHelp(); }
#endif
*/
virtual void OnHelp() {};
diff --git a/CPP/Windows/Control/Window2.h b/CPP/Windows/Control/Window2.h
index d744b3e6..7ac580cb 100644
--- a/CPP/Windows/Control/Window2.h
+++ b/CPP/Windows/Control/Window2.h
@@ -35,7 +35,7 @@ public:
virtual void OnDestroy() { PostQuitMessage(0); }
virtual void OnClose() { Destroy(); }
/*
- virtual LRESULT OnHelp(LPHELPINFO helpInfo) { OnHelp(); };
+ virtual LRESULT OnHelp(LPHELPINFO helpInfo) { OnHelp(); }
virtual LRESULT OnHelp() {};
virtual bool OnButtonClicked(int buttonID, HWND buttonHWND);
virtual void OnOK() {};