mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Added readability-container-size-empty, readability-isolate-declaration
FIxed Windows escapes for readability-* checks Fixed Linux DRM readability-isolate-declaration escape Fixed typo in fix :-| Fixed clang-format issue
This commit is contained in:
parent
a4bca20567
commit
3745ea2336
@ -5,7 +5,9 @@ Checks: >
|
|||||||
modernize-use-equals-default,
|
modernize-use-equals-default,
|
||||||
modernize-use-equals-delete,
|
modernize-use-equals-delete,
|
||||||
modernize-use-nullptr,
|
modernize-use-nullptr,
|
||||||
|
readability-container-size-empty,
|
||||||
readability-identifier-naming,
|
readability-identifier-naming,
|
||||||
|
readability-isolate-declaration,
|
||||||
-clang-analyzer-core.NonNullParamChecker,
|
-clang-analyzer-core.NonNullParamChecker,
|
||||||
-clang-analyzer-core.NullDereference,
|
-clang-analyzer-core.NullDereference,
|
||||||
-clang-analyzer-nullability.NullablePassedToNonnull,
|
-clang-analyzer-nullability.NullablePassedToNonnull,
|
||||||
|
@ -43,7 +43,8 @@ int main()
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
// Ask for user name and password
|
// Ask for user name and password
|
||||||
std::string user, password;
|
std::string user;
|
||||||
|
std::string password;
|
||||||
std::cout << "User name: ";
|
std::cout << "User name: ";
|
||||||
std::cin >> user;
|
std::cin >> user;
|
||||||
std::cout << "Password: ";
|
std::cout << "Password: ";
|
||||||
@ -141,7 +142,8 @@ int main()
|
|||||||
case 6:
|
case 6:
|
||||||
{
|
{
|
||||||
// Rename a file
|
// Rename a file
|
||||||
std::string source, destination;
|
std::string source;
|
||||||
|
std::string destination;
|
||||||
std::cout << "Name of the file to rename: ";
|
std::cout << "Name of the file to rename: ";
|
||||||
std::cin >> source;
|
std::cin >> source;
|
||||||
std::cout << "New name: ";
|
std::cout << "New name: ";
|
||||||
@ -163,7 +165,8 @@ int main()
|
|||||||
case 8:
|
case 8:
|
||||||
{
|
{
|
||||||
// Download a file from server
|
// Download a file from server
|
||||||
std::string filename, directory;
|
std::string filename;
|
||||||
|
std::string directory;
|
||||||
std::cout << "Filename of the file to download (relative to current directory): ";
|
std::cout << "Filename of the file to download (relative to current directory): ";
|
||||||
std::cin >> filename;
|
std::cin >> filename;
|
||||||
std::cout << "Directory to download the file to: ";
|
std::cout << "Directory to download the file to: ";
|
||||||
@ -175,7 +178,8 @@ int main()
|
|||||||
case 9:
|
case 9:
|
||||||
{
|
{
|
||||||
// Upload a file to server
|
// Upload a file to server
|
||||||
std::string filename, directory;
|
std::string filename;
|
||||||
|
std::string directory;
|
||||||
std::cout << "Path of the file to upload (absolute or relative to working directory): ";
|
std::cout << "Path of the file to upload (absolute or relative to working directory): ";
|
||||||
std::cin >> filename;
|
std::cin >> filename;
|
||||||
std::cout << "Directory to upload the file to (relative to current directory): ";
|
std::cout << "Directory to upload the file to (relative to current directory): ";
|
||||||
|
@ -389,7 +389,7 @@ public:
|
|||||||
for (VkFence fence : fences)
|
for (VkFence fence : fences)
|
||||||
vkWaitForFences(device, 1, &fence, VK_TRUE, std::numeric_limits<std::uint64_t>::max());
|
vkWaitForFences(device, 1, &fence, VK_TRUE, std::numeric_limits<std::uint64_t>::max());
|
||||||
|
|
||||||
if (commandBuffers.size())
|
if (!commandBuffers.empty())
|
||||||
vkFreeCommandBuffers(device, commandPool, static_cast<std::uint32_t>(commandBuffers.size()), commandBuffers.data());
|
vkFreeCommandBuffers(device, commandPool, static_cast<std::uint32_t>(commandBuffers.size()), commandBuffers.data());
|
||||||
|
|
||||||
commandBuffers.clear();
|
commandBuffers.clear();
|
||||||
|
@ -111,7 +111,8 @@ int main()
|
|||||||
sf::RenderWindow sfmlView2(view2);
|
sf::RenderWindow sfmlView2(view2);
|
||||||
|
|
||||||
// Load some textures to display
|
// Load some textures to display
|
||||||
sf::Texture texture1, texture2;
|
sf::Texture texture1;
|
||||||
|
sf::Texture texture2;
|
||||||
if (!texture1.loadFromFile("resources/image1.jpg") || !texture2.loadFromFile("resources/image2.jpg"))
|
if (!texture1.loadFromFile("resources/image1.jpg") || !texture2.loadFromFile("resources/image2.jpg"))
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
sf::Sprite sprite1(texture1);
|
sf::Sprite sprite1(texture1);
|
||||||
|
@ -92,7 +92,9 @@ bool SoundFileWriterOgg::open(const std::filesystem::path& filename, unsigned in
|
|||||||
vorbis_comment_init(&comment);
|
vorbis_comment_init(&comment);
|
||||||
|
|
||||||
// Generate the header packets
|
// Generate the header packets
|
||||||
ogg_packet header, headerComm, headerCode;
|
ogg_packet header;
|
||||||
|
ogg_packet headerComm;
|
||||||
|
ogg_packet headerCode;
|
||||||
status = vorbis_analysis_headerout(&m_state, &comment, &header, &headerComm, &headerCode);
|
status = vorbis_analysis_headerout(&m_state, &comment, &header, &headerComm, &headerCode);
|
||||||
vorbis_comment_clear(&comment);
|
vorbis_comment_clear(&comment);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
|
@ -346,7 +346,8 @@ void SoundStream::streamData()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ALint size, bits;
|
ALint size;
|
||||||
|
ALint bits;
|
||||||
alCheck(alGetBufferi(buffer, AL_SIZE, &size));
|
alCheck(alGetBufferi(buffer, AL_SIZE, &size));
|
||||||
alCheck(alGetBufferi(buffer, AL_BITS, &bits));
|
alCheck(alGetBufferi(buffer, AL_BITS, &bits));
|
||||||
|
|
||||||
|
@ -483,7 +483,8 @@ EGLDisplay getInitializedDisplay()
|
|||||||
|
|
||||||
eglCheck(display = eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(gbmDevice)));
|
eglCheck(display = eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(gbmDevice)));
|
||||||
|
|
||||||
EGLint major, minor;
|
EGLint major;
|
||||||
|
EGLint minor;
|
||||||
eglCheck(eglInitialize(display, &major, &minor));
|
eglCheck(eglInitialize(display, &major, &minor));
|
||||||
|
|
||||||
gladLoaderLoadEGL(display);
|
gladLoaderLoadEGL(display);
|
||||||
|
@ -138,7 +138,8 @@ bool CursorImpl::loadFromPixelsMonochrome(const std::uint8_t* pixels, Vector2u s
|
|||||||
size.y);
|
size.y);
|
||||||
|
|
||||||
// Define the foreground color as white and the background as black.
|
// Define the foreground color as white and the background as black.
|
||||||
XColor fg, bg;
|
XColor fg;
|
||||||
|
XColor bg;
|
||||||
fg.red = 0xFFFF;
|
fg.red = 0xFFFF;
|
||||||
fg.blue = 0xFFFF;
|
fg.blue = 0xFFFF;
|
||||||
fg.green = 0xFFFF;
|
fg.green = 0xFFFF;
|
||||||
|
@ -333,7 +333,15 @@ XVisualInfo GlxContext::selectBestVisual(::Display* display, unsigned int bitsPe
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Extract the components of the current visual
|
// Extract the components of the current visual
|
||||||
int red, green, blue, alpha, depth, stencil, multiSampling, samples, sRgb;
|
int red;
|
||||||
|
int green;
|
||||||
|
int blue;
|
||||||
|
int alpha;
|
||||||
|
int depth;
|
||||||
|
int stencil;
|
||||||
|
int multiSampling;
|
||||||
|
int samples;
|
||||||
|
int sRgb;
|
||||||
glXGetConfig(display, &visuals[i], GLX_RED_SIZE, &red);
|
glXGetConfig(display, &visuals[i], GLX_RED_SIZE, &red);
|
||||||
glXGetConfig(display, &visuals[i], GLX_GREEN_SIZE, &green);
|
glXGetConfig(display, &visuals[i], GLX_GREEN_SIZE, &green);
|
||||||
glXGetConfig(display, &visuals[i], GLX_BLUE_SIZE, &blue);
|
glXGetConfig(display, &visuals[i], GLX_BLUE_SIZE, &blue);
|
||||||
@ -402,7 +410,11 @@ XVisualInfo GlxContext::selectBestVisual(::Display* display, unsigned int bitsPe
|
|||||||
void GlxContext::updateSettingsFromVisualInfo(XVisualInfo* visualInfo)
|
void GlxContext::updateSettingsFromVisualInfo(XVisualInfo* visualInfo)
|
||||||
{
|
{
|
||||||
// Update the creation settings from the chosen format
|
// Update the creation settings from the chosen format
|
||||||
int depth, stencil, multiSampling, samples, sRgb;
|
int depth;
|
||||||
|
int stencil;
|
||||||
|
int multiSampling;
|
||||||
|
int samples;
|
||||||
|
int sRgb;
|
||||||
glXGetConfig(m_display, visualInfo, GLX_DEPTH_SIZE, &depth);
|
glXGetConfig(m_display, visualInfo, GLX_DEPTH_SIZE, &depth);
|
||||||
glXGetConfig(m_display, visualInfo, GLX_STENCIL_SIZE, &stencil);
|
glXGetConfig(m_display, visualInfo, GLX_STENCIL_SIZE, &stencil);
|
||||||
|
|
||||||
|
@ -194,9 +194,12 @@ bool InputImpl::isMouseButtonPressed(Mouse::Button button)
|
|||||||
Display* display = openDisplay();
|
Display* display = openDisplay();
|
||||||
|
|
||||||
// we don't care about these but they are required
|
// we don't care about these but they are required
|
||||||
::Window root, child;
|
::Window root;
|
||||||
int wx, wy;
|
::Window child;
|
||||||
int gx, gy;
|
int wx;
|
||||||
|
int wy;
|
||||||
|
int gx;
|
||||||
|
int gy;
|
||||||
|
|
||||||
unsigned int buttons = 0;
|
unsigned int buttons = 0;
|
||||||
XQueryPointer(display, DefaultRootWindow(display), &root, &child, &gx, &gy, &wx, &wy, &buttons);
|
XQueryPointer(display, DefaultRootWindow(display), &root, &child, &gx, &gy, &wx, &wy, &buttons);
|
||||||
@ -230,8 +233,10 @@ Vector2i InputImpl::getMousePosition()
|
|||||||
Display* display = openDisplay();
|
Display* display = openDisplay();
|
||||||
|
|
||||||
// we don't care about these but they are required
|
// we don't care about these but they are required
|
||||||
::Window root, child;
|
::Window root;
|
||||||
int x, y;
|
::Window child;
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
unsigned int buttons;
|
unsigned int buttons;
|
||||||
|
|
||||||
int gx = 0;
|
int gx = 0;
|
||||||
@ -255,8 +260,10 @@ Vector2i InputImpl::getMousePosition(const WindowBase& relativeTo)
|
|||||||
Display* display = openDisplay();
|
Display* display = openDisplay();
|
||||||
|
|
||||||
// we don't care about these but they are required
|
// we don't care about these but they are required
|
||||||
::Window root, child;
|
::Window root;
|
||||||
int gx, gy;
|
::Window child;
|
||||||
|
int gx;
|
||||||
|
int gy;
|
||||||
unsigned int buttons;
|
unsigned int buttons;
|
||||||
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
|
@ -286,7 +286,8 @@ bool ewmhSupported()
|
|||||||
// Get the parent window.
|
// Get the parent window.
|
||||||
::Window getParentWindow(::Display* disp, ::Window win)
|
::Window getParentWindow(::Display* disp, ::Window win)
|
||||||
{
|
{
|
||||||
::Window root, parent;
|
::Window root;
|
||||||
|
::Window parent;
|
||||||
::Window* children = nullptr;
|
::Window* children = nullptr;
|
||||||
unsigned int numChildren;
|
unsigned int numChildren;
|
||||||
|
|
||||||
@ -858,7 +859,8 @@ Vector2i WindowImplX11::getPosition() const
|
|||||||
// go using setPosition() and XMoveWindow(). To have the two match
|
// go using setPosition() and XMoveWindow(). To have the two match
|
||||||
// as expected, we may have to subtract decorations and borders.
|
// as expected, we may have to subtract decorations and borders.
|
||||||
::Window child;
|
::Window child;
|
||||||
int xAbsRelToRoot, yAbsRelToRoot;
|
int xAbsRelToRoot;
|
||||||
|
int yAbsRelToRoot;
|
||||||
|
|
||||||
XTranslateCoordinates(m_display, m_window, DefaultRootWindow(m_display), 0, 0, &xAbsRelToRoot, &yAbsRelToRoot, &child);
|
XTranslateCoordinates(m_display, m_window, DefaultRootWindow(m_display), 0, 0, &xAbsRelToRoot, &yAbsRelToRoot, &child);
|
||||||
|
|
||||||
@ -871,7 +873,8 @@ Vector2i WindowImplX11::getPosition() const
|
|||||||
// CASE 2: most modern WMs support EWMH and can define _NET_FRAME_EXTENTS
|
// CASE 2: most modern WMs support EWMH and can define _NET_FRAME_EXTENTS
|
||||||
// with the exact frame size to subtract, so if present, we prefer it and
|
// with the exact frame size to subtract, so if present, we prefer it and
|
||||||
// query it first. According to spec, this already includes any borders.
|
// query it first. According to spec, this already includes any borders.
|
||||||
long xFrameExtent, yFrameExtent;
|
long xFrameExtent;
|
||||||
|
long yFrameExtent;
|
||||||
|
|
||||||
if (getEWMHFrameExtents(m_display, m_window, xFrameExtent, yFrameExtent))
|
if (getEWMHFrameExtents(m_display, m_window, xFrameExtent, yFrameExtent))
|
||||||
{
|
{
|
||||||
@ -904,8 +907,12 @@ Vector2i WindowImplX11::getPosition() const
|
|||||||
|
|
||||||
// Get final X/Y coordinates: take the relative position to
|
// Get final X/Y coordinates: take the relative position to
|
||||||
// the root of the furthest ancestor window.
|
// the root of the furthest ancestor window.
|
||||||
int xRelToRoot, yRelToRoot;
|
int xRelToRoot;
|
||||||
unsigned int width, height, borderWidth, depth;
|
int yRelToRoot;
|
||||||
|
unsigned int width;
|
||||||
|
unsigned int height;
|
||||||
|
unsigned int borderWidth;
|
||||||
|
unsigned int depth;
|
||||||
|
|
||||||
XGetGeometry(m_display, ancestor, &root, &xRelToRoot, &yRelToRoot, &width, &height, &borderWidth, &depth);
|
XGetGeometry(m_display, ancestor, &root, &xRelToRoot, &yRelToRoot, &width, &height, &borderWidth, &depth);
|
||||||
|
|
||||||
@ -1331,7 +1338,8 @@ void WindowImplX11::setVideoMode(const VideoMode& mode)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Check if the XRandR extension is present
|
// Check if the XRandR extension is present
|
||||||
int xRandRMajor, xRandRMinor;
|
int xRandRMajor;
|
||||||
|
int xRandRMinor;
|
||||||
if (!checkXRandR(xRandRMajor, xRandRMinor))
|
if (!checkXRandR(xRandRMajor, xRandRMinor))
|
||||||
{
|
{
|
||||||
// XRandR extension is not supported: we cannot use fullscreen mode
|
// XRandR extension is not supported: we cannot use fullscreen mode
|
||||||
@ -1426,7 +1434,8 @@ void WindowImplX11::resetVideoMode()
|
|||||||
{
|
{
|
||||||
// Try to set old configuration
|
// Try to set old configuration
|
||||||
// Check if the XRandR extension
|
// Check if the XRandR extension
|
||||||
int xRandRMajor, xRandRMinor;
|
int xRandRMajor;
|
||||||
|
int xRandRMinor;
|
||||||
if (checkXRandR(xRandRMajor, xRandRMinor))
|
if (checkXRandR(xRandRMajor, xRandRMinor))
|
||||||
{
|
{
|
||||||
XRRScreenResources* res = XRRGetScreenResources(m_display, DefaultRootWindow(m_display));
|
XRRScreenResources* res = XRRGetScreenResources(m_display, DefaultRootWindow(m_display));
|
||||||
@ -2215,7 +2224,8 @@ Vector2i WindowImplX11::getPrimaryMonitorPosition()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get xRandr version
|
// Get xRandr version
|
||||||
int xRandRMajor, xRandRMinor;
|
int xRandRMajor;
|
||||||
|
int xRandRMinor;
|
||||||
if (!checkXRandR(xRandRMajor, xRandRMinor))
|
if (!checkXRandR(xRandRMajor, xRandRMinor))
|
||||||
xRandRMajor = xRandRMinor = 0;
|
xRandRMajor = xRandRMinor = 0;
|
||||||
|
|
||||||
|
@ -428,7 +428,8 @@ void WindowImplWin32::setKeyRepeatEnabled(bool enabled)
|
|||||||
void WindowImplWin32::requestFocus()
|
void WindowImplWin32::requestFocus()
|
||||||
{
|
{
|
||||||
// Allow focus stealing only within the same process; compare PIDs of current and foreground window
|
// Allow focus stealing only within the same process; compare PIDs of current and foreground window
|
||||||
DWORD thisPid, foregroundPid;
|
DWORD thisPid;
|
||||||
|
DWORD foregroundPid;
|
||||||
GetWindowThreadProcessId(m_handle, &thisPid);
|
GetWindowThreadProcessId(m_handle, &thisPid);
|
||||||
GetWindowThreadProcessId(GetForegroundWindow(), &foregroundPid);
|
GetWindowThreadProcessId(GetForegroundWindow(), &foregroundPid);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user