Revision | 4478a7f10eac5af91142e513174a127abcaba572 (tree) |
---|---|
Time | 2021-09-13 19:08:18 |
Author | Simon Sobisch <simonsobisch@web....> |
Commiter | GitHub |
compiler-calculated maximum value for m_SourceDefs (#966)
removing the need to manually adjust the size when TextType is adjusted
@@ -68,7 +68,7 @@ struct TEXTBLOCK | ||
68 | 68 | |
69 | 69 | typedef enum |
70 | 70 | { |
71 | - SRC_PLAIN, | |
71 | + SRC_PLAIN = 0, | |
72 | 72 | SRC_ASP, |
73 | 73 | SRC_AUTOIT, |
74 | 74 | SRC_BASIC, |
@@ -108,7 +108,8 @@ typedef enum | ||
108 | 108 | SRC_TEX, |
109 | 109 | SRC_VERILOG, |
110 | 110 | SRC_VHDL, |
111 | - SRC_XML | |
111 | + SRC_XML, | |
112 | + SRC_MAX_ENTRY /* always last entry, used for bound checking */ | |
112 | 113 | } |
113 | 114 | TextType; |
114 | 115 |
@@ -129,7 +130,7 @@ struct TextDefinition | ||
129 | 130 | unsigned encoding; |
130 | 131 | }; |
131 | 132 | |
132 | -extern TextDefinition m_SourceDefs[41]; | |
133 | +extern TextDefinition m_SourceDefs[SRC_MAX_ENTRY]; | |
133 | 134 | |
134 | 135 | bool IsXKeyword(const TCHAR *pszKey, size_t nKeyLen, const TCHAR *pszKeywordList[], size_t nKeywordListCount, int(*compare)(const TCHAR *, const TCHAR *, size_t)); |
135 | 136 | bool IsXNumber(const TCHAR* pszChars, int nLength); |