Fix code quality issues detected by PVS-Studio
This commit is contained in:
@@ -61,8 +61,8 @@ namespace GameCookerImpl
|
||||
MMethod* Internal_OnProgress = nullptr;
|
||||
MMethod* Internal_OnCollectAssets = nullptr;
|
||||
|
||||
bool IsRunning = false;
|
||||
bool IsThreadRunning = false;
|
||||
volatile bool IsRunning = false;
|
||||
volatile bool IsThreadRunning = false;
|
||||
int64 CancelFlag = 0;
|
||||
int64 CancelThreadFlag = 0;
|
||||
ConditionVariable ThreadCond;
|
||||
|
||||
@@ -102,7 +102,7 @@ void AnimationsSystem::Execute(TaskGraph* graph)
|
||||
UnscaledTime = tickData.UnscaledTime.GetTotalSeconds();
|
||||
|
||||
#if USE_EDITOR
|
||||
// If debug flow is registered, then warm it up (eg. static cached method inside DebugFlow_ManagedWrapper) so it doesn;'t crash on highly multi-threaded code
|
||||
// If debug flow is registered, then warm it up (eg. static cached method inside DebugFlow_ManagedWrapper) so it doesn't crash on highly multi-threaded code
|
||||
if (Animations::DebugFlow.IsBinded())
|
||||
Animations::DebugFlow(nullptr, nullptr, 0, 0);
|
||||
#endif
|
||||
|
||||
@@ -131,10 +131,6 @@ Asset::LoadResult SceneAnimation::load()
|
||||
auto& track = Tracks[i];
|
||||
|
||||
track.Type = (Track::Types)stream.ReadByte();
|
||||
// [Deprecated on 13.07.2019 expires on 13.11.2019]
|
||||
if (version == 6184 || version == 6183)
|
||||
track.Flag = Track::Flags::None;
|
||||
else
|
||||
track.Flag = (Track::Flags)stream.ReadByte();
|
||||
stream.ReadInt32(&track.ParentIndex);
|
||||
stream.ReadInt32(&track.ChildrenCount);
|
||||
|
||||
@@ -267,13 +267,8 @@ void SceneAnimationPlayer::Restore(SceneAnimation* anim, int32 stateIndexOffset)
|
||||
switch (track.Type)
|
||||
{
|
||||
case SceneAnimation::Track::Types::Actor:
|
||||
case SceneAnimation::Track::Types::CameraCut:
|
||||
{
|
||||
auto& state = _tracks[stateIndexOffset + track.TrackStateIndex];
|
||||
state.ManagedObject = state.Object ? state.Object.GetOrCreateManagedInstance() : nullptr;
|
||||
break;
|
||||
}
|
||||
case SceneAnimation::Track::Types::Script:
|
||||
case SceneAnimation::Track::Types::CameraCut:
|
||||
{
|
||||
auto& state = _tracks[stateIndexOffset + track.TrackStateIndex];
|
||||
state.ManagedObject = state.Object ? state.Object.GetOrCreateManagedInstance() : nullptr;
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
// [ThreadPoolTask]
|
||||
bool HasReference(Object* resource) const override
|
||||
{
|
||||
return _asset == resource || (_asset && _asset == resource);
|
||||
return _asset == resource;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
// [ThreadPoolTask]
|
||||
bool HasReference(Object* resource) const override
|
||||
{
|
||||
return _asset == resource || (_asset && _asset == resource);
|
||||
return _asset == resource;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -61,6 +61,17 @@ public:
|
||||
|
||||
T* Value;
|
||||
|
||||
ScopeCache() = delete;
|
||||
ScopeCache(const ScopeCache& other) = delete;
|
||||
ScopeCache& operator=(const ScopeCache& other) = delete;
|
||||
ScopeCache& operator=(ScopeCache&& other) noexcept = delete;
|
||||
|
||||
ScopeCache(ScopeCache&& other) noexcept
|
||||
{
|
||||
Value = other.Value;
|
||||
other.Value = nullptr;
|
||||
}
|
||||
|
||||
~ScopeCache()
|
||||
{
|
||||
_pool->Release(Value);
|
||||
|
||||
@@ -123,7 +123,7 @@ public:
|
||||
/// Sets the size of the box.
|
||||
/// </summary>
|
||||
/// <param name="value">The box size to set.</param>
|
||||
void SetSize(const Vector3 value)
|
||||
void SetSize(const Vector3& value)
|
||||
{
|
||||
Vector3 center;
|
||||
GetCenter(center);
|
||||
|
||||
@@ -1221,61 +1221,54 @@ ContainmentType CollisionsHelper::SphereContainsBox(const BoundingSphere& sphere
|
||||
if (!BoxIntersectsSphere(box, sphere))
|
||||
return ContainmentType::Disjoint;
|
||||
|
||||
const float radiussquared = sphere.Radius * sphere.Radius;
|
||||
const float radiusSquared = sphere.Radius * sphere.Radius;
|
||||
|
||||
vector.X = sphere.Center.X - box.Minimum.X;
|
||||
vector.Y = sphere.Center.Y - box.Maximum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Maximum.Z;
|
||||
|
||||
if (vector.LengthSquared() > radiussquared)
|
||||
if (vector.LengthSquared() > radiusSquared)
|
||||
return ContainmentType::Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Maximum.X;
|
||||
vector.Y = sphere.Center.Y - box.Maximum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Maximum.Z;
|
||||
|
||||
if (vector.LengthSquared() > radiussquared)
|
||||
if (vector.LengthSquared() > radiusSquared)
|
||||
return ContainmentType::Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Maximum.X;
|
||||
vector.Y = sphere.Center.Y - box.Minimum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Maximum.Z;
|
||||
|
||||
if (vector.LengthSquared() > radiussquared)
|
||||
if (vector.LengthSquared() > radiusSquared)
|
||||
return ContainmentType::Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Minimum.X;
|
||||
vector.Y = sphere.Center.Y - box.Minimum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Maximum.Z;
|
||||
|
||||
if (vector.LengthSquared() > radiussquared)
|
||||
if (vector.LengthSquared() > radiusSquared)
|
||||
return ContainmentType::Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Minimum.X;
|
||||
vector.Y = sphere.Center.Y - box.Maximum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Minimum.Z;
|
||||
|
||||
if (vector.LengthSquared() > radiussquared)
|
||||
if (vector.LengthSquared() > radiusSquared)
|
||||
return ContainmentType::Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Maximum.X;
|
||||
vector.Y = sphere.Center.Y - box.Maximum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Minimum.Z;
|
||||
|
||||
if (vector.LengthSquared() > radiussquared)
|
||||
if (vector.LengthSquared() > radiusSquared)
|
||||
return ContainmentType::Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Maximum.X;
|
||||
vector.Y = sphere.Center.Y - box.Minimum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Minimum.Z;
|
||||
|
||||
if (vector.LengthSquared() > radiussquared)
|
||||
if (vector.LengthSquared() > radiusSquared)
|
||||
return ContainmentType::Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Minimum.X;
|
||||
vector.Y = sphere.Center.Y - box.Minimum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Minimum.Z;
|
||||
|
||||
if (vector.LengthSquared() > radiussquared)
|
||||
if (vector.LengthSquared() > radiusSquared)
|
||||
return ContainmentType::Intersects;
|
||||
|
||||
return ContainmentType::Contains;
|
||||
|
||||
@@ -1425,61 +1425,54 @@ namespace FlaxEngine
|
||||
if (!BoxIntersectsSphere(ref box, ref sphere))
|
||||
return ContainmentType.Disjoint;
|
||||
|
||||
float radiussquared = sphere.Radius * sphere.Radius;
|
||||
float radiusSquared = sphere.Radius * sphere.Radius;
|
||||
|
||||
vector.X = sphere.Center.X - box.Minimum.X;
|
||||
vector.Y = sphere.Center.Y - box.Maximum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Maximum.Z;
|
||||
|
||||
if (vector.LengthSquared > radiussquared)
|
||||
if (vector.LengthSquared > radiusSquared)
|
||||
return ContainmentType.Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Maximum.X;
|
||||
vector.Y = sphere.Center.Y - box.Maximum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Maximum.Z;
|
||||
|
||||
if (vector.LengthSquared > radiussquared)
|
||||
if (vector.LengthSquared > radiusSquared)
|
||||
return ContainmentType.Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Maximum.X;
|
||||
vector.Y = sphere.Center.Y - box.Minimum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Maximum.Z;
|
||||
|
||||
if (vector.LengthSquared > radiussquared)
|
||||
if (vector.LengthSquared > radiusSquared)
|
||||
return ContainmentType.Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Minimum.X;
|
||||
vector.Y = sphere.Center.Y - box.Minimum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Maximum.Z;
|
||||
|
||||
if (vector.LengthSquared > radiussquared)
|
||||
if (vector.LengthSquared > radiusSquared)
|
||||
return ContainmentType.Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Minimum.X;
|
||||
vector.Y = sphere.Center.Y - box.Maximum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Minimum.Z;
|
||||
|
||||
if (vector.LengthSquared > radiussquared)
|
||||
if (vector.LengthSquared > radiusSquared)
|
||||
return ContainmentType.Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Maximum.X;
|
||||
vector.Y = sphere.Center.Y - box.Maximum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Minimum.Z;
|
||||
|
||||
if (vector.LengthSquared > radiussquared)
|
||||
if (vector.LengthSquared > radiusSquared)
|
||||
return ContainmentType.Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Maximum.X;
|
||||
vector.Y = sphere.Center.Y - box.Minimum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Minimum.Z;
|
||||
|
||||
if (vector.LengthSquared > radiussquared)
|
||||
if (vector.LengthSquared > radiusSquared)
|
||||
return ContainmentType.Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Minimum.X;
|
||||
vector.Y = sphere.Center.Y - box.Minimum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Minimum.Z;
|
||||
|
||||
if (vector.LengthSquared > radiussquared)
|
||||
if (vector.LengthSquared > radiusSquared)
|
||||
return ContainmentType.Intersects;
|
||||
|
||||
return ContainmentType.Contains;
|
||||
|
||||
@@ -446,7 +446,6 @@ void Mesh::Draw(const RenderContext& renderContext, const DrawInfo& info, float
|
||||
drawCall.Geometry.VertexBuffersOffsets[2] = 0;
|
||||
if (info.VertexColors && info.VertexColors[_lodIndex])
|
||||
{
|
||||
drawCall.Geometry.VertexBuffers[2] = info.VertexColors[_lodIndex];
|
||||
// TODO: cache vertexOffset within the model LOD per-mesh
|
||||
uint32 vertexOffset = 0;
|
||||
for (int32 meshIndex = 0; meshIndex < _index; meshIndex++)
|
||||
|
||||
@@ -154,7 +154,6 @@ bool RenderBuffers::Init(int32 width, int32 height)
|
||||
_aspectRatio = static_cast<float>(width) / height;
|
||||
_viewport = Viewport(0, 0, static_cast<float>(width), static_cast<float>(height));
|
||||
LastEyeAdaptationTime = 0;
|
||||
LastEyeAdaptationTime = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -489,7 +489,6 @@ int32 MipLevelsCount(int32 width, bool useMipLevels)
|
||||
int32 result = 1;
|
||||
while (width > 1)
|
||||
{
|
||||
if (width > 1)
|
||||
width >>= 1;
|
||||
result++;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ bool StreamingTexture::Create(const TextureHeader& header)
|
||||
{
|
||||
// Ensure that streaming doesn't go too low because the hardware expects the texture to be min in size of compressed texture block
|
||||
int32 lastMip = header.MipLevels - 1;
|
||||
while (header.Width >> lastMip < 4 && header.Height >> lastMip < 4)
|
||||
while ((header.Width >> lastMip) < 4 && (header.Height >> lastMip) < 4)
|
||||
lastMip--;
|
||||
_minMipCountBlockCompressed = header.MipLevels - lastMip + 1;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ void GPUContextDX11::ClearUA(GPUBuffer* buf, const Vector4& value)
|
||||
|
||||
void GPUContextDX11::ResetRenderTarget()
|
||||
{
|
||||
if (_rtCount > 0 || _uaOutput || _rtDepth)
|
||||
if (_rtCount != 0 || _uaOutput || _rtDepth)
|
||||
{
|
||||
_omDirtyFlag = true;
|
||||
_rtCount = 0;
|
||||
|
||||
@@ -730,7 +730,7 @@ void GPUContextDX12::ClearUA(GPUBuffer* buf, const Vector4& value)
|
||||
|
||||
void GPUContextDX12::ResetRenderTarget()
|
||||
{
|
||||
if (_rtDepth != nullptr || _rtCount != 0 || _rtDepth)
|
||||
if (_rtDepth || _rtCount != 0)
|
||||
{
|
||||
_rtDirtyFlag = false;
|
||||
_psDirtyFlag = true;
|
||||
|
||||
@@ -589,7 +589,7 @@ void GPUTextureDX12::initHandles()
|
||||
}
|
||||
if (useUAV)
|
||||
{
|
||||
if (isCubeMap || isArray)
|
||||
if (isCubeMap)
|
||||
{
|
||||
uavDesc.ViewDimension = D3D12_UAV_DIMENSION_TEXTURE2DARRAY;
|
||||
uavDesc.Texture2DArray.ArraySize = arraySize;
|
||||
|
||||
@@ -845,7 +845,7 @@ void GPUContextVulkan::ClearUA(GPUBuffer* buf, const Vector4& value)
|
||||
|
||||
void GPUContextVulkan::ResetRenderTarget()
|
||||
{
|
||||
if (_rtDepth != nullptr || _rtCount != 0 || _rtDepth)
|
||||
if (_rtDepth || _rtCount != 0)
|
||||
{
|
||||
_rtDirtyFlag = true;
|
||||
_psDirtyFlag = true;
|
||||
@@ -999,13 +999,10 @@ void GPUContextVulkan::BindIB(GPUBuffer* indexBuffer)
|
||||
|
||||
void GPUContextVulkan::BindSampler(int32 slot, GPUSampler* sampler)
|
||||
{
|
||||
ASSERT(slot >= 0 && slot < GPU_MAX_SR_BINDED);
|
||||
ASSERT(slot >= GPU_STATIC_SAMPLERS_COUNT && slot < GPU_MAX_SAMPLER_BINDED);
|
||||
const auto handle = sampler ? ((GPUSamplerVulkan*)sampler)->Sampler : nullptr;
|
||||
if (_samplerHandles[slot] != handle)
|
||||
{
|
||||
_samplerHandles[slot] = handle;
|
||||
}
|
||||
}
|
||||
|
||||
void GPUContextVulkan::UpdateCB(GPUConstantBuffer* cb, const void* data)
|
||||
{
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
|
||||
//
|
||||
|
||||
// TODO: Check defines so we can disable ENet
|
||||
|
||||
#include "ENetDriver.h"
|
||||
|
||||
#include "Engine/Networking/NetworkConfig.h"
|
||||
#include "Engine/Networking/NetworkChannelType.h"
|
||||
#include "Engine/Networking/NetworkEvent.h"
|
||||
#include "Engine/Networking/NetworkPeer.h"
|
||||
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Core/Collections/Array.h"
|
||||
|
||||
#define ENET_IMPLEMENTATION
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#include <enet/enet.h>
|
||||
|
||||
#undef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#undef SendMessage
|
||||
|
||||
@@ -59,7 +56,8 @@ void ENetDriver::Initialize(NetworkPeer* host, const NetworkConfig& config)
|
||||
_config = config;
|
||||
_peerMap = Dictionary<uint32, void*>();
|
||||
|
||||
if (enet_initialize () != 0) {
|
||||
if (enet_initialize() != 0)
|
||||
{
|
||||
LOG(Error, "Failed to initialize ENet driver!");
|
||||
}
|
||||
|
||||
@@ -135,8 +133,6 @@ bool ENetDriver::Connect()
|
||||
|
||||
void ENetDriver::Disconnect()
|
||||
{
|
||||
ASSERT(_peer != nullptr);
|
||||
|
||||
if (_peer)
|
||||
{
|
||||
enet_peer_disconnect_now((ENetPeer*)_peer, 0);
|
||||
@@ -209,7 +205,8 @@ bool ENetDriver::PopEvent(NetworkEvent* eventPtr)
|
||||
Memory::CopyItems(eventPtr->Message.Buffer, event.packet->data, event.packet->dataLength);
|
||||
break;
|
||||
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true; // Event
|
||||
}
|
||||
|
||||
@@ -31,9 +31,9 @@ void ParticleEffectParameter::Init(ParticleEffect* effect, int32 emitterIndex, i
|
||||
bool ParticleEffectParameter::IsValid() const
|
||||
{
|
||||
return _effect->ParticleSystem &&
|
||||
_effect->Instance.Emitters.Count() > _emitterIndex &&
|
||||
_effect->ParticleSystem->Emitters[_emitterIndex] &&
|
||||
_effect->ParticleSystem->Emitters[_emitterIndex]->Graph.Parameters.Count() > _paramIndex &&
|
||||
_effect->Instance.Emitters.Count() > _emitterIndex;
|
||||
_effect->ParticleSystem->Emitters[_emitterIndex]->Graph.Parameters.Count() > _paramIndex;
|
||||
}
|
||||
|
||||
ParticleEmitter* ParticleEffectParameter::GetEmitter() const
|
||||
|
||||
@@ -103,7 +103,6 @@ bool FileSystemBase::IsRelative(const StringView& path)
|
||||
const bool isRooted =
|
||||
(path.Length() >= 2 && StringUtils::IsAlpha(path[0]) && path[1] == ':') ||
|
||||
path.StartsWith(StringView(TEXT("\\\\"), 2), StringSearchCase::CaseSensitive) ||
|
||||
path.StartsWith('/') ||
|
||||
path.StartsWith('\\') ||
|
||||
path.StartsWith('/');
|
||||
return !isRooted;
|
||||
|
||||
@@ -1941,7 +1941,8 @@ void Render2D::DrawTexturedTriangles(GPUTexture* t, const Span<Vector2>& vertice
|
||||
void Render2D::DrawTexturedTriangles(GPUTexture* t, const Span<Vector2>& vertices, const Span<Vector2>& uvs, const Span<Color>& colors)
|
||||
{
|
||||
RENDER2D_CHECK_RENDERING_STATE;
|
||||
CHECK(vertices.Length() == uvs.Length() == colors.Length())
|
||||
CHECK(vertices.Length() == uvs.Length());
|
||||
CHECK(vertices.Length() == colors.Length());
|
||||
|
||||
Render2DDrawCall& drawCall = DrawCalls.AddOne();
|
||||
drawCall.Type = DrawCallType::FillTexture;
|
||||
|
||||
@@ -636,7 +636,7 @@ DRAW:
|
||||
auto& drawCall = DrawCalls[list.Indices[batch.StartIndex]];
|
||||
|
||||
int32 vbCount = 0;
|
||||
while (drawCall.Geometry.VertexBuffers[vbCount] && vbCount < ARRAY_COUNT(drawCall.Geometry.VertexBuffers))
|
||||
while (vbCount < ARRAY_COUNT(drawCall.Geometry.VertexBuffers) && drawCall.Geometry.VertexBuffers[vbCount])
|
||||
{
|
||||
vb[vbCount] = drawCall.Geometry.VertexBuffers[vbCount];
|
||||
vbOffsets[vbCount] = drawCall.Geometry.VertexBuffersOffsets[vbCount];
|
||||
@@ -687,7 +687,7 @@ DRAW:
|
||||
auto& drawCall = batch.DrawCall;
|
||||
|
||||
int32 vbCount = 0;
|
||||
while (drawCall.Geometry.VertexBuffers[vbCount] && vbCount < ARRAY_COUNT(drawCall.Geometry.VertexBuffers))
|
||||
while (vbCount < ARRAY_COUNT(drawCall.Geometry.VertexBuffers) && drawCall.Geometry.VertexBuffers[vbCount])
|
||||
{
|
||||
vb[vbCount] = drawCall.Geometry.VertexBuffers[vbCount];
|
||||
vbOffsets[vbCount] = drawCall.Geometry.VertexBuffersOffsets[vbCount];
|
||||
|
||||
@@ -113,6 +113,7 @@ bool VolumetricFogPass::Init(RenderContext& renderContext, GPUContext* context,
|
||||
// Check if already prepared for this frame
|
||||
if (renderContext.Buffers->LastFrameVolumetricFog == Engine::FrameCount)
|
||||
{
|
||||
if (fog)
|
||||
fog->GetVolumetricFogOptions(options);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -175,8 +175,6 @@ VariantType MUtils::UnboxVariantType(MonoType* monoType)
|
||||
return VariantType(VariantType::Float);
|
||||
if (klass == mono_get_double_class() || monoType->type == MONO_TYPE_R8)
|
||||
return VariantType(VariantType::Double);
|
||||
if (klass == mono_get_double_class() || monoType->type == MONO_TYPE_BOOLEAN)
|
||||
return VariantType(VariantType::Double);
|
||||
if (klass == mono_get_string_class() || monoType->type == MONO_TYPE_STRING)
|
||||
return VariantType(VariantType::String);
|
||||
if (klass == mono_get_intptr_class() || klass == mono_get_uintptr_class() || monoType->type == MONO_TYPE_PTR)
|
||||
|
||||
@@ -417,9 +417,6 @@ void JsonWriter::SceneObject(::SceneObject* obj)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (prefab)
|
||||
LOG(Warning, "Failed to load prefab {0}.", prefab->ToString());
|
||||
else
|
||||
LOG(Warning, "Missing prefab with id={0}.", obj->GetPrefabID());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,6 @@ public:
|
||||
/// <returns>The pointer to the data in memory.</returns>
|
||||
void* Read(uint32 bytes)
|
||||
{
|
||||
ASSERT(bytes >= 0);
|
||||
ASSERT(GetLength() - GetPosition() >= bytes);
|
||||
const auto result = (void*)_position;
|
||||
_position += bytes;
|
||||
|
||||
@@ -131,8 +131,6 @@ void MemoryWriteStream::SetPosition(uint32 seek)
|
||||
|
||||
void MemoryWriteStream::WriteBytes(const void* data, uint32 bytes)
|
||||
{
|
||||
ASSERT(bytes >= 0);
|
||||
|
||||
// Calculate current position
|
||||
const uint32 position = GetPosition();
|
||||
|
||||
|
||||
@@ -72,8 +72,6 @@ void ReadStream::ReadString(String* data)
|
||||
}
|
||||
|
||||
data->ReserveSpace(length);
|
||||
if (length == 0)
|
||||
return;
|
||||
Char* ptr = data->Get();
|
||||
ASSERT(ptr != nullptr);
|
||||
Read(ptr, length);
|
||||
@@ -92,8 +90,6 @@ void ReadStream::ReadString(String* data, int16 lock)
|
||||
}
|
||||
|
||||
data->ReserveSpace(length);
|
||||
if (length == 0)
|
||||
return;
|
||||
Char* ptr = data->Get();
|
||||
ASSERT(ptr != nullptr);
|
||||
Read(ptr, length);
|
||||
|
||||
@@ -147,7 +147,6 @@ namespace FlaxEngine
|
||||
{
|
||||
bool isRooted = (path.Length >= 2 && char.IsLetterOrDigit(path[0]) && path[1] == ':') ||
|
||||
path.StartsWith("\\\\") ||
|
||||
path.StartsWith("/") ||
|
||||
path.StartsWith("\\") ||
|
||||
path.StartsWith("/");
|
||||
return !isRooted;
|
||||
|
||||
Reference in New Issue
Block a user