mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-12 11:32:21 +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
|
// 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"
|
// construct "pattern" from "data"
|
||||||
|
size_t const pattern_max_size = 20;
|
||||||
|
string pattern;
|
||||||
while (!isEndOfData(buffer)) {
|
while (!isEndOfData(buffer)) {
|
||||||
if (pattern_index > (sizeof(pattern) - 2))
|
if (pattern.size() > pattern_max_size)
|
||||||
return false;
|
return false;
|
||||||
pattern[pattern_index] = nextToken(buffer);
|
char const c = nextToken(buffer);
|
||||||
if (pattern[pattern_index] == 'E')
|
if (c == 'E')
|
||||||
return false;
|
return false;
|
||||||
++pattern_index;
|
pattern.push_back(c);
|
||||||
}
|
}
|
||||||
pattern[pattern_index] = '\0';
|
|
||||||
|
|
||||||
// search "pattern" in "table"
|
// search "pattern" in "table"
|
||||||
table_index = 0;
|
size_t table_index = 0;
|
||||||
while (strcmp(pattern, table[table_index].pattern)) {
|
while (pattern != table[table_index].pattern) {
|
||||||
++table_index;
|
++table_index;
|
||||||
if (!*table[table_index].pattern)
|
if (!*table[table_index].pattern)
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user