DPF

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

commit a4065321a0906c755a6ce9d1f49b865c9032322c
parent fb72b8610b0dc1ec25aa7d4a25196111c2dbe6ca
Author: Jean Pierre Cimalando <jp-dev@inbox.ru>
Date:   Mon, 24 May 2021 18:56:45 +0200

msvc: give the temporary buffer a fixed size

Diffstat:
Mdistrho/extra/String.hpp | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/distrho/extra/String.hpp b/distrho/extra/String.hpp @@ -656,14 +656,18 @@ public: "abcdefghijklmnopqrstuvwxyz" "0123456789+/"; +#ifndef _MSC_VER const std::size_t kTmpBufSize = std::min(d_nextPowerOf2(static_cast<uint32_t>(dataSize/3)), 65536U); +#else + constexpr std::size_t kTmpBufSize = 65536U; +#endif const uchar* bytesToEncode((const uchar*)data); uint i=0, j=0; uint charArray3[3], charArray4[4]; - char* strBuf = (char*)malloc(kTmpBufSize + 1); + char strBuf[kTmpBufSize + 1]; strBuf[kTmpBufSize] = '\0'; std::size_t strBufIndex = 0; @@ -717,8 +721,6 @@ public: ret += strBuf; } - free(strBuf); - return ret; }