From 5c2ddebecd17d3b10957178ba30f2873c0ec4611 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 15 Feb 2004 19:12:54 +0000 Subject: [PATCH] use correct way to get a pointer to vector elements in DoGetPartialTextExtents() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25827 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/dc.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index 4871d1f8de..7977fab35d 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -1613,7 +1613,7 @@ void wxDC::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y, // Each element of the array will be the width of the string up to and -// including the coresoponding character in text. +// including the coresoponding character in text. bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const { @@ -1630,22 +1630,24 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con maxLenText = version == wxWINDOWS_NT ? 65535 : 8192; maxWidth = version == wxWINDOWS_NT ? INT_MAX : 32767; } - + widths.Empty(); widths.Add(0, stlen); // fill the array with zeros - + if (!::GetTextExtentExPoint(GetHdc(), text.c_str(), // string to check wxMin(stlen, maxLenText), - maxWidth, - &fit, // receives count of chars + maxWidth, + &fit, // [out] count of chars // that will fit - widths.begin(), // array to fill - &sz)) { + &widths[0], // array to fill + &sz)) + { // API failed wxLogLastError(wxT("GetTextExtentExPoint")); - return false; - } + return false; + } + return true; } -- 2.45.2