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
This commit is contained in:
Lars Gullik Bjønnes 2004-07-24 16:40:21 +00:00
parent 7c15014ec2
commit c499bd1698
5 changed files with 13 additions and 10 deletions

View 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>

View 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);

View 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);
}

View 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"

View File

@ -64,7 +64,7 @@ void ForkedCallQueue::callNext()
void ForkedCallQueue::callback(pid_t, int)
{
if(callQueue_.empty()) {
if (callQueue_.empty()) {
stopCaller();
} else {
callNext();