Limit the number of macros to 255

This commit is contained in:
Eric Tang
2017-08-09 11:13:52 -07:00
parent 558089f856
commit b0b659940d
5 changed files with 5 additions and 5 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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

View File

@@ -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;

View File

@@ -7,7 +7,7 @@
// Macros: // Macros:
#define MAX_MACRO_NUM 1024 #define MAX_MACRO_NUM 255
// Typedefs: // Typedefs: