mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-22 10:16:30 +00:00
Fix StrCaseStr result
This commit is contained in:
parent
95400a6971
commit
b284caa1fa
@ -515,12 +515,12 @@ char* UpperCase_P(char* dest, const char* source)
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* StrCaseStr_P(const char* source, const char* search) {
|
bool StrCaseStr_P(const char* source, const char* search) {
|
||||||
char case_source[strlen_P(source) +1];
|
char case_source[strlen_P(source) +1];
|
||||||
UpperCase_P(case_source, source);
|
UpperCase_P(case_source, source);
|
||||||
char case_search[strlen_P(search) +1];
|
char case_search[strlen_P(search) +1];
|
||||||
UpperCase_P(case_search, search);
|
UpperCase_P(case_search, search);
|
||||||
return strstr(case_source, case_search);
|
return (strstr(case_source, case_search) != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* Trim(char* p)
|
char* Trim(char* p)
|
||||||
@ -1411,7 +1411,7 @@ bool ValidTemplate(const char *search) {
|
|||||||
|
|
||||||
return (strstr(template_name, search_name) != nullptr);
|
return (strstr(template_name, search_name) != nullptr);
|
||||||
*/
|
*/
|
||||||
return (StrCaseStr_P(SettingsText(SET_TEMPLATE_NAME), search) != nullptr);
|
return StrCaseStr_P(SettingsText(SET_TEMPLATE_NAME), search);
|
||||||
}
|
}
|
||||||
|
|
||||||
String AnyModuleName(uint32_t index)
|
String AnyModuleName(uint32_t index)
|
||||||
@ -1657,7 +1657,7 @@ bool JsonTemplate(char* dataBuf)
|
|||||||
|
|
||||||
val = root[PSTR(D_JSON_CMND)];
|
val = root[PSTR(D_JSON_CMND)];
|
||||||
if (val) {
|
if (val) {
|
||||||
if ((USER_MODULE == Settings.module) || (StrCaseStr_P(val.getStr(), PSTR(D_CMND_MODULE " 0")))) { // Only execute if current module = USER_MODULE = this template
|
if ((USER_MODULE == Settings.module) || StrCaseStr_P(val.getStr(), PSTR(D_CMND_MODULE " 0"))) { // Only execute if current module = USER_MODULE = this template
|
||||||
char* backup_data = XdrvMailbox.data;
|
char* backup_data = XdrvMailbox.data;
|
||||||
XdrvMailbox.data = (char*)val.getStr(); // Backlog commands
|
XdrvMailbox.data = (char*)val.getStr(); // Backlog commands
|
||||||
ReplaceChar(XdrvMailbox.data, '|', ';'); // Support '|' as command separator for JSON backwards compatibility
|
ReplaceChar(XdrvMailbox.data, '|', ';'); // Support '|' as command separator for JSON backwards compatibility
|
||||||
|
Loading…
x
Reference in New Issue
Block a user