mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 21:55:29 +00:00
isValidGlueLength(): fix gcc warning and cleanup.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33671 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
45287844fa
commit
27657b3b75
@ -244,27 +244,21 @@ bool isValidGlueLength(string const & data, GlueLength * result)
|
||||
}
|
||||
// end of hack
|
||||
|
||||
int pattern_index = 0;
|
||||
int table_index = 0;
|
||||
char pattern[22]; // 20 + 1 for pattern[20], + 1 for '\0'
|
||||
|
||||
number_index = 1;
|
||||
unit_index = 1; // entries at index 0 are sentinels
|
||||
|
||||
// construct "pattern" from "data"
|
||||
size_t const pattern_max_size = 20;
|
||||
string pattern;
|
||||
while (!isEndOfData(buffer)) {
|
||||
if (pattern_index > (sizeof(pattern) - 2))
|
||||
if (pattern.size() > pattern_max_size)
|
||||
return false;
|
||||
pattern[pattern_index] = nextToken(buffer);
|
||||
if (pattern[pattern_index] == 'E')
|
||||
char const c = nextToken(buffer);
|
||||
if (c == 'E')
|
||||
return false;
|
||||
++pattern_index;
|
||||
pattern.push_back(c);
|
||||
}
|
||||
pattern[pattern_index] = '\0';
|
||||
|
||||
// search "pattern" in "table"
|
||||
table_index = 0;
|
||||
while (strcmp(pattern, table[table_index].pattern)) {
|
||||
size_t table_index = 0;
|
||||
while (pattern != table[table_index].pattern) {
|
||||
++table_index;
|
||||
if (!*table[table_index].pattern)
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user