Harden DFTE rendering and placeholder registration to fail safely under stalled and invalid inputs.

Add regression coverage and docs updates so these edge cases stay stable across board test runs.
This commit is contained in:
2026-04-16 13:48:25 +10:00
parent 416ab74238
commit 73fdd28f74
12 changed files with 262 additions and 38 deletions
+1 -1
View File
@@ -127,7 +127,7 @@ public:
static size_t getDynamicTemplateLength(const DynamicTemplateDescriptor* descriptor, const char* templateData);
private:
static constexpr uint16_t MAX_PLACEHOLDER_NAME_SIZE = DFTE_PLACEHOLDER_NAME_SIZE_DEFAULT;
static constexpr uint16_t MAX_PLACEHOLDER_NAME_SIZE = DFTE_PLACEHOLDER_NAME_SIZE;
PlaceholderEntry* placeholders; // Dynamically allocated array
uint16_t maxPlaceholders; // Configurable size
+5 -1
View File
@@ -87,11 +87,15 @@ struct PlaceholderEntry {
PlaceholderType type;
const void* data;
PlaceholderLengthGetter getLength;
size_t cachedLength;
bool hasCachedLength;
PlaceholderEntry()
: type(PlaceholderType::RAM_DATA),
data(nullptr),
getLength(nullptr) {
getLength(nullptr),
cachedLength(0),
hasCachedLength(false) {
name[0] = '\0';
}
};
-7
View File
@@ -44,12 +44,5 @@ using TemplateRenderer = DeviceFrameworkTemplateRenderer;
using TemplateContext = DeviceFrameworkTemplateContext;
using PlaceholderRegistry = DeviceFrameworkPlaceholderRegistry;
// Use new type names
using PlaceholderType = PlaceholderType;
using PlaceholderEntry = PlaceholderEntry;
using RenderingContextType = RenderingContextType;
using RenderingContext = RenderingContext;
using TemplateRenderState = TemplateRenderState;
#endif // TEMPLATE_ENGINE_H