Skip to content

Commit

Permalink
Revert "new Doxyfile option: MODIFY_SPECIAL_CHARS"
Browse files Browse the repository at this point in the history
This reverts commit 5a71215.
  • Loading branch information
joenio committed Aug 4, 2019
1 parent 9b94d5c commit f80f348
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 97 deletions.
1 change: 0 additions & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
FILTER_SOURCE_PATTERNS =
USE_MDFILE_AS_MAINPAGE =
MODIFY_SPECIAL_CHARS = YES
#---------------------------------------------------------------------------
# Configuration options related to source browsing
#---------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion addon/doxyparse/doxyparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,6 @@ int main(int argc,char **argv) {

// check and finalize the configuration
checkConfiguration();
Config_getBool(MODIFY_SPECIAL_CHARS)=FALSE;
adjustConfiguration();

// setup the non-default configuration options
Expand Down
8 changes: 0 additions & 8 deletions src/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1562,14 +1562,6 @@ FILE_VERSION_FILTER = "cleartool desc -fmt \%Vn"
is part of the input, its contents will be placed on the main page (`index.html`).
This can be useful if you have a project on for instance GitHub and want to reuse
the introduction page also for the doxygen output.
]]>
</docs>
</option>
<option type='bool' id='MODIFY_SPECIAL_CHARS' defval='1'>
<docs>
<![CDATA[
If the \c MODIFY_SPECIAL_CHARS tag is set to \c YES, the chars _-:/<>*&|.!,{}?^
%()+=$\@ and space will be changed to safer strings.
]]>
</docs>
</option>
Expand Down
166 changes: 79 additions & 87 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5442,112 +5442,104 @@ QCString escapeCharsInString(const char *name,bool allowDots,bool allowUnderscor
{
static bool caseSenseNames = Config_getBool(CASE_SENSE_NAMES);
static bool allowUnicodeNames = Config_getBool(ALLOW_UNICODE_NAMES);
static bool modifySpecialCharsInString = Config_getBool(MODIFY_SPECIAL_CHARS);
static GrowBuf growBuf;
growBuf.clear();
char c;
const char *p=name;
while ((c=*p++)!=0)
{
if(modifySpecialCharsInString)
switch(c)
{
switch(c)
{
case '_': if (allowUnderscore) growBuf.addChar('_'); else growBuf.addStr("__"); break;
case '-': growBuf.addChar('-'); break;
case ':': growBuf.addStr("_1"); break;
case '/': growBuf.addStr("_2"); break;
case '<': growBuf.addStr("_3"); break;
case '>': growBuf.addStr("_4"); break;
case '*': growBuf.addStr("_5"); break;
case '&': growBuf.addStr("_6"); break;
case '|': growBuf.addStr("_7"); break;
case '.': if (allowDots) growBuf.addChar('.'); else growBuf.addStr("_8"); break;
case '!': growBuf.addStr("_9"); break;
case ',': growBuf.addStr("_00"); break;
case ' ': growBuf.addStr("_01"); break;
case '{': growBuf.addStr("_02"); break;
case '}': growBuf.addStr("_03"); break;
case '?': growBuf.addStr("_04"); break;
case '^': growBuf.addStr("_05"); break;
case '%': growBuf.addStr("_06"); break;
case '(': growBuf.addStr("_07"); break;
case ')': growBuf.addStr("_08"); break;
case '+': growBuf.addStr("_09"); break;
case '=': growBuf.addStr("_0A"); break;
case '$': growBuf.addStr("_0B"); break;
case '\\': growBuf.addStr("_0C"); break;
case '@': growBuf.addStr("_0D"); break;
default:
if (c<0)
case '_': if (allowUnderscore) growBuf.addChar('_'); else growBuf.addStr("__"); break;
case '-': growBuf.addChar('-'); break;
case ':': growBuf.addStr("_1"); break;
case '/': growBuf.addStr("_2"); break;
case '<': growBuf.addStr("_3"); break;
case '>': growBuf.addStr("_4"); break;
case '*': growBuf.addStr("_5"); break;
case '&': growBuf.addStr("_6"); break;
case '|': growBuf.addStr("_7"); break;
case '.': if (allowDots) growBuf.addChar('.'); else growBuf.addStr("_8"); break;
case '!': growBuf.addStr("_9"); break;
case ',': growBuf.addStr("_00"); break;
case ' ': growBuf.addStr("_01"); break;
case '{': growBuf.addStr("_02"); break;
case '}': growBuf.addStr("_03"); break;
case '?': growBuf.addStr("_04"); break;
case '^': growBuf.addStr("_05"); break;
case '%': growBuf.addStr("_06"); break;
case '(': growBuf.addStr("_07"); break;
case ')': growBuf.addStr("_08"); break;
case '+': growBuf.addStr("_09"); break;
case '=': growBuf.addStr("_0A"); break;
case '$': growBuf.addStr("_0B"); break;
case '\\': growBuf.addStr("_0C"); break;
case '@': growBuf.addStr("_0D"); break;
default:
if (c<0)
{
char ids[5];
const unsigned char uc = (unsigned char)c;
bool doEscape = TRUE;
if (allowUnicodeNames && uc <= 0xf7)
{
char ids[5];
const unsigned char uc = (unsigned char)c;
bool doEscape = TRUE;
if (allowUnicodeNames && uc <= 0xf7)
const char* pt = p;
ids[ 0 ] = c;
int l = 0;
if ((uc&0xE0)==0xC0)
{
const char* pt = p;
ids[ 0 ] = c;
int l = 0;
if ((uc&0xE0)==0xC0)
{
l=2; // 11xx.xxxx: >=2 byte character
}
if ((uc&0xF0)==0xE0)
{
l=3; // 111x.xxxx: >=3 byte character
}
if ((uc&0xF8)==0xF0)
{
l=4; // 1111.xxxx: >=4 byte character
}
doEscape = l==0;
for (int m=1; m<l && !doEscape; ++m)
l=2; // 11xx.xxxx: >=2 byte character
}
if ((uc&0xF0)==0xE0)
{
l=3; // 111x.xxxx: >=3 byte character
}
if ((uc&0xF8)==0xF0)
{
l=4; // 1111.xxxx: >=4 byte character
}
doEscape = l==0;
for (int m=1; m<l && !doEscape; ++m)
{
unsigned char ct = (unsigned char)*pt;
if (ct==0 || (ct&0xC0)!=0x80) // invalid unicode character
{
unsigned char ct = (unsigned char)*pt;
if (ct==0 || (ct&0xC0)!=0x80) // invalid unicode character
{
doEscape=TRUE;
}
else
{
ids[ m ] = *pt++;
}
doEscape=TRUE;
}
if ( !doEscape ) // got a valid unicode character
else
{
ids[ l ] = 0;
growBuf.addStr( ids );
p += l - 1;
ids[ m ] = *pt++;
}
}
if (doEscape) // not a valid unicode char or escaping needed
if ( !doEscape ) // got a valid unicode character
{
static char map[] = "0123456789ABCDEF";
unsigned char id = (unsigned char)c;
ids[0]='_';
ids[1]='x';
ids[2]=map[id>>4];
ids[3]=map[id&0xF];
ids[4]=0;
growBuf.addStr(ids);
ids[ l ] = 0;
growBuf.addStr( ids );
p += l - 1;
}
}
else if (caseSenseNames || !isupper(c))
{
growBuf.addChar(c);
}
else
if (doEscape) // not a valid unicode char or escaping needed
{
growBuf.addChar('_');
growBuf.addChar(tolower(c));
static char map[] = "0123456789ABCDEF";
unsigned char id = (unsigned char)c;
ids[0]='_';
ids[1]='x';
ids[2]=map[id>>4];
ids[3]=map[id&0xF];
ids[4]=0;
growBuf.addStr(ids);
}
break;
}
}
else
{
growBuf.addChar(c);
}
else if (caseSenseNames || !isupper(c))
{
growBuf.addChar(c);
}
else
{
growBuf.addChar('_');
growBuf.addChar(tolower(c));
}
break;
}
}
growBuf.addChar(0);
Expand Down

0 comments on commit f80f348

Please sign in to comment.