mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Be more careful here about isalpha and isalnum. Per Enrico's suggestion,
we first do a range test, then check the status. I think this is right in both cases. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36351 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2d40278670
commit
4bf281106b
@ -114,8 +114,9 @@ docstring InsetRef::getFormattedCmd(docstring const & ref,
|
||||
// make sure the prefix is legal for a latex command
|
||||
int const len = prefix.size();
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (!isalpha(prefix[i])) {
|
||||
LYXERR0("Prefix `" << prefix << "' contains non-letters.");
|
||||
char_type c = prefix[i];
|
||||
if (c >= 0x80 || !isalpha(prefix[i])) {
|
||||
LYXERR0("Prefix `" << prefix << "' is invalid for LaTeX.");
|
||||
// restore the label
|
||||
label = ref;
|
||||
return defcmd;
|
||||
|
@ -128,11 +128,11 @@ docstring cleanAttr(docstring const & str)
|
||||
docstring newname;
|
||||
docstring::const_iterator it = str.begin();
|
||||
docstring::const_iterator en = str.end();
|
||||
for (; it != en; ++it)
|
||||
if (isalnum(*it))
|
||||
newname += *it;
|
||||
else
|
||||
newname += '_';
|
||||
for (; it != en; ++it) {
|
||||
char_type const c = *it;
|
||||
bool const is_alnum = c < 0x80 && isalnum(c);
|
||||
newname += is_alnum ? c : char_type('_');
|
||||
}
|
||||
return newname;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user