Addresses feedback from PR review

Change DeepCopyNode utility to return a unique_ptr, fix up some
string/path usages to avoid temporaries, etc.

Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
This commit is contained in:
amzn-phist
2021-07-23 11:29:47 -05:00
parent 91dcbe7fed
commit d385f6ed99
6 changed files with 18 additions and 26 deletions
@@ -352,19 +352,13 @@ namespace AudioControls
{
if (node && control && m_audioSystemImpl)
{
TXmlNodeList otherNodes = control->m_connectionNodes;
auto end = AZStd::remove_if(
otherNodes.begin(), otherNodes.end(),
[](const SRawConnectionData& connection)
{
return connection.m_isValid;
}
);
otherNodes.erase(end, otherNodes.end());
for (auto& connectionNode : otherNodes)
for (auto& connectionNode : control->m_connectionNodes)
{
node->append_node(SRawConnectionData::DeepCopyNode(connectionNode.m_xmlNode));
if (!connectionNode.m_isValid)
{
auto nodeCopy = SRawConnectionData::DeepCopyNode(connectionNode.m_xmlNode.get());
node->append_node(nodeCopy.release());
}
}
const size_t size = control->ConnectionCount();
@@ -391,7 +385,7 @@ namespace AudioControls
IFileUtil* fileUtil = editor ? editor->GetFileUtil() : nullptr;
if (fileUtil)
{
fileUtil->CheckoutFile(filepath.data(), nullptr);
fileUtil->CheckoutFile(AZ::IO::FixedMaxPath{ filepath }.c_str(), nullptr);
}
}
@@ -402,7 +396,7 @@ namespace AudioControls
IFileUtil* fileUtil = editor ? editor->GetFileUtil() : nullptr;
if (fileUtil)
{
fileUtil->DeleteFromSourceControl(filepath.data(), nullptr);
fileUtil->DeleteFromSourceControl(AZ::IO::FixedMaxPath{ filepath }.c_str(), nullptr);
}
}