mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 23:04:20 +01:00
closes[t:2502] Implement rot13 on the hint for inames
git-svn-id: file:///svn/toku/tokudb@19100 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
1440b4a3b9
commit
5a37ca9fcd
1 changed files with 20 additions and 1 deletions
21
src/ydb.c
21
src/ydb.c
|
@ -4172,6 +4172,21 @@ db_open_subdb(DB * db, DB_TXN * txn, const char *fname, const char *dbname, DBTY
|
|||
return r;
|
||||
}
|
||||
|
||||
static inline char
|
||||
rot13(char c) {
|
||||
char r;
|
||||
char a;
|
||||
if (isupper(c)) {
|
||||
a = 'A';
|
||||
}
|
||||
else {
|
||||
assert(islower(c));
|
||||
a = 'a';
|
||||
}
|
||||
r = (c - a + 13) % 26 + a;
|
||||
return r;
|
||||
}
|
||||
|
||||
static void
|
||||
create_iname_hint(const char *dname, char *hint) {
|
||||
//Requires: size of hint array must be > strlen(dname)
|
||||
|
@ -4180,7 +4195,11 @@ create_iname_hint(const char *dname, char *hint) {
|
|||
BOOL underscored = FALSE;
|
||||
while (*dname) {
|
||||
if (isalnum(*dname)) {
|
||||
*hint++ = *dname++;
|
||||
char c = *dname++;
|
||||
if (isupper(c) || islower(c)) {
|
||||
c = rot13(c);
|
||||
}
|
||||
*hint++ = c;
|
||||
underscored = FALSE;
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Add table
Reference in a new issue