From 17401ab1cd48e293a9f9d8a41cb8851abb2f5f1f Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Tue, 23 Mar 2004 22:07:56 +0000 Subject: [PATCH] Applied patch [ 905577 ] Removed copystring from OGL library git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26314 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/include/wx/ogl/drawnp.h | 4 ++-- contrib/src/ogl/divided.cpp | 5 ++--- contrib/src/ogl/drawn.cpp | 11 ++++------- contrib/src/ogl/oglmisc.cpp | 2 +- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/contrib/include/wx/ogl/drawnp.h b/contrib/include/wx/ogl/drawnp.h index d837811f7c..a2fd6eb17e 100644 --- a/contrib/include/wx/ogl/drawnp.h +++ b/contrib/include/wx/ogl/drawnp.h @@ -146,7 +146,7 @@ class WXDLLIMPEXP_OGL wxOpDraw: public wxDrawOp { public: wxOpDraw(int theOp, double theX1, double theY1, double theX2, double theY2, - double radius = 0.0, wxChar *s = NULL); + double radius = 0.0, const wxString& s = wxEmptyString); ~wxOpDraw(); void Do(wxDC& dc, double xoffset, double yoffset); void Scale(double scaleX, double scaleY); @@ -166,7 +166,7 @@ public: double m_x3; double m_y3; double m_radius; - wxChar* m_textString; + wxString m_textString; }; diff --git a/contrib/src/ogl/divided.cpp b/contrib/src/ogl/divided.cpp index 50737984c0..9d682b8120 100644 --- a/contrib/src/ogl/divided.cpp +++ b/contrib/src/ogl/divided.cpp @@ -700,9 +700,8 @@ void wxDividedShapeControlPoint::OnEndDragLeft(double WXUNUSED(x), double y, int wxShapeRegion *region = (wxShapeRegion *)node->GetData(); if (region->GetText()) { - wxChar *s = copystring(region->GetText()); - dividedObject->FormatText(dc, s, i); - delete[] s; + wxString s(region->GetText()); + dividedObject->FormatText(dc, s.c_str(), i); } node = node->GetNext(); i++; diff --git a/contrib/src/ogl/drawn.cpp b/contrib/src/ogl/drawn.cpp index 20bea6a216..3733cdacd0 100644 --- a/contrib/src/ogl/drawn.cpp +++ b/contrib/src/ogl/drawn.cpp @@ -676,7 +676,7 @@ void wxOpSetClipping::ReadExpr(wxPseudoMetaFile *WXUNUSED(image), wxExpr *expr) */ wxOpDraw::wxOpDraw(int theOp, double theX1, double theY1, double theX2, double theY2, - double theRadius, wxChar *s) : wxDrawOp(theOp) + double theRadius, const wxString& s) : wxDrawOp(theOp) { m_x1 = theX1; m_y1 = theY1; @@ -685,13 +685,11 @@ wxOpDraw::wxOpDraw(int theOp, double theX1, double theY1, double theX2, double t m_x3 = 0.0; m_y3 = 0.0; m_radius = theRadius; - if (s) m_textString = copystring(s); - else m_textString = NULL; + m_textString = s; } wxOpDraw::~wxOpDraw() { - if (m_textString) delete[] m_textString; } wxDrawOp *wxOpDraw::Copy(wxPseudoMetaFile *WXUNUSED(newImage)) @@ -968,8 +966,7 @@ void wxOpDraw::ReadExpr(wxPseudoMetaFile *WXUNUSED(image), wxExpr *expr) { m_x1 = expr->Nth(1)->RealValue(); m_y1 = expr->Nth(2)->RealValue(); - wxString str(expr->Nth(3)->StringValue()); - m_textString = copystring(str); + m_textString = wxString(expr->Nth(3)->StringValue()); break; } case DRAWOP_DRAW_ARC: @@ -2365,7 +2362,7 @@ void wxPseudoMetaFile::DrawText(const wxString& text, const wxPoint& pt) wxOpDraw *theOp = new wxOpDraw(DRAWOP_DRAW_TEXT, (double) pt.x, (double) pt.y, 0.0, 0.0); - theOp->m_textString = copystring(text); + theOp->m_textString = text; m_ops.Append(theOp); } diff --git a/contrib/src/ogl/oglmisc.cpp b/contrib/src/ogl/oglmisc.cpp index 0b773e393e..d22eb0441c 100644 --- a/contrib/src/ogl/oglmisc.cpp +++ b/contrib/src/ogl/oglmisc.cpp @@ -505,7 +505,7 @@ void oglDrawFormattedText(wxDC& dc, wxList *text_list, dc.SetClippingRegion( (long)(m_xpos - width/2.0), (long)(m_ypos - height/2.0), - (long)width, (long)height); + (long)width+1, (long)height+1); // +1 to allow for rounding errors wxNode *current = text_list->GetFirst(); while (current) -- 2.45.2