From eba5a2d1389571b93cc9f343564b483ecbe0a764 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Thu, 20 Jan 2005 22:00:17 +0000 Subject: [PATCH] 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 --- src/ChangeLog | 8 ++++++++ src/lyxfont.C | 15 ++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index fe359efd19..76e037176a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2005-01-20 Angus Leeming + + * 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 * buffer.C: diff --git a/src/lyxfont.C b/src/lyxfont.C index 2ffce829c8..6416713986 100644 --- a/src/lyxfont.C +++ b/src/lyxfont.C @@ -545,7 +545,8 @@ LyXFont & LyXFont::setLyXFamily(string const & fam) string const s = ascii_lowercase(fam); int i = 0; - while (s != LyXFamilyNames[i] && LyXFamilyNames[i] != "error") + while (LyXFamilyNames[i] != s && + LyXFamilyNames[i] != string("error")) ++i; if (s == LyXFamilyNames[i]) setFamily(LyXFont::FONT_FAMILY(i)); @@ -562,7 +563,8 @@ LyXFont & LyXFont::setLyXSeries(string const & ser) string const s = ascii_lowercase(ser); int i = 0; - while (s != LyXSeriesNames[i] && LyXSeriesNames[i] != "error") ++i; + while (LyXSeriesNames[i] != s && + LyXSeriesNames[i] != string("error")) ++i; if (s == LyXSeriesNames[i]) { setSeries(LyXFont::FONT_SERIES(i)); } else @@ -578,7 +580,8 @@ LyXFont & LyXFont::setLyXShape(string const & sha) string const s = ascii_lowercase(sha); int i = 0; - while (s != LyXShapeNames[i] && LyXShapeNames[i] != "error") ++i; + while (LyXShapeNames[i] != s && + LyXShapeNames[i] != string("error")) ++i; if (s == LyXShapeNames[i]) { setShape(LyXFont::FONT_SHAPE(i)); } else @@ -593,7 +596,8 @@ LyXFont & LyXFont::setLyXSize(string const & siz) { string const s = ascii_lowercase(siz); int i = 0; - while (s != LyXSizeNames[i] && LyXSizeNames[i] != "error") ++i; + while (LyXSizeNames[i] != s && + LyXSizeNames[i] != string("error")) ++i; if (s == LyXSizeNames[i]) { setSize(LyXFont::FONT_SIZE(i)); } else @@ -608,7 +612,8 @@ LyXFont::FONT_MISC_STATE LyXFont::setLyXMisc(string const & siz) { string const s = ascii_lowercase(siz); int i = 0; - while (s != LyXMiscNames[i] && LyXMiscNames[i] != "error") ++i; + while (LyXMiscNames[i] != s && + LyXMiscNames[i] != string("error")) ++i; if (s == LyXMiscNames[i]) return FONT_MISC_STATE(i); lyxerr << "LyXFont::setLyXMisc: Unknown misc flag `"