X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0e190fa2b480ec155f9808de4bb378731dc1154f..c81394808bf7efd84e4294e44a9a9a7b7f6dd8a9:/src/richtext/richtextbuffer.cpp diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 207a8899b1..c095af9c78 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -7733,11 +7733,11 @@ bool wxRichTextBuffer::SetStyleSheetAndNotify(wxRichTextStyleSheet* sheet) { wxRichTextStyleSheet* oldSheet = GetStyleSheet(); - wxWindowID id = wxID_ANY; + wxWindowID winid = wxID_ANY; if (GetRichTextCtrl()) - id = GetRichTextCtrl()->GetId(); + winid = GetRichTextCtrl()->GetId(); - wxRichTextEvent event(wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING, id); + wxRichTextEvent event(wxEVT_COMMAND_RICHTEXT_STYLESHEET_REPLACING, winid); event.SetEventObject(GetRichTextCtrl()); event.SetContainer(GetRichTextCtrl()->GetFocusObject()); event.SetOldStyleSheet(oldSheet); @@ -10417,8 +10417,13 @@ bool wxRichTextImageBlock::Load(wxImage& image) // Write data in hex to a stream bool wxRichTextImageBlock::WriteHex(wxOutputStream& stream) { - const int bufSize = 512; - char buf[bufSize+1]; + if (m_dataSize == 0) + return true; + + int bufSize = 100000; + if (int(2*m_dataSize) < bufSize) + bufSize = 2*m_dataSize; + char* buf = new char[bufSize+1]; int left = m_dataSize; int n, i, j; @@ -10444,6 +10449,7 @@ bool wxRichTextImageBlock::WriteHex(wxOutputStream& stream) buf[n] = 0; stream.Write((const char*) buf, n); } + delete[] buf; return true; }