Browse Source

Make malloc usage consistent in CarlaString class

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.5.1
falkTX 2 years ago
parent
commit
1eaa175431
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      source/utils/CarlaString.hpp

+ 3
- 3
source/utils/CarlaString.hpp View File

@@ -813,7 +813,7 @@ public:


const std::size_t strBufLen = std::strlen(strBuf); const std::size_t strBufLen = std::strlen(strBuf);
const std::size_t newBufSize = fBufferLen + strBufLen; const std::size_t newBufSize = fBufferLen + strBufLen;
char* const newBuf = (char*)malloc(newBufSize + 1);
char* const newBuf = (char*)std::malloc(newBufSize + 1);
CARLA_SAFE_ASSERT_RETURN(newBuf != nullptr, CarlaString()); CARLA_SAFE_ASSERT_RETURN(newBuf != nullptr, CarlaString());


std::memcpy(newBuf, fBuffer, fBufferLen); std::memcpy(newBuf, fBuffer, fBufferLen);
@@ -918,7 +918,7 @@ CarlaString operator+(const CarlaString& strBefore, const char* const strBufAfte
const std::size_t strBeforeLen = strBefore.length(); const std::size_t strBeforeLen = strBefore.length();
const std::size_t strBufAfterLen = std::strlen(strBufAfter); const std::size_t strBufAfterLen = std::strlen(strBufAfter);
const std::size_t newBufSize = strBeforeLen + strBufAfterLen; const std::size_t newBufSize = strBeforeLen + strBufAfterLen;
char* const newBuf = (char*)malloc(newBufSize + 1);
char* const newBuf = (char*)std::malloc(newBufSize + 1);
CARLA_SAFE_ASSERT_RETURN(newBuf != nullptr, CarlaString()); CARLA_SAFE_ASSERT_RETURN(newBuf != nullptr, CarlaString());


std::memcpy(newBuf, strBefore.buffer(), strBeforeLen); std::memcpy(newBuf, strBefore.buffer(), strBeforeLen);
@@ -938,7 +938,7 @@ CarlaString operator+(const char* const strBufBefore, const CarlaString& strAfte
const std::size_t strBufBeforeLen = std::strlen(strBufBefore); const std::size_t strBufBeforeLen = std::strlen(strBufBefore);
const std::size_t strAfterLen = strAfter.length(); const std::size_t strAfterLen = strAfter.length();
const std::size_t newBufSize = strBufBeforeLen + strAfterLen; const std::size_t newBufSize = strBufBeforeLen + strAfterLen;
char* const newBuf = (char*)malloc(newBufSize + 1);
char* const newBuf = (char*)std::malloc(newBufSize + 1);
CARLA_SAFE_ASSERT_RETURN(newBuf != nullptr, CarlaString()); CARLA_SAFE_ASSERT_RETURN(newBuf != nullptr, CarlaString());


std::memcpy(newBuf, strBufBefore, strBufBeforeLen); std::memcpy(newBuf, strBufBefore, strBufBeforeLen);


Loading…
Cancel
Save