Limit the number of macros to 255
This commit is contained in:
@@ -41,7 +41,7 @@ parser_error_t ParseConfig(config_buffer_t *buffer)
|
|||||||
if (macroCount > MAX_MACRO_NUM) {
|
if (macroCount > MAX_MACRO_NUM) {
|
||||||
return ParserError_InvalidMacroCount;
|
return ParserError_InvalidMacroCount;
|
||||||
}
|
}
|
||||||
for (uint16_t macroIdx = 0; macroIdx < macroCount; macroIdx++) {
|
for (uint8_t macroIdx = 0; macroIdx < macroCount; macroIdx++) {
|
||||||
errorCode = ParseMacro(buffer, macroIdx);
|
errorCode = ParseMacro(buffer, macroIdx);
|
||||||
if (errorCode != ParserError_Success) {
|
if (errorCode != ParserError_Success) {
|
||||||
return errorCode;
|
return errorCode;
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ parser_error_t parseMacroAction(config_buffer_t *buffer) {
|
|||||||
return ParserError_InvalidSerializedMacroActionType;
|
return ParserError_InvalidSerializedMacroActionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
parser_error_t ParseMacro(config_buffer_t *buffer, uint16_t macroIdx) {
|
parser_error_t ParseMacro(config_buffer_t *buffer, uint8_t macroIdx) {
|
||||||
uint16_t offset = buffer->offset;
|
uint16_t offset = buffer->offset;
|
||||||
parser_error_t errorCode;
|
parser_error_t errorCode;
|
||||||
uint16_t nameLen;
|
uint16_t nameLen;
|
||||||
|
|||||||
@@ -20,6 +20,6 @@
|
|||||||
|
|
||||||
// Functions:
|
// Functions:
|
||||||
|
|
||||||
parser_error_t ParseMacro(config_buffer_t *buffer, uint16_t macroIdx);
|
parser_error_t ParseMacro(config_buffer_t *buffer, uint8_t macroIdx);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -92,7 +92,7 @@
|
|||||||
uint8_t keymapId;
|
uint8_t keymapId;
|
||||||
} __attribute__ ((packed)) switchKeymap;
|
} __attribute__ ((packed)) switchKeymap;
|
||||||
struct {
|
struct {
|
||||||
uint16_t macroId;
|
uint8_t macroId;
|
||||||
} __attribute__ ((packed)) playMacro;
|
} __attribute__ ((packed)) playMacro;
|
||||||
struct {
|
struct {
|
||||||
test_action_t testAction;
|
test_action_t testAction;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
// Macros:
|
// Macros:
|
||||||
|
|
||||||
#define MAX_MACRO_NUM 1024
|
#define MAX_MACRO_NUM 255
|
||||||
|
|
||||||
// Typedefs:
|
// Typedefs:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user