Add end-of-line spaces checker

This commit is contained in:
SirLynix
2024-01-26 10:43:00 +01:00
parent 63c61c0827
commit 6757de1be8
90 changed files with 170 additions and 126 deletions

View File

@@ -87,7 +87,7 @@ namespace Nz
format = AudioFormat::I16_Mono;
sampleCount = wav.totalPCMFrameCount;
}
return std::make_shared<SoundBuffer>(format, sampleCount, wav.sampleRate, samples.get());
}

View File

@@ -242,7 +242,7 @@ namespace Nz
format = AudioFormat::I16_Mono;
sampleCount = frameCount;
}
return std::make_shared<SoundBuffer>(format, sampleCount, sampleRate, samples.get());
}

View File

@@ -166,7 +166,7 @@ namespace Nz
format = AudioFormat::I16_Mono;
sampleCount = frameCount;
}
return std::make_shared<SoundBuffer>(format, sampleCount, info->rate, samples.get());
}

View File

@@ -112,7 +112,7 @@ namespace Nz
format = AudioFormat::I16_Mono;
sampleCount = frameCount;
}
return std::make_shared<SoundBuffer>(format, sampleCount, info.hz, info.buffer);
}

View File

@@ -30,7 +30,7 @@ namespace Nz
Music(*Audio::Instance()->GetDefaultDevice())
{
}
Music::Music(AudioDevice& device) :
SoundEmitter(device),
m_streaming(false),

View File

@@ -89,7 +89,7 @@ namespace Nz
else
return std::make_shared<BulletNullCollider3D>();
}
std::shared_ptr<BulletCollider3D> BulletCollider3D::CreateGeomFromPrimitive(const Primitive& primitive)
{
switch (primitive.type)

View File

@@ -190,7 +190,7 @@ namespace Nz
cpDampedSpringSetStiffness(m_constraint, newStiffness);
}
ChipmunkDampedRotarySpringConstraint2D::ChipmunkDampedRotarySpringConstraint2D(ChipmunkRigidBody2D& first, ChipmunkRigidBody2D& second, const RadianAnglef& restAngle, float stiffness, float damping) :
ChipmunkConstraint2D(first.GetWorld(), cpDampedRotarySpringNew(first.GetHandle(), second.GetHandle(), restAngle.value, stiffness, damping))
{

View File

@@ -621,7 +621,7 @@ namespace Nz
DestroyBody();
}
void ChipmunkRigidBody2D::DestroyBody()
{
UnregisterFromSpace();

View File

@@ -785,7 +785,7 @@ namespace Nz
return "Whirlpool";
}
void WhirlpoolHasher::ProcessBuffer()
{
NAZARA_USE_ANONYMOUS_NAMESPACE

View File

@@ -195,7 +195,7 @@ namespace Nz
pthread_cond_t TaskSchedulerImpl::s_cvEmpty;
pthread_cond_t TaskSchedulerImpl::s_cvNotEmpty;
pthread_barrier_t TaskSchedulerImpl::s_barrier;
#if defined(NAZARA_PLATFORM_MACOS)
//Code from https://blog.albertarmea.com/post/47089939939/using-pthreadbarrier-on-mac-os-x
int TaskSchedulerImpl::pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned int count)

View File

@@ -18,7 +18,7 @@ namespace Nz
/*!
* Write bits to the stream (if any) and reset the current bit cursor
* \see ResetWriteBitPosition
*/
void SerializationContext::FlushBits()

View File

@@ -114,7 +114,7 @@ namespace Nz
{
return utf8::distance(str.data(), str.data() + str.size());
}
bool EndsWith(std::string_view lhs, std::string_view rhs, CaseIndependent)
{
NAZARA_USE_ANONYMOUS_NAMESPACE

View File

@@ -26,7 +26,7 @@ namespace Nz::PlatformImpl
}
else
commandLine += program;
ReplaceStr(commandLine, L'/', L'\\');
commandLine += L' ';
};

View File

@@ -30,7 +30,7 @@ namespace Nz
FramePass& debugDrawPass = frameGraph.AddPass("Debug draw pass");
debugDrawPass.AddInput(inputOuputs.inputAttachments[0]);
debugDrawPass.AddOutput(inputOuputs.outputAttachments[0]);
if (inputOuputs.depthStencilInput != InvalidAttachmentIndex)
debugDrawPass.SetDepthStencilInput(inputOuputs.depthStencilInput);

View File

@@ -125,7 +125,7 @@ namespace Nz::Loaders
std::size_t proxyId = m_current->passList->AddAttachmentProxy(proxyName, it->second);
m_current->attachmentsByName.emplace(std::move(proxyName), proxyId);
}
void HandlePass(ParameterFileSection section, std::string passName)
{
struct InputOutput

View File

@@ -150,7 +150,7 @@ namespace Nz
return lightIndex;
}
std::size_t ForwardFramePipeline::RegisterRenderable(std::size_t worldInstanceIndex, std::size_t skeletonInstanceIndex, const InstancedRenderable* instancedRenderable, UInt32 renderMask, const Recti& scissorBox)
{
std::size_t renderableIndex;

View File

@@ -43,7 +43,7 @@ namespace Nz
textureInfo.type = ImageType::E2D;
textureInfo.usageFlags = TextureUsage::ShaderSampling | TextureUsage::TransferSource | TextureUsage::TransferDestination;
textureInfo.levelCount = 1; //< FIXME: Disable mipmaps for now
std::shared_ptr<Texture> newTexture;
try
{

View File

@@ -109,7 +109,7 @@ namespace Nz
size = Vector2f(m_size, section.size);
texCoords = Vector2f(m_textureCoords.width, section.textureCoord);
}
vertices->color = m_color;
vertices->position = topLeftCorner;
vertices->uv = topLeftUV;

View File

@@ -52,7 +52,7 @@ namespace Nz
for (std::size_t i = 0; i < m_directions.size(); ++i)
{
DirectionData& direction = m_directions[i];
ViewerInstance& viewerInstance = direction.viewer.GetViewerInstance();
viewerInstance.UpdateEyePosition(m_light.GetPosition());
viewerInstance.UpdateViewMatrix(Matrix4f::TransformInverse(m_light.GetPosition(), s_dirRotations[i]));

View File

@@ -36,7 +36,7 @@ namespace Nz
{
// TODO: Replace the blit to swapchain by a graph.BindExternalSwapchain?
std::size_t linkAttachment = graph.AddDummyAttachment();
FramePass& blitPass = graph.AddPass("Blit to swapchain");
blitPass.AddInput(attachmentIndex);
blitPass.SetInputAccess(0, TextureLayout::TransferSource, PipelineStage::Transfer, MemoryAccess::MemoryRead);

View File

@@ -192,7 +192,7 @@ namespace Nz
});
std::size_t size = structData.fieldOffsets.GetSize() - offset;
if (member.tag.empty())
continue;

View File

@@ -184,7 +184,7 @@ namespace Nz
if (UInt32 bindingIndex = material.GetEngineBindingIndex(EngineShaderBinding::ShadowmapPoint); bindingIndex != Material::InvalidBindingIndex)
{
std::size_t textureBindingBaseIndex = m_textureBindingCache.size();
for (std::size_t j = 0; j < renderState.shadowMapsPoint.size(); ++j)
{
const Texture* texture = renderState.shadowMapsPoint[j];
@@ -202,7 +202,7 @@ namespace Nz
SafeCast<UInt32>(renderState.shadowMapsPoint.size()), &m_textureBindingCache[textureBindingBaseIndex]
};
}
if (UInt32 bindingIndex = material.GetEngineBindingIndex(EngineShaderBinding::ShadowmapSpot); bindingIndex != Material::InvalidBindingIndex)
{
std::size_t textureBindingBaseIndex = m_textureBindingCache.size();

View File

@@ -292,7 +292,7 @@ namespace Nz
CameraComponent& entityCamera = m_registry.get<CameraComponent>(entity);
Vector3f cameraPosition = entityNode.GetPosition(CoordSys::Global);
ViewerInstance& viewerInstance = entityCamera.GetViewerInstance();
viewerInstance.UpdateEyePosition(cameraPosition);
viewerInstance.UpdateViewMatrix(Nz::Matrix4f::TransformInverse(cameraPosition, entityNode.GetRotation(CoordSys::Global)));
@@ -355,7 +355,7 @@ namespace Nz
assert(m_cameraEntities.find(entity) == m_cameraEntities.end());
m_cameraEntities.emplace(entity, cameraEntity);
});
m_graphicsConstructObserver.each([&](entt::entity entity)
{
GraphicsComponent& entityGfx = m_registry.get<GraphicsComponent>(entity);

View File

@@ -78,7 +78,7 @@ namespace Nz
vertices += 4 * spriteCount;
}
}
const std::shared_ptr<MaterialInstance>& Tilemap::GetMaterial(std::size_t i) const
{
assert(i < m_layers.size());

View File

@@ -92,7 +92,7 @@ namespace Nz
for (const auto& [optionHash, optionValue] : config.optionValues)
{
std::uint32_t hash = optionHash;
std::visit([&](auto&& arg)
{
states.optionValues[hash] = arg;

View File

@@ -127,7 +127,7 @@ namespace Nz
{
m_character->Activate(false);
}
JoltCharacter& JoltCharacter::operator=(JoltCharacter&& character) noexcept
{
Destroy();

View File

@@ -186,7 +186,7 @@ namespace Nz
for (unsigned int slice = 0; slice < sliceCount; ++slice)
{
Quaternionf rot(RadianAnglef(2.f * Pi<float> * slice / sliceCount), Nz::Vector3f::Down());
Vector3f top(0.f, halfHeight, 0.f);
for (unsigned int i = 0; i < cornerStepCount; ++i)
{
@@ -354,7 +354,7 @@ namespace Nz
}
/******************************** JoltMeshCollider3D *********************************/
JoltMeshCollider3D::JoltMeshCollider3D(SparsePtr<const Vector3f> vertices, std::size_t vertexCount, SparsePtr<const UInt16> indices, std::size_t indexCount)
{
std::unique_ptr<JPH::MeshShapeSettings> settings = std::make_unique<JPH::MeshShapeSettings>();

View File

@@ -210,7 +210,7 @@ namespace Nz
const FunctionRef<std::optional<float>(const JoltPhysWorld3D::PointCollisionInfo& hitInfo)>& m_callback;
bool m_didHit;
};
class ShapeCallbackHitResult : public JPH::CollideShapeCollector
{
public:

View File

@@ -144,7 +144,7 @@ namespace Nz
void AbstractSocket::SetReceiveBufferSize(std::size_t size)
{
NazaraAssert(m_handle != SocketImpl::InvalidHandle, "Socket must be created first");
SocketImpl::SetReceiveBufferSize(m_handle, size);
}
@@ -156,7 +156,7 @@ namespace Nz
void AbstractSocket::SetSendBufferSize(std::size_t size)
{
NazaraAssert(m_handle != SocketImpl::InvalidHandle, "Socket must be created first");
SocketImpl::SetSendBufferSize(m_handle, size);
}
@@ -249,7 +249,7 @@ namespace Nz
m_lastError = abstractSocket.m_lastError;
m_state = abstractSocket.m_state;
m_type = abstractSocket.m_type;
abstractSocket.m_handle = SocketImpl::InvalidHandle;
return *this;

View File

@@ -710,7 +710,7 @@ namespace Nz
#else
int byteSent = sendmsg(handle, &msgHdr, 0);
#endif
if (byteSent == -1)
{
int errorCode = errno;
@@ -892,7 +892,7 @@ namespace Nz
if (error)
*error = SocketError::NoError;
#if not defined(MSG_NOSIGNAL) // -> https://github.com/intel/parameter-framework/pull/133/files
//There is no MSG_NOSIGNAL on macos
const int set = 1;
@@ -1017,7 +1017,7 @@ namespace Nz
int SocketImpl::TranslateNetProtocolToAF(NetProtocol protocol)
{
NazaraAssert(protocol <= NetProtocol::Max, "Protocol has value out of enum");
constexpr EnumArray<NetProtocol, int> addressFamily {
AF_UNSPEC, //< NetProtocol::Any
AF_INET, //< NetProtocol::IPv4
@@ -1031,7 +1031,7 @@ namespace Nz
int SocketImpl::TranslateSocketTypeToSock(SocketType type)
{
NazaraAssert(type <= SocketType::Max, "Socket type has value out of enum");
constexpr EnumArray<SocketType, int> socketType {
SOCK_RAW, //< SocketType::Raw
SOCK_STREAM, //< SocketType::TCP

View File

@@ -445,7 +445,7 @@ namespace Nz
return 0;
#endif
}
SocketState SocketImpl::PollConnection(SocketHandle handle, const IpAddress& /*address*/, UInt64 msTimeout, SocketError* error)
{
// Wait until socket is available for writing or an error occurs (ie when connection succeeds or fails)
@@ -1041,7 +1041,7 @@ namespace Nz
int SocketImpl::TranslateSocketTypeToSock(SocketType type)
{
NazaraAssert(type <= SocketType::Max, "Socket type has value out of enum");
constexpr EnumArray<SocketType, int> socketType {
SOCK_RAW, //< SocketType::Raw
SOCK_STREAM, //< SocketType::TCP

View File

@@ -84,11 +84,11 @@ namespace Nz
for (std::size_t i = 0; i < bindingCount; ++i)
{
const Binding& binding = bindings[i];
std::visit([&](auto&& arg)
{
using T = std::decay_t<decltype(arg)>;
if constexpr (std::is_same_v<T, SampledTextureBinding>)
HandleTextureBinding(binding.bindingIndex, arg);
else if constexpr (std::is_same_v<T, SampledTextureBindings>)

View File

@@ -333,7 +333,7 @@ namespace Nz::GL
{
// WGL_ARB_pixel_format and WGL_EXT_pixel_format are the same, except for the symbol
auto wglChoosePixelFormat = (currentContext->wglChoosePixelFormatARB) ? currentContext->wglChoosePixelFormatARB : currentContext->wglChoosePixelFormatEXT;
if (wglChoosePixelFormat)
{
std::array<int, 10 * 2 + 1> attributes = {

View File

@@ -16,7 +16,7 @@ namespace Nz
width(0)
{
}
VideoMode::VideoMode(unsigned int w, unsigned int h) :
VideoMode(w, h, GetDesktopMode().bitsPerPixel)
{

View File

@@ -35,7 +35,7 @@ namespace Nz
auto debugDrawShader = m_renderDevice.InstantiateShaderModule(nzsl::ShaderStageType::Fragment | nzsl::ShaderStageType::Vertex, *shaderModule, {});
if (!debugDrawShader)
throw std::runtime_error("failed to instantiate debug draw shader");
RenderPipelineLayoutInfo layoutInfo;
layoutInfo.bindings.assign({
{

View File

@@ -109,7 +109,7 @@ namespace Nz
NazaraUnused(parameters);
Image tempImage(image); //< We're using COW here to prevent Image copy unless required
int componentCount = ConvertToIntegerFormat(tempImage);
if (componentCount == 0)
{
@@ -229,7 +229,7 @@ namespace Nz
{ ".png", &SavePNG },
{ ".tga", &SaveTGA }
});
bool FormatQuerier(std::string_view extension)
{
return s_formatHandlers.find(extension) != s_formatHandlers.end();

View File

@@ -33,7 +33,7 @@ namespace Nz
entitySkeleton.SetSkeletonParent(&entityNode);
});
m_skeletonConstructObserver.each([&](entt::entity entity)
{
NodeComponent& entityNode = m_registry.get<NodeComponent>(entity);

View File

@@ -129,7 +129,7 @@ namespace Nz
});
NazaraAssert(s_declarations[VertexLayout::XY_Color]->GetStride() == sizeof(VertexStruct_XY_Color), "Invalid stride for declaration VertexLayout::XY_Color");
// VertexLayout::XY_UV : VertexStruct_XY_UV
s_declarations[VertexLayout::XY_UV] = NewDeclaration(VertexInputRate::Vertex, {
{
@@ -292,7 +292,7 @@ namespace Nz
});
NazaraAssert(s_declarations[VertexLayout::XYZ_Normal_UV_Tangent_Skinning]->GetStride() == sizeof(VertexStruct_XYZ_Normal_UV_Tangent_Skinning), "Invalid stride for declaration VertexLayout::XYZ_Normal_UV_Tangent_Skinning");
// VertexLayout::XYZ_SizeRot : VertexStruct_XYZ_SizeRot
s_declarations[VertexLayout::UV_SizeSinCos] = NewDeclaration(VertexInputRate::Vertex, {
{

View File

@@ -47,7 +47,7 @@ namespace Nz
ErrorFlags flags(ErrorMode::ThrowException);
m_mapper.Map(vertexBuffer, 0, vertexBuffer.GetVertexCount());
}
VertexMapper::~VertexMapper() = default;
void VertexMapper::Unmap()

View File

@@ -53,7 +53,7 @@ namespace Nz
ToVulkan(attachmentRef.attachmentLayout)
});
}
std::size_t inputAttachmentIndex = vkAttachmentReferences.size();
for (const AttachmentReference& attachmentRef : subpassInfo.inputAttachments)
{

View File

@@ -48,7 +48,7 @@ namespace Nz
for (std::size_t i = 0; i < bindingCount; ++i)
{
const Binding& binding = bindings[i];
VkWriteDescriptorSet& writeOp = writeOps.emplace_back();
writeOp.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
writeOp.dstSet = m_descriptorSet;

View File

@@ -27,7 +27,7 @@ namespace Nz
VkImageViewCreateInfo createInfoView = {};
createInfoView.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
InitViewForFormat(m_textureInfo.pixelFormat, createInfoView);
VkImageCreateInfo createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
createInfo.format = createInfoView.format;
@@ -229,7 +229,7 @@ namespace Nz
createInfoView.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
createInfoView.image = m_image;
createInfoView.subresourceRange = m_subresourceRange;
switch (m_textureViewInfo.type)
{
case ImageType::E1D:

View File

@@ -48,7 +48,7 @@ namespace Nz
EnableBackground(true);
}
void AbstractTextAreaWidget::Clear()
{
AbstractTextDrawer& textDrawer = GetTextDrawer();

View File

@@ -112,7 +112,7 @@ namespace Nz
const UInt8 s_defaultThemeScrollbarCenterImage[] = {
#include <Nazara/Widgets/Resources/DefaultTheme/ScrollbarCenter.png.h>
};
const UInt8 s_defaultThemeScrollbarGrabbedImage[] = {
#include <Nazara/Widgets/Resources/DefaultTheme/ScrollbarCenterGrabbed.png.h>
};

View File

@@ -12,7 +12,7 @@ namespace Nz
{
Layout();
}
void RichTextAreaWidget::AppendText(std::string_view text)
{
//m_text += text;

View File

@@ -26,7 +26,7 @@ namespace Nz
const WidgetTheme::Config& themeConfig = GetTheme()->GetConfig();
m_scrollCenterButton = Add<ScrollbarButtonWidget>();
m_scrollCenterButton->OnButtonReleased.Connect([this](const ScrollbarButtonWidget*)
{
m_style->OnButtonRelease();
@@ -40,7 +40,7 @@ namespace Nz
m_grabbedValue = GetValue();
m_style->OnButtonGrab();
});
m_scrollCenterButton->OnButtonMoved.Connect([this](const ScrollbarButtonWidget*, int x, int /*y*/)
{
int deltaX = x - m_grabbedPosition;
@@ -65,7 +65,7 @@ namespace Nz
m_grabbedValue = GetValue();
m_style->OnButtonGrab();
});
m_scrollCenterButton->OnButtonMoved.Connect([this](const ScrollbarButtonWidget* button, int /*x*/, int y)
{
int deltaY = SafeCast<int>(m_grabbedPosition - (button->GetPosition().y + y));
@@ -87,7 +87,7 @@ namespace Nz
{
SetValue(GetValue() - 0.1f * (GetMaximumValue() - GetMinimumValue()));
});
m_scrollNextButton->OnButtonTrigger.Connect([this](const ImageButtonWidget*)
{
SetValue(GetValue() + 0.1f * (GetMaximumValue() - GetMinimumValue()));
@@ -139,7 +139,7 @@ namespace Nz
{
m_style->OnHoverBegin();
}
void ScrollbarWidget::OnMouseExit()
{
m_style->OnHoverEnd();

View File

@@ -393,7 +393,7 @@ namespace Nz
{
m_textSprite->Update(drawer);
}
/************************************************************************/
SimpleProgressBarWidgetStyle::SimpleProgressBarWidgetStyle(ProgressBarWidget* progressBarWidget, StyleConfig config) :

View File

@@ -38,7 +38,7 @@ namespace Nz
Layout();
}
void TextAreaWidget::AppendText(std::string_view text)
{
m_text += text;
@@ -83,7 +83,7 @@ namespace Nz
m_text.clear();
OnTextChanged(this, m_text);
}
void TextAreaWidget::Erase(std::size_t firstGlyph, std::size_t lastGlyph)
{
if (firstGlyph > lastGlyph)