diff --git a/src/App/PropertyStandard.cpp b/src/App/PropertyStandard.cpp index b7695b8163..09c8c489d0 100644 --- a/src/App/PropertyStandard.cpp +++ b/src/App/PropertyStandard.cpp @@ -3215,8 +3215,8 @@ void PropertyMaterialList::RestoreDocFileV3(Base::Reader& reader) uint32_t count = 0; str >> count; std::vector values(count); - uint32_t value; // must be 32 bit long - float valueF; + uint32_t value {}; // must be 32 bit long + float valueF {}; for (auto& it : values) { str >> value; it.ambientColor.setPackedValue(value); @@ -3239,18 +3239,14 @@ void PropertyMaterialList::RestoreDocFileV3(Base::Reader& reader) setValues(values); } -void PropertyMaterialList::readString(Base::InputStream& str, - std::string& value) +void PropertyMaterialList::readString(Base::InputStream& str, std::string& value) { - uint32_t uCt; + uint32_t uCt {}; str >> uCt; - char *temp = new char[uCt]; - - str.read(temp, uCt); - value.assign(temp, static_cast(uCt)); - - delete [] temp; + std::vector temp(uCt); + str.read(temp.data(), uCt); + value.assign(temp.data(), temp.size()); } const char* PropertyMaterialList::getEditorName() const