Add feedback from PVS (static code analyzer)
https://pvs-studio.com/en/blog/posts/cpp/1153/
This commit is contained in:
@@ -80,7 +80,7 @@ namespace FlaxEditor.Content
|
|||||||
// Translate asset type name
|
// Translate asset type name
|
||||||
var typeName = TypeName;
|
var typeName = TypeName;
|
||||||
string[] typeNamespaces = typeName.Split('.');
|
string[] typeNamespaces = typeName.Split('.');
|
||||||
if (typeNamespaces.Length != 0 && typeNamespaces.Length != 0)
|
if (typeNamespaces.Length != 0 && typeNamespaces[typeNamespaces.Length - 1].Length != 0)
|
||||||
{
|
{
|
||||||
typeName = Utilities.Utils.GetPropertyNameUI(typeNamespaces[typeNamespaces.Length - 1]);
|
typeName = Utilities.Utils.GetPropertyNameUI(typeNamespaces[typeNamespaces.Length - 1]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace FlaxEditor.GUI.Dialogs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The parent window.
|
/// The parent window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Window _window;
|
protected volatile Window _window;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The dialog result.
|
/// The dialog result.
|
||||||
|
|||||||
@@ -492,7 +492,7 @@ namespace FlaxEditor.Surface
|
|||||||
Focus();
|
Focus();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (_rightMouseDown || (_middleMouseDown && _middleMouseDown))
|
if (_rightMouseDown || _middleMouseDown)
|
||||||
{
|
{
|
||||||
// Start navigating
|
// Start navigating
|
||||||
StartMouseCapture();
|
StartMouseCapture();
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ namespace FlaxEditor.Utilities
|
|||||||
value = Convert.ToInt32(value);
|
value = Convert.ToInt32(value);
|
||||||
else if (type.Type == typeof(long))
|
else if (type.Type == typeof(long))
|
||||||
value = Convert.ToInt64(value);
|
value = Convert.ToInt64(value);
|
||||||
else if (type.Type == typeof(int))
|
else if (type.Type == typeof(ushort))
|
||||||
value = Convert.ToUInt16(value);
|
value = Convert.ToUInt16(value);
|
||||||
else if (type.Type == typeof(uint))
|
else if (type.Type == typeof(uint))
|
||||||
value = Convert.ToUInt32(value);
|
value = Convert.ToUInt32(value);
|
||||||
|
|||||||
@@ -662,13 +662,13 @@ bool FlaxStorage::LoadAssetChunk(FlaxChunk* chunk)
|
|||||||
if (!failed)
|
if (!failed)
|
||||||
{
|
{
|
||||||
stream->SetPosition(chunk->LocationInFile.Address);
|
stream->SetPosition(chunk->LocationInFile.Address);
|
||||||
|
if (!stream->HasError())
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (!stream->HasError())
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream->HasError())
|
if (!stream || stream->HasError())
|
||||||
{
|
{
|
||||||
failed = true;
|
failed = true;
|
||||||
UnlockChunks();
|
UnlockChunks();
|
||||||
|
|||||||
@@ -94,8 +94,8 @@ namespace FlaxEngine
|
|||||||
throw new ArgumentOutOfRangeException(nameof(values), "There must be sixteen and only four input values for Matrix2x2.");
|
throw new ArgumentOutOfRangeException(nameof(values), "There must be sixteen and only four input values for Matrix2x2.");
|
||||||
M11 = values[0];
|
M11 = values[0];
|
||||||
M12 = values[1];
|
M12 = values[1];
|
||||||
M21 = values[3];
|
M21 = values[2];
|
||||||
M22 = values[4];
|
M22 = values[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -324,15 +324,14 @@ public:
|
|||||||
{
|
{
|
||||||
if (length <= 0)
|
if (length <= 0)
|
||||||
return;
|
return;
|
||||||
if (Base::Length() == 0)
|
auto prev = Base::_data;
|
||||||
|
const auto prevLength = Base::_length;
|
||||||
|
if (prevLength == 0 || prev == nullptr)
|
||||||
{
|
{
|
||||||
Copy(data, length);
|
Copy(data, length);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto prev = Base::_data;
|
|
||||||
const auto prevLength = Base::_length;
|
|
||||||
|
|
||||||
Base::_length = prevLength + length;
|
Base::_length = prevLength + length;
|
||||||
Base::_data = (T*)Allocator::Allocate(Base::_length * sizeof(T));
|
Base::_data = (T*)Allocator::Allocate(Base::_length * sizeof(T));
|
||||||
|
|
||||||
|
|||||||
@@ -2702,8 +2702,8 @@ void Variant::SetAsset(Asset* asset)
|
|||||||
SetType(VariantType(VariantType::Asset));
|
SetType(VariantType(VariantType::Asset));
|
||||||
if (AsAsset)
|
if (AsAsset)
|
||||||
{
|
{
|
||||||
asset->OnUnloaded.Unbind<Variant, &Variant::OnAssetUnloaded>(this);
|
AsAsset->OnUnloaded.Unbind<Variant, &Variant::OnAssetUnloaded>(this);
|
||||||
asset->RemoveReference();
|
AsAsset->RemoveReference();
|
||||||
}
|
}
|
||||||
AsAsset = asset;
|
AsAsset = asset;
|
||||||
if (asset)
|
if (asset)
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace FlaxEngine.GUI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Hide()
|
public void Hide()
|
||||||
{
|
{
|
||||||
_window.Show();
|
_window.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user