fix: shell autotab extend to save 95 visible character

This commit is contained in:
Alex Duan 2023-12-21 17:46:38 +08:00
parent d90bc639dc
commit bcb3518622
2 changed files with 3 additions and 3 deletions

View File

@ -19,8 +19,8 @@
//
// The prefix search tree is a efficient storage words and search words tree, it support 95 visible ascii code character
//
#define FIRST_ASCII 40 // first visible char is '0'
#define LAST_ASCII 122 // last visilbe char is 'z'
#define FIRST_ASCII 32 // first visible char is '0'
#define LAST_ASCII 126 // last visilbe char is 'z'
// capacity save char is 95
#define CHAR_CNT (LAST_ASCII - FIRST_ASCII + 1)

View File

@ -95,7 +95,7 @@ bool insertToTree(STire* tire, char* word, int len) {
STireNode** nodes = tire->root.d;
for (int i = 0; i < len; i++) {
m = word[i] - FIRST_ASCII;
if (m < 0 || m > CHAR_CNT) {
if (m < 0 || m >= CHAR_CNT) {
return false;
}