]> git.lyx.org Git - features.git/commitdiff
Use boost::scoped_array to store the temporary wchar_t pointer/array
authorLars Gullik Bjønnes <larsbj@gullik.org>
Sat, 24 Jul 2004 16:40:21 +0000 (16:40 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Sat, 24 Jul 2004 16:40:21 +0000 (16:40 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8850 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/gtk/ChangeLog
src/frontends/gtk/GPainter.C
src/frontends/xforms/FormBox.C
src/mathed/ChangeLog
src/support/forkedcallqueue.C

index 7476275ba7422596fc72a199318f70b6f2b0608a..d6e2d36eb5263e49ec3311512bccaa3d9e4a40b7 100644 (file)
@@ -1,5 +1,8 @@
 2004-07-24  Lars Gullik Bjonnes  <larsbj@gullik.net>
 
+       * GPainter.C (text): sue boost::scoped_array to store the
+       temporary wchar_t pointer
+
        * lyx_gui.C: change "support/std_sstream.h" to <sstream>
 
 2004-07-22  Lars Gullik Bjonnes  <larsbj@gullik.net>
index 3631ba4d6f86275f74a9d8c3379ac1acdc6c07e1..8e6a6b5620ff8f53af3c1cf48391e08894a3b07d 100644 (file)
@@ -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<wchar_t> 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);
index c74a384a03a08a0cf10e38102012528336a46480..0c90df376e1bb007918c11664a2352cd4be4d812 100644 (file)
@@ -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);
 }
 
index b812e68e07336be4788410dfa04e3838bcaf1132..0b5e79dce6f82935e1475a381a60c375ad093f49 100644 (file)
@@ -1,6 +1,6 @@
 2004-07-24  Lars Gullik Bjonnes  <larsbj@gullik.net>
 
-       * 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"
index 03748296228fa0591ad0b94336c91c5d46947a5d..8a51fcd18f7318ff7106092e4c5649f7f4988e9e 100644 (file)
@@ -64,7 +64,7 @@ void ForkedCallQueue::callNext()
 
 void ForkedCallQueue::callback(pid_t, int)
 {
-       if(callQueue_.empty()) {
+       if (callQueue_.empty()) {
                stopCaller();
        } else {
                callNext();