Browse Source

msvc: give the temporary buffer a fixed size

pull/278/head
Jean Pierre Cimalando 4 years ago
parent
commit
a4065321a0
1 changed files with 5 additions and 3 deletions
  1. +5
    -3
      distrho/extra/String.hpp

+ 5
- 3
distrho/extra/String.hpp View File

@@ -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;
}



Loading…
Cancel
Save