Avoid potential UB in loggers using composition

This cast would work fine, but any other fields added to those loggers
would be left uninitialized.
This commit is contained in:
Robbert van der Helm
2020-12-04 18:52:33 +01:00
parent c1e7f53cd0
commit 426231a22b
9 changed files with 76 additions and 22 deletions
+18 -2
View File
@@ -19,9 +19,25 @@
#include "common.h"
/**
* Provides VST3-specific logging functionality for debugging plugins.
* Wraps around `Logger` to provide VST3 specific logging functionality for
* debugging plugins. This way we can have all the complex initialisation be
* performed in one place.
*/
class Vst3Logger : public Logger {
class Vst3Logger {
public:
Vst3Logger(Logger& generic_logger);
/**
* @see Logger::log
*/
inline void log(const std::string& message) { logger.log(message); }
/**
* @see Logger::log_trace
*/
inline void log_trace(const std::string& message) { logger.log(message); }
// TODO: Logging interface for VST3 plugins
Logger& logger;
};