From 5543d045f8ef12ac39e34dcf1d9c5b11795b8080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sheng=20Jiang=20=E8=92=8B=E6=99=9F?= Date: Tue, 19 Dec 2017 12:47:36 -0600 Subject: [PATCH] Update clistbox-class_23.cpp the buffer required by later code would be 16 bytes in ANSI and 32 bytes in Unicode, preallocating 10 bytes is useless. --- docs/mfc/codesnippet/CPP/clistbox-class_23.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/mfc/codesnippet/CPP/clistbox-class_23.cpp b/docs/mfc/codesnippet/CPP/clistbox-class_23.cpp index ef804e6707e..4b00182aa22 100644 --- a/docs/mfc/codesnippet/CPP/clistbox-class_23.cpp +++ b/docs/mfc/codesnippet/CPP/clistbox-class_23.cpp @@ -1,6 +1,6 @@ // Initialize the storage of the list box to be 256 strings with // about 10 characters per string, performance improvement. - int n = m_myListBox.InitStorage(256, 10); + int n = m_myListBox.InitStorage(256, 16*sizeof(TCHAR)); ASSERT(n != LB_ERRSPACE); // Add 256 items to the list box. @@ -9,4 +9,4 @@ { str.Format(_T("item string %d"), i); m_myListBox.AddString( str ); - } \ No newline at end of file + }