mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-24 13:53:36 +02:00
Add clang-tidy cppcoreguidelines-* checks
This commit is contained in:
1 parent
cc1b6f0c45
commit
4d23a89918
12 files changed
+65
-58
No files matched your search
+15
@@ -1,11 +1,26 @@
|
||||
Checks: >
|
||||
bugprone-*,
|
||||
clang-analyzer-*,
|
||||
cppcoreguidelines-*,
|
||||
modernize-*,
|
||||
-bugprone-easily-swappable-parameters,
|
||||
-bugprone-narrowing-conversions,
|
||||
-clang-analyzer-core.NonNullParamChecker,
|
||||
-clang-analyzer-security.insecureAPI.strcpy,
|
||||
-cppcoreguidelines-avoid-c-arrays,
|
||||
-cppcoreguidelines-avoid-magic-numbers,
|
||||
-cppcoreguidelines-avoid-non-const-global-variables,
|
||||
-cppcoreguidelines-macro-to-enum,
|
||||
-cppcoreguidelines-macro-usage,
|
||||
-cppcoreguidelines-narrowing-conversions,
|
||||
-cppcoreguidelines-no-malloc,
|
||||
-cppcoreguidelines-owning-memory,
|
||||
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
|
||||
-cppcoreguidelines-pro-bounds-constant-array-index,
|
||||
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
|
||||
-cppcoreguidelines-pro-type-const-cast,
|
||||
-cppcoreguidelines-pro-type-reinterpret-cast,
|
||||
-cppcoreguidelines-special-member-functions,
|
||||
-modernize-avoid-c-arrays,
|
||||
-modernize-macro-to-enum,
|
||||
-modernize-redundant-void-arg,
|
||||
|
||||
@@ -43,15 +43,15 @@ typedef struct
|
||||
} sfColor;
|
||||
|
||||
|
||||
CSFML_GRAPHICS_API sfColor sfBlack; ///< Black predefined color
|
||||
CSFML_GRAPHICS_API sfColor sfWhite; ///< White predefined color
|
||||
CSFML_GRAPHICS_API sfColor sfRed; ///< Red predefined color
|
||||
CSFML_GRAPHICS_API sfColor sfGreen; ///< Green predefined color
|
||||
CSFML_GRAPHICS_API sfColor sfBlue; ///< Blue predefined color
|
||||
CSFML_GRAPHICS_API sfColor sfYellow; ///< Yellow predefined color
|
||||
CSFML_GRAPHICS_API sfColor sfMagenta; ///< Magenta predefined color
|
||||
CSFML_GRAPHICS_API sfColor sfCyan; ///< Cyan predefined color
|
||||
CSFML_GRAPHICS_API sfColor sfTransparent; ///< Transparent (black) predefined color
|
||||
CSFML_GRAPHICS_API const sfColor sfBlack; ///< Black predefined color
|
||||
CSFML_GRAPHICS_API const sfColor sfWhite; ///< White predefined color
|
||||
CSFML_GRAPHICS_API const sfColor sfRed; ///< Red predefined color
|
||||
CSFML_GRAPHICS_API const sfColor sfGreen; ///< Green predefined color
|
||||
CSFML_GRAPHICS_API const sfColor sfBlue; ///< Blue predefined color
|
||||
CSFML_GRAPHICS_API const sfColor sfYellow; ///< Yellow predefined color
|
||||
CSFML_GRAPHICS_API const sfColor sfMagenta; ///< Magenta predefined color
|
||||
CSFML_GRAPHICS_API const sfColor sfCyan; ///< Cyan predefined color
|
||||
CSFML_GRAPHICS_API const sfColor sfTransparent; ///< Transparent (black) predefined color
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -136,5 +136,5 @@ private:
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
sfInputStream myStream; ///< The source CSFML input stream
|
||||
sfInputStream myStream{}; ///< The source CSFML input stream
|
||||
};
|
||||
@@ -39,7 +39,7 @@
|
||||
struct sfCircleShape
|
||||
{
|
||||
sf::CircleShape This;
|
||||
const sfTexture* Texture;
|
||||
mutable sfTransform Transform;
|
||||
mutable sfTransform InverseTransform;
|
||||
const sfTexture* Texture{};
|
||||
mutable sfTransform Transform{};
|
||||
mutable sfTransform InverseTransform{};
|
||||
};
|
||||
@@ -31,15 +31,15 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
sfColor sfBlack = sfColor_fromRGB(0, 0, 0);
|
||||
sfColor sfWhite = sfColor_fromRGB(255, 255, 255);
|
||||
sfColor sfRed = sfColor_fromRGB(255, 0, 0);
|
||||
sfColor sfGreen = sfColor_fromRGB(0, 255, 0);
|
||||
sfColor sfBlue = sfColor_fromRGB(0, 0, 255);
|
||||
sfColor sfYellow = sfColor_fromRGB(255, 255, 0);
|
||||
sfColor sfMagenta = sfColor_fromRGB(255, 0, 255);
|
||||
sfColor sfCyan = sfColor_fromRGB(0, 255, 255);
|
||||
sfColor sfTransparent = sfColor_fromRGBA(0, 0, 0, 0);
|
||||
const sfColor sfBlack = sfColor_fromRGB(0, 0, 0);
|
||||
const sfColor sfWhite = sfColor_fromRGB(255, 255, 255);
|
||||
const sfColor sfRed = sfColor_fromRGB(255, 0, 0);
|
||||
const sfColor sfGreen = sfColor_fromRGB(0, 255, 0);
|
||||
const sfColor sfBlue = sfColor_fromRGB(0, 0, 255);
|
||||
const sfColor sfYellow = sfColor_fromRGB(255, 255, 0);
|
||||
const sfColor sfMagenta = sfColor_fromRGB(255, 0, 255);
|
||||
const sfColor sfCyan = sfColor_fromRGB(0, 255, 255);
|
||||
const sfColor sfTransparent = sfColor_fromRGBA(0, 0, 0, 0);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
struct sfConvexShape
|
||||
{
|
||||
sf::ConvexShape This;
|
||||
const sfTexture* Texture;
|
||||
mutable sfTransform Transform;
|
||||
mutable sfTransform InverseTransform;
|
||||
const sfTexture* Texture{};
|
||||
mutable sfTransform Transform{};
|
||||
mutable sfTransform InverseTransform{};
|
||||
};
|
||||
@@ -39,7 +39,7 @@
|
||||
struct sfRectangleShape
|
||||
{
|
||||
sf::RectangleShape This;
|
||||
const sfTexture* Texture;
|
||||
mutable sfTransform Transform;
|
||||
mutable sfTransform InverseTransform;
|
||||
const sfTexture* Texture{};
|
||||
mutable sfTransform Transform{};
|
||||
mutable sfTransform InverseTransform{};
|
||||
};
|
||||
@@ -79,7 +79,7 @@ struct sfShape
|
||||
}
|
||||
|
||||
sfShapeImpl This;
|
||||
const sfTexture* Texture;
|
||||
mutable sfTransform Transform;
|
||||
mutable sfTransform InverseTransform;
|
||||
const sfTexture* Texture{};
|
||||
mutable sfTransform Transform{};
|
||||
mutable sfTransform InverseTransform{};
|
||||
};
|
||||
@@ -35,22 +35,14 @@
|
||||
////////////////////////////////////////////////////////////
|
||||
struct sfTexture
|
||||
{
|
||||
sfTexture()
|
||||
sfTexture() = default;
|
||||
|
||||
sfTexture(sf::Texture* texture) : This(texture), OwnInstance(false)
|
||||
{
|
||||
This = new sf::Texture;
|
||||
OwnInstance = true;
|
||||
}
|
||||
|
||||
sfTexture(sf::Texture* texture)
|
||||
sfTexture(const sfTexture& texture) : This(texture.This ? new sf::Texture(*texture.This) : nullptr)
|
||||
{
|
||||
This = texture;
|
||||
OwnInstance = false;
|
||||
}
|
||||
|
||||
sfTexture(const sfTexture& texture)
|
||||
{
|
||||
This = texture.This ? new sf::Texture(*texture.This) : nullptr;
|
||||
OwnInstance = true;
|
||||
}
|
||||
|
||||
~sfTexture()
|
||||
@@ -59,6 +51,6 @@ struct sfTexture
|
||||
delete This;
|
||||
}
|
||||
|
||||
sf::Texture* This;
|
||||
bool OwnInstance;
|
||||
sf::Texture* This{new sf::Texture};
|
||||
bool OwnInstance{true};
|
||||
};
|
||||
@@ -38,6 +38,6 @@
|
||||
struct sfTransformable
|
||||
{
|
||||
sf::Transformable This;
|
||||
mutable sfTransform Transform;
|
||||
mutable sfTransform InverseTransform;
|
||||
mutable sfTransform Transform{};
|
||||
mutable sfTransform InverseTransform{};
|
||||
};
|
||||
@@ -117,56 +117,56 @@ bool sfPacket_readBool(sfPacket* packet)
|
||||
int8_t sfPacket_readInt8(sfPacket* packet)
|
||||
{
|
||||
assert(packet);
|
||||
int8_t value;
|
||||
int8_t value = 0;
|
||||
packet->This >> value;
|
||||
return value;
|
||||
}
|
||||
uint8_t sfPacket_readUint8(sfPacket* packet)
|
||||
{
|
||||
assert(packet);
|
||||
uint8_t value;
|
||||
uint8_t value = 0;
|
||||
packet->This >> value;
|
||||
return value;
|
||||
}
|
||||
int16_t sfPacket_readInt16(sfPacket* packet)
|
||||
{
|
||||
assert(packet);
|
||||
int16_t value;
|
||||
int16_t value = 0;
|
||||
packet->This >> value;
|
||||
return value;
|
||||
}
|
||||
uint16_t sfPacket_readUint16(sfPacket* packet)
|
||||
{
|
||||
assert(packet);
|
||||
uint16_t value;
|
||||
uint16_t value = 0;
|
||||
packet->This >> value;
|
||||
return value;
|
||||
}
|
||||
int32_t sfPacket_readInt32(sfPacket* packet)
|
||||
{
|
||||
assert(packet);
|
||||
int32_t value;
|
||||
int32_t value = 0;
|
||||
packet->This >> value;
|
||||
return value;
|
||||
}
|
||||
uint32_t sfPacket_readUint32(sfPacket* packet)
|
||||
{
|
||||
assert(packet);
|
||||
uint32_t value;
|
||||
uint32_t value = 0;
|
||||
packet->This >> value;
|
||||
return value;
|
||||
}
|
||||
float sfPacket_readFloat(sfPacket* packet)
|
||||
{
|
||||
assert(packet);
|
||||
float value;
|
||||
float value = 0;
|
||||
packet->This >> value;
|
||||
return value;
|
||||
}
|
||||
double sfPacket_readDouble(sfPacket* packet)
|
||||
{
|
||||
assert(packet);
|
||||
double value;
|
||||
double value = 0;
|
||||
packet->This >> value;
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -123,8 +123,8 @@ sfSocketStatus sfUdpSocket_receive(sfUdpSocket* socket,
|
||||
assert(socket);
|
||||
|
||||
std::optional<sf::IpAddress> address;
|
||||
unsigned short port;
|
||||
std::size_t sizeReceived;
|
||||
unsigned short port = 0;
|
||||
std::size_t sizeReceived = 0;
|
||||
|
||||
sf::Socket::Status status = socket->This.receive(data, size, sizeReceived, address, port);
|
||||
if (status != sf::Socket::Status::Done)
|
||||
@@ -175,7 +175,7 @@ sfSocketStatus sfUdpSocket_receivePacket(sfUdpSocket* socket, sfPacket* packet,
|
||||
assert(packet);
|
||||
|
||||
std::optional<sf::IpAddress> address;
|
||||
unsigned short port;
|
||||
unsigned short port = 0;
|
||||
|
||||
sf::Socket::Status status = socket->This.receive(packet->This, address, port);
|
||||
if (status != sf::Socket::Status::Done)
|
||||
|
||||
Reference in new issue
Block a user