From 69ade7d1c62b9b2786dd09f1fceae3614dcc6ea9 Mon Sep 17 00:00:00 2001 From: Geoff McLane Date: Tue, 24 Nov 2020 20:19:57 +0100 Subject: [PATCH] Fix attr def table to match enum Error made when merging LOADING Is. #879, PR #902 And merging SLOT PR #848 Also added a BIG warning over attribute_defs table to try to avoid this in future. --- src/attrs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/attrs.c b/src/attrs.c index 13c2668..426a5b6 100644 --- a/src/attrs.c +++ b/src/attrs.c @@ -102,6 +102,11 @@ static AttrCheck CheckSvgAttr; #define CH_DECIMAL CheckDecimal #define CH_SVG CheckSvgAttr +/* + WARNING: This table /must/ be kept in the EXACT order of the TidyAttrId enum! + When running the DEBUG version, this order is checked, in TY_(InitAttrs)(doc), + and there is an assert() if any difference found. +*/ static const Attribute attribute_defs [] = { { TidyAttr_UNKNOWN, "unknown!", NULL }, @@ -183,7 +188,6 @@ static const Attribute attribute_defs [] = { TidyAttr_LAST_VISIT, "last_visit", CH_PCDATA }, /* A */ { TidyAttr_LEFTMARGIN, "leftmargin", CH_NUMBER }, /* used on BODY */ { TidyAttr_LINK, "link", CH_COLOR }, /* BODY */ - { TidyAttr_LOADING, "loading", CH_LOADING }, /* IMG, IFRAME */ { TidyAttr_LONGDESC, "longdesc", CH_URL }, /* IMG */ { TidyAttr_LOWSRC, "lowsrc", CH_URL }, /* IMG */ { TidyAttr_MARGINHEIGHT, "marginheight", CH_NUMBER }, /* FRAME, IFRAME, BODY */ @@ -245,7 +249,6 @@ static const Attribute attribute_defs [] = { TidyAttr_SHOWGRIDX, "showgridx", CH_BOOL }, /* TABLE Adobe golive*/ { TidyAttr_SHOWGRIDY, "showgridy", CH_BOOL }, /* TABLE Adobe golive*/ { TidyAttr_SIZE, "size", CH_NUMBER }, /* HR, FONT, BASEFONT, SELECT */ - { TidyAttr_SLOT, "slot", CH_PCDATA }, { TidyAttr_SPAN, "span", CH_NUMBER }, /* COL, COLGROUP */ { TidyAttr_SRC, "src", CH_URL }, /* IMG, FRAME, IFRAME */ { TidyAttr_SRCSET, "srcset", CH_PCDATA }, /* IMG (HTML5) */ @@ -447,6 +450,8 @@ static const Attribute attribute_defs [] = /* for xmlns:xlink in */ { TidyAttr_XMLNSXLINK, "xmlns:xlink", CH_URL }, + { TidyAttr_SLOT, "slot", CH_PCDATA }, + { TidyAttr_LOADING, "loading", CH_LOADING }, /* IMG, IFRAME */ /* SVG paint attributes (SVG 1.1) */ { TidyAttr_FILL, "fill", CH_SVG },