From c499bd16985e2c88dc8675f87de6154e59f628bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Sat, 24 Jul 2004 16:40:21 +0000 Subject: [PATCH] Use boost::scoped_array to store the temporary wchar_t pointer/array git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8850 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/gtk/ChangeLog | 3 +++ src/frontends/gtk/GPainter.C | 12 ++++++------ src/frontends/xforms/FormBox.C | 4 ++-- src/mathed/ChangeLog | 2 +- src/support/forkedcallqueue.C | 2 +- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/frontends/gtk/ChangeLog b/src/frontends/gtk/ChangeLog index 7476275ba7..d6e2d36eb5 100644 --- a/src/frontends/gtk/ChangeLog +++ b/src/frontends/gtk/ChangeLog @@ -1,5 +1,8 @@ 2004-07-24 Lars Gullik Bjonnes + * GPainter.C (text): sue boost::scoped_array to store the + temporary wchar_t pointer + * lyx_gui.C: change "support/std_sstream.h" to 2004-07-22 Lars Gullik Bjonnes diff --git a/src/frontends/gtk/GPainter.C b/src/frontends/gtk/GPainter.C index 3631ba4d6f..8e6a6b5620 100644 --- a/src/frontends/gtk/GPainter.C +++ b/src/frontends/gtk/GPainter.C @@ -188,9 +188,9 @@ void GPainter::image(int x, int y, int w, int h, void GPainter::text(int x, int y, std::string const & s, LyXFont const & f) { size_t size = s.length() + 1; - wchar_t * wcs = (wchar_t *) alloca(size * sizeof(wchar_t)); - size = mbstowcs(wcs, s.c_str(), size); - return text(x, y, wcs, size, f); + boost::scoped_array wcs(new wchar_t[size]); + size = mbstowcs(wcs.get(), s.c_str(), size); + return text(x, y, wcs.get(), size, f); } @@ -224,9 +224,9 @@ void GPainter::text(int x, int y, wchar_t const * s, int ls, LyXFont const & f) XftFont * fontS = getXftFont(smallfont); wchar_t c; int tmpx = x; - for(int i = 0; i < ls; ++i) { - c = support::uppercase(s[i]); - if(c != s[i]) { + for (int i = 0; i < ls; ++i) { + c = lyx::support::uppercase(s[i]); + if (c != s[i]) { XftDrawString32(draw, xftClr, fontS, tmpx, y, wcsToXftChar32StrFast(&c), 1); tmpx += font_metrics::width(c, smallfont); diff --git a/src/frontends/xforms/FormBox.C b/src/frontends/xforms/FormBox.C index c74a384a03..0c90df376e 100644 --- a/src/frontends/xforms/FormBox.C +++ b/src/frontends/xforms/FormBox.C @@ -160,7 +160,7 @@ void FormBox::update() gui_names_spec_[i].c_str()); } // Special width unit must be default for general units to be enabled - if(controller().params().special != "none") + if (controller().params().special != "none") setEnabled(dialog_->choice_width_unit, false); setEnabled(dialog_->choice_special, !controller().params().inner_box); @@ -177,7 +177,7 @@ void FormBox::update() setEnabled(dialog_->choice_height_unit, controller().params().inner_box); setEnabled(dialog_->choice_height_special, controller().params().inner_box); // Same here - if(height_special != "none") + if (height_special != "none") setEnabled(dialog_->choice_height_unit, false); } diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index b812e68e07..0b5e79dce6 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,6 +1,6 @@ 2004-07-24 Lars Gullik Bjonnes - * math_support.C, math_parser.C, math_nestinset.C, math_macrotable.C: + * math_support.C, math_parser.C, math_nestinset.C, math_macrotable.C: * math_hullinset.C, math_gridinset.C, math_factory.C: * math_extern.C, math_autocorrect.C, math_arrayinset.C: * formulamacro.C, command_inset.C: change "support/std_sstream.h" diff --git a/src/support/forkedcallqueue.C b/src/support/forkedcallqueue.C index 0374829622..8a51fcd18f 100644 --- a/src/support/forkedcallqueue.C +++ b/src/support/forkedcallqueue.C @@ -64,7 +64,7 @@ void ForkedCallQueue::callNext() void ForkedCallQueue::callback(pid_t, int) { - if(callQueue_.empty()) { + if (callQueue_.empty()) { stopCaller(); } else { callNext();