cosmetics

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22114 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-12-12 22:43:37 +00:00
parent c6f8a4ade9
commit f407442b39
3 changed files with 20 additions and 23 deletions

View File

@ -23,6 +23,8 @@
#include "support/convert.h"
#include "support/lstrings.h"
#include <cstring>
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;

View File

@ -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;
}

View File

@ -18,7 +18,6 @@
#include "support/docstring.h"
#include <cstring>
#include <string>
#include <vector>
@ -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);