Error if an unknown type is detected
This commit is contained in:
parent
8ea191c696
commit
f15b461612
2 changed files with 3 additions and 1 deletions
|
@ -7,12 +7,12 @@ static const uint8_t GARGOYLE_TYPE_BOOL = 1 << 0;
|
||||||
static const uint8_t GARGOYLE_TYPE_UINT = 1 << 1;
|
static const uint8_t GARGOYLE_TYPE_UINT = 1 << 1;
|
||||||
static const uint8_t GARGOYLE_TYPE_DBLE = 1 << 2;
|
static const uint8_t GARGOYLE_TYPE_DBLE = 1 << 2;
|
||||||
static const uint8_t GARGOYLE_TYPE_ROPE = 1 << 3;
|
static const uint8_t GARGOYLE_TYPE_ROPE = 1 << 3;
|
||||||
static const uint8_t GARGOYLE_TYPE_FILE = 1 << 4;
|
|
||||||
|
|
||||||
static const uint8_t GARGOYLE_ERR_SUCCESS = 0;
|
static const uint8_t GARGOYLE_ERR_SUCCESS = 0;
|
||||||
static const uint8_t GARGOYLE_ERR_UNKNOWN_OPT = 1;
|
static const uint8_t GARGOYLE_ERR_UNKNOWN_OPT = 1;
|
||||||
static const uint8_t GARGOYLE_ERR_VALUE_REQUIRED = 2;
|
static const uint8_t GARGOYLE_ERR_VALUE_REQUIRED = 2;
|
||||||
static const uint8_t GARGOYLE_ERR_INVALID_UINT = 3;
|
static const uint8_t GARGOYLE_ERR_INVALID_UINT = 3;
|
||||||
static const uint8_t GARGOYLE_ERR_INVALID_DBLE = 4;
|
static const uint8_t GARGOYLE_ERR_INVALID_DBLE = 4;
|
||||||
|
static const uint8_t GARGOYLE_ERR_UNKNOWN_TYPE = 5;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -33,6 +33,8 @@ uint8_t gargoyle_from_rope(struct gargoyle_opt *opt, const char *brand) {
|
||||||
char *val = opt->val;
|
char *val = opt->val;
|
||||||
char *end = gargoyle_cpy(val, brand, opt->val_sz - 1);
|
char *end = gargoyle_cpy(val, brand, opt->val_sz - 1);
|
||||||
*end = '\0';
|
*end = '\0';
|
||||||
|
} else {
|
||||||
|
return GARGOYLE_ERR_UNKNOWN_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue