From f407442b39b1f163990f8c35cfc6f62de8dd2210 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Wed, 12 Dec 2007 22:43:37 +0000 Subject: [PATCH] cosmetics git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22114 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/VSpace.cpp | 33 ++++++++++++++++++-------------- src/frontends/qt4/GuiToolbar.cpp | 2 +- src/support/lstrings.h | 8 -------- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/src/VSpace.cpp b/src/VSpace.cpp index 45379fd85d..9003951e91 100644 --- a/src/VSpace.cpp +++ b/src/VSpace.cpp @@ -23,6 +23,8 @@ #include "support/convert.h" #include "support/lstrings.h" +#include + using namespace std; using namespace lyx::support; @@ -32,11 +34,14 @@ namespace { /// used to return numeric values in parsing vspace double number[4] = { 0, 0, 0, 0 }; + /// used to return unit types in parsing vspace -Length::UNIT unit[4] = { Length::UNIT_NONE, - Length::UNIT_NONE, - Length::UNIT_NONE, - Length::UNIT_NONE }; +Length::UNIT unit[4] = { + Length::UNIT_NONE, + Length::UNIT_NONE, + Length::UNIT_NONE, + Length::UNIT_NONE +}; /// the current position in the number array int number_index; @@ -44,16 +49,14 @@ int number_index; int unit_index; /// skip n characters of input -inline -void lyx_advance(string & data, string::size_type n) +inline void lyx_advance(string & data, size_t n) { data.erase(0, n); } /// return true when the input is at the end -inline -bool isEndOfData(string const & data) +inline bool isEndOfData(string const & data) { return ltrim(data).empty(); } @@ -98,7 +101,7 @@ char nextToken(string & data) return '-'; } - string::size_type i = data.find_first_not_of("0123456789."); + size_t i = data.find_first_not_of("0123456789."); if (i != 0) { if (number_index > 3) @@ -110,8 +113,9 @@ char nextToken(string & data) if (i == string::npos) { buffer = data; i = data.size() + 1; - } else + } else { buffer = data.substr(0, i); + } lyx_advance(data, i); @@ -134,8 +138,9 @@ char nextToken(string & data) if (i == string::npos) { buffer = data; i = data.size() + 1; - } else + } else { buffer = data.substr(0, i); + } // possibly we have "mmplus" string or similar if (buffer.size() > 5 && @@ -256,7 +261,7 @@ bool isValidGlueLength(string const & data, GlueLength * result) // search "pattern" in "table" table_index = 0; - while (compare(pattern, table[table_index].pattern)) { + while (strcmp(pattern, table[table_index].pattern)) { ++table_index; if (!*table[table_index].pattern) return false; @@ -321,7 +326,7 @@ bool isValidLength(string const & data, Length * result) pattern[pattern_index] = '\0'; // only the most basic pattern is accepted here - if (compare(pattern, "nu") != 0) + if (strcmp(pattern, "nu") != 0) return false; // It _was_ a correct length string. @@ -366,7 +371,7 @@ VSpace::VSpace(string const & data) string input = rtrim(data); - string::size_type const length = input.length(); + size_t const length = input.length(); if (length > 1 && input[length - 1] == '*') { keep_ = true; diff --git a/src/frontends/qt4/GuiToolbar.cpp b/src/frontends/qt4/GuiToolbar.cpp index ecba34a10d..1ee1b2e9c8 100644 --- a/src/frontends/qt4/GuiToolbar.cpp +++ b/src/frontends/qt4/GuiToolbar.cpp @@ -76,7 +76,7 @@ struct PngMap { bool operator<(PngMap const & lhs, PngMap const & rhs) { - return compare(lhs.key, rhs.key) < 0; + return strcmp(lhs.key, rhs.key) < 0; } diff --git a/src/support/lstrings.h b/src/support/lstrings.h index 016331f27b..381e818f76 100644 --- a/src/support/lstrings.h +++ b/src/support/lstrings.h @@ -18,7 +18,6 @@ #include "support/docstring.h" -#include #include #include @@ -36,13 +35,6 @@ int compare_ascii_no_case(std::string const & s, std::string const & s2); /// Compare \p s and \p s2, ignoring the case of ASCII characters only. int compare_ascii_no_case(docstring const & s, docstring const & s2); -/// -inline int compare(char const * a, char const * b) -{ - using namespace std; - return strcmp(a, b); -} - /// bool isStrInt(std::string const & str); -- 2.39.2