From f15b461612e515ec5e9c6334ff04a2518c3980f1 Mon Sep 17 00:00:00 2001 From: Nick Chambers Date: Wed, 22 Jun 2022 20:25:28 -0500 Subject: [PATCH] Error if an unknown type is detected --- include/gargoyle/codex.h | 2 +- src/scribe.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/gargoyle/codex.h b/include/gargoyle/codex.h index 972a2d0..38cc42d 100644 --- a/include/gargoyle/codex.h +++ b/include/gargoyle/codex.h @@ -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_DBLE = 1 << 2; 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_UNKNOWN_OPT = 1; 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_DBLE = 4; +static const uint8_t GARGOYLE_ERR_UNKNOWN_TYPE = 5; #endif diff --git a/src/scribe.c b/src/scribe.c index cb96972..53ae2b4 100644 --- a/src/scribe.c +++ b/src/scribe.c @@ -33,6 +33,8 @@ uint8_t gargoyle_from_rope(struct gargoyle_opt *opt, const char *brand) { char *val = opt->val; char *end = gargoyle_cpy(val, brand, opt->val_sz - 1); *end = '\0'; + } else { + return GARGOYLE_ERR_UNKNOWN_TYPE; } return 0;