DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit 8c4e45d4a773a2fa5ccfa9255e23270c9b2a6583
parent c8f0fdec1fcd139ba51732ef99a7b57b3fd2d1d4
Author: falkTX <falktx@gmail.com>
Date:   Mon,  4 Jan 2016 23:36:43 +0000

Allow pre-allocated buffer in String class

Diffstat:
Mdistrho/extra/String.hpp | 13+++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/distrho/extra/String.hpp b/distrho/extra/String.hpp @@ -54,11 +54,20 @@ public: /* * Simple char string. */ - explicit String(char* const strBuf) noexcept + explicit String(char* const strBuf, const bool copyData = true) noexcept : fBuffer(_null()), fBufferLen(0) { - _dup(strBuf); + if (copyData || strBuf == nullptr) + { + _dup(strBuf); + } + else + { + fBuffer = strBuf; + fBufferLen = std::strlen(strBuf); + } + } /*