const float duration = LoadDataFromAccessors<float>(path, input, output, inputDataBuffer, outputDataBuffer);
char weightNameBuffer[32];
- char* const pWeightName = weightNameBuffer + sprintf(weightNameBuffer, "%s[", BLEND_SHAPE_WEIGHTS_UNIFORM.c_str());
+ auto prefixSize = snprintf(weightNameBuffer, sizeof(weightNameBuffer), "%s[", BLEND_SHAPE_WEIGHTS_UNIFORM.c_str());
+ char* const pWeightName = weightNameBuffer + prefixSize;
+ const auto remainingSize = sizeof(weightNameBuffer) - prefixSize;
for (uint32_t weightIndex = 0u, endWeightIndex = channel.mSampler->mOutput->mCount / channel.mSampler->mInput->mCount; weightIndex < endWeightIndex; ++weightIndex)
{
AnimatedProperty& animatedProperty = properties[propertyIndex++];
animatedProperty.mNodeName = nodeName;
- sprintf(pWeightName, "%d]", weightIndex);
+ snprintf(pWeightName, remainingSize, "%d]", weightIndex);
animatedProperty.mPropertyName = std::string(weightNameBuffer);
animatedProperty.mKeyFrames = KeyFrames::New();
void MeshDefinition::Blob::ApplyMinMax(const std::vector<float>& min, const std::vector<float>& max,
uint32_t count, float* values)
{
- DALI_ASSERT_DEBUG(max.empty() || max.size() == min.size());
+ DALI_ASSERT_DEBUG(max.size() == min.size() || max.size() * min.size() == 0);
const auto numComponents = std::max(min.size(), max.size());
using ClampFn = void(*)(const float*, const float*, uint32_t, float&);
thread_local char sExceptionFlingerMessageBuffer[ExceptionFlinger::MESSAGE_BUFFER_SIZE]{};
}
-char* ExceptionFlinger::GetMessageBuffer()
+char* ExceptionFlinger::GetMessageBuffer() noexcept(true)
{
return sExceptionFlingerMessageBuffer;
}
class DALI_SCENE_LOADER_API StreamBuffer : public std::basic_streambuf<char>
{
public:
- StreamBuffer(char* buffer, size_t size)
+ StreamBuffer(char* buffer, size_t size) noexcept(true)
{
setp(buffer, buffer + size);
}
public:
enum { MESSAGE_BUFFER_SIZE = 512 };
- ExceptionFlinger(const char* location)
+ ExceptionFlinger(const char* location) noexcept(true)
: mLocation(location),
mStreamBuffer(GetMessageBuffer(), MESSAGE_BUFFER_SIZE - 1),
mStream(&mStreamBuffer)
{}
+ [[noreturn]]
~ExceptionFlinger() noexcept(false)
{
operator<<('\0');
}
template <typename T>
- ExceptionFlinger& operator<<(const T& rhs)
+ ExceptionFlinger& operator<<(const T& rhs) noexcept(true)
{
mStream << rhs;
return *this;
}
private:
- static char* GetMessageBuffer();
+ static char* GetMessageBuffer() noexcept(true);
const char* mLocation;
StreamBuffer mStreamBuffer;