Fix for dicument popup update bug; fix for purify ABR report.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@454 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2000-01-28 11:50:57 +00:00
parent e969e7b0eb
commit 1940a824b9
3 changed files with 37 additions and 15 deletions

View File

@ -1,3 +1,16 @@
2000-01-28 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/lyxfont.C (textWidth): hopefully better fix for the Array
Bounds Read error seen by purify. The problem was that islower is
a macros which takes an unsigned char and uses it as an index for
in array of characters properties (and is thus subject to the
above error).
(drawText): ditto.
* src/lyx_cb.C (UpdateLayoutDocument): use a switch to set
correctly the paper sides radio buttons.
(UpdateDocumentButtons): ditto.
2000-01-27 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/lyxfunc.C (processKeyEvent): fix a the buffer returned by

View File

@ -1884,10 +1884,14 @@ bool UpdateLayoutDocument(BufferParams * params)
fl_set_button(fd_form_document->radio_sides_one, 0);
fl_set_button(fd_form_document->radio_sides_two, 0);
if (params->sides == 2)
fl_set_button(fd_form_document->radio_sides_two, 1);
else
switch (params->sides) {
case LyXTextClass::OneSide:
fl_set_button(fd_form_document->radio_sides_one, 1);
break;
case LyXTextClass::TwoSides:
fl_set_button(fd_form_document->radio_sides_two, 1);
break;
}
fl_set_button(fd_form_document->radio_columns_one, 0);
fl_set_button(fd_form_document->radio_columns_two, 0);
@ -2791,12 +2795,16 @@ extern "C" void CharacterOKCB(FL_OBJECT *ob, long data)
void UpdateDocumentButtons(BufferParams const & params)
{
fl_set_choice(fd_form_document->choice_pagestyle, 1);
if (params.sides == 2)
fl_set_button(fd_form_document->radio_sides_two, 1);
else
switch (params.sides) {
case LyXTextClass::OneSide:
fl_set_button(fd_form_document->radio_sides_one, 1);
break;
case LyXTextClass::TwoSides:
fl_set_button(fd_form_document->radio_sides_two, 1);
break;
}
if (params.columns == 2)
fl_set_button(fd_form_document->radio_columns_two, 1);
else

View File

@ -879,18 +879,19 @@ int LyXFont::textWidth(char const * s, int n) const
} else {
// emulate smallcaps since X doesn't support this
unsigned int result = 0;
char c[2]; c[1] = '\0';
char c;
LyXFont smallfont = *this;
smallfont.decSize();
smallfont.decSize();
smallfont.setShape(LyXFont::UP_SHAPE);
for (int i = 0; i < n; ++i) {
c[0] = s[i];
if (islower(c[0])){
c[0] = toupper(c[0]);
result += XTextWidth(smallfont.getXFontstruct(), c, 1);
c = s[i];
// when islower is a macro, the cast is needed (JMarc)
if (islower(static_cast<unsigned char>(c))){
c = toupper(c);
result += XTextWidth(smallfont.getXFontstruct(), &c, 1);
} else {
result += XTextWidth(getXFontstruct(), c, 1);
result += XTextWidth(getXFontstruct(), &c, 1);
}
}
return result;
@ -937,7 +938,7 @@ int LyXFont::drawText(char const * s, int n, Pixmap pm,
smallfont.setShape(LyXFont::UP_SHAPE);
for (int i = 0; i < n; ++i) {
c = s[i];
if (islower(c)){
if (islower(static_cast<unsigned char>(c))){
c = toupper(c);
XDrawString(fl_display,
pm,