From be2eb3f760d25a21903eb31a6558e170ef8a4b3d Mon Sep 17 00:00:00 2001 From: Michael Sandstedt Date: Wed, 15 Jun 2022 12:15:56 -0500 Subject: [PATCH] make DefaultStorageKeyAllocator::Format protected so the class can be extended If integrating the matter PersistentStorageDelegate into an out-of-tree implementation, it is useful to extend DefaultStorageKeyAllocator to make it clear to maintainers that there is a single, shared key space and that keys must avoid collision with those used in the sdk. However, extending the PersistentStorageDelegate class is awkward because the Format method is private. Make it protected to streamline extending the class. --- src/lib/support/DefaultStorageKeyAllocator.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/support/DefaultStorageKeyAllocator.h b/src/lib/support/DefaultStorageKeyAllocator.h index efddd0f1f743f6..d87f61bb5b501f 100644 --- a/src/lib/support/DefaultStorageKeyAllocator.h +++ b/src/lib/support/DefaultStorageKeyAllocator.h @@ -114,7 +114,7 @@ class DefaultStorageKeyAllocator // Event number counter. const char * IMEventNumber() { return Format("g/im/ec"); } -private: +protected: // The ENFORCE_FORMAT args are "off by one" because this is a class method, // with an implicit "this" as first arg. const char * ENFORCE_FORMAT(2, 3) Format(const char * format, ...) @@ -126,6 +126,7 @@ class DefaultStorageKeyAllocator return mKeyName; } +private: char mKeyName[PersistentStorageDelegate::kKeyLengthMax + 1] = { 0 }; };