]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/textctrl.cpp
Added wxPGProperty::OnValidationFailure(); needed it and some other tweaks to allow...
[wxWidgets.git] / src / msw / textctrl.cpp
index 5b2730bc62f4a63c53a614c5870883c2881b9772..6a4c1baffe5c050fa4194d28b2ba78040dd48240 100644 (file)
@@ -82,7 +82,7 @@
 // dummy value used for m_dropTarget, different from any valid pointer value
 // (which are all even under Windows) and NULL
 static wxDropTarget *
-    wxRICHTEXT_DEFAULT_DROPTARGET = wx_reinterpret_cast(wxDropTarget *, 1);
+    wxRICHTEXT_DEFAULT_DROPTARGET = reinterpret_cast<wxDropTarget *>(1);
 
 #endif // wxUSE_DRAG_AND_DROP && wxUSE_RICHEDIT
 
@@ -990,15 +990,10 @@ wxTextCtrl::StreamIn(const wxString& value,
     if (len == wxCONV_FAILED)
         return false;
 
-#if wxUSE_WCHAR_T
-    wxWCharBuffer wchBuf(len);
+    wxWCharBuffer wchBuf(len); // allocates one extra character
     wchar_t *wpc = wchBuf.data();
-#else
-    wchar_t *wchBuf = (wchar_t *)malloc((len + 1)*sizeof(wchar_t));
-    wchar_t *wpc = wchBuf;
-#endif
 
-    conv.MB2WC(wpc, value.mb_str(), value.length());
+    conv.MB2WC(wpc, value.mb_str(), len + 1);
 #endif // wxUSE_UNICODE_MSLU
 
     // finally, stream it in the control
@@ -2452,7 +2447,7 @@ bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
         cf.yHeight = 20*font.GetPointSize(); // 1 pt = 20 twips
         cf.bCharSet = lf.lfCharSet;
         cf.bPitchAndFamily = lf.lfPitchAndFamily;
-        wxStrncpy( cf.szFaceName, lf.lfFaceName, WXSIZEOF(cf.szFaceName) );
+        wxStrlcpy(cf.szFaceName, lf.lfFaceName, WXSIZEOF(cf.szFaceName));
 
         // also deal with underline/italic/bold attributes: note that we must
         // always set CFM_ITALIC &c bits in dwMask, even if we don't set the