Change string literal comparsions to std::string ones.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9517 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2005-01-20 22:00:17 +00:00
parent 0de22c86f8
commit eba5a2d138
2 changed files with 18 additions and 5 deletions

View File

@ -1,3 +1,11 @@
2005-01-20 Angus Leeming <leeming@lyx.org>
* lyxfont.C (setLyXFamily, setLyXSeries, setLyXShape, setLyXSize)
(setLyXMisc): (char string literal) != (char string literal) is
performing a comparison on the addresses. Convert one operand
explicitly to string to guarantee expected behaviour.
From MSVC warning.
2005-01-20 Asger Ottar Alstrup <aalstrup@laerdal.dk> 2005-01-20 Asger Ottar Alstrup <aalstrup@laerdal.dk>
* buffer.C: * buffer.C:

View File

@ -545,7 +545,8 @@ LyXFont & LyXFont::setLyXFamily(string const & fam)
string const s = ascii_lowercase(fam); string const s = ascii_lowercase(fam);
int i = 0; int i = 0;
while (s != LyXFamilyNames[i] && LyXFamilyNames[i] != "error") while (LyXFamilyNames[i] != s &&
LyXFamilyNames[i] != string("error"))
++i; ++i;
if (s == LyXFamilyNames[i]) if (s == LyXFamilyNames[i])
setFamily(LyXFont::FONT_FAMILY(i)); setFamily(LyXFont::FONT_FAMILY(i));
@ -562,7 +563,8 @@ LyXFont & LyXFont::setLyXSeries(string const & ser)
string const s = ascii_lowercase(ser); string const s = ascii_lowercase(ser);
int i = 0; int i = 0;
while (s != LyXSeriesNames[i] && LyXSeriesNames[i] != "error") ++i; while (LyXSeriesNames[i] != s &&
LyXSeriesNames[i] != string("error")) ++i;
if (s == LyXSeriesNames[i]) { if (s == LyXSeriesNames[i]) {
setSeries(LyXFont::FONT_SERIES(i)); setSeries(LyXFont::FONT_SERIES(i));
} else } else
@ -578,7 +580,8 @@ LyXFont & LyXFont::setLyXShape(string const & sha)
string const s = ascii_lowercase(sha); string const s = ascii_lowercase(sha);
int i = 0; int i = 0;
while (s != LyXShapeNames[i] && LyXShapeNames[i] != "error") ++i; while (LyXShapeNames[i] != s &&
LyXShapeNames[i] != string("error")) ++i;
if (s == LyXShapeNames[i]) { if (s == LyXShapeNames[i]) {
setShape(LyXFont::FONT_SHAPE(i)); setShape(LyXFont::FONT_SHAPE(i));
} else } else
@ -593,7 +596,8 @@ LyXFont & LyXFont::setLyXSize(string const & siz)
{ {
string const s = ascii_lowercase(siz); string const s = ascii_lowercase(siz);
int i = 0; int i = 0;
while (s != LyXSizeNames[i] && LyXSizeNames[i] != "error") ++i; while (LyXSizeNames[i] != s &&
LyXSizeNames[i] != string("error")) ++i;
if (s == LyXSizeNames[i]) { if (s == LyXSizeNames[i]) {
setSize(LyXFont::FONT_SIZE(i)); setSize(LyXFont::FONT_SIZE(i));
} else } else
@ -608,7 +612,8 @@ LyXFont::FONT_MISC_STATE LyXFont::setLyXMisc(string const & siz)
{ {
string const s = ascii_lowercase(siz); string const s = ascii_lowercase(siz);
int i = 0; int i = 0;
while (s != LyXMiscNames[i] && LyXMiscNames[i] != "error") ++i; while (LyXMiscNames[i] != s &&
LyXMiscNames[i] != string("error")) ++i;
if (s == LyXMiscNames[i]) if (s == LyXMiscNames[i])
return FONT_MISC_STATE(i); return FONT_MISC_STATE(i);
lyxerr << "LyXFont::setLyXMisc: Unknown misc flag `" lyxerr << "LyXFont::setLyXMisc: Unknown misc flag `"