Skip to content

Commit

Permalink
Run clang-format-14
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisThrasher committed Oct 8, 2024
1 parent 328c27d commit 2194ee6
Show file tree
Hide file tree
Showing 32 changed files with 99 additions and 101 deletions.
8 changes: 4 additions & 4 deletions examples/event_handling/EventHandling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,10 @@ class Application
// Member data
////////////////////////////////////////////////////////////
sf::RenderWindow m_window{sf::VideoMode({800u, 600u}), "SFML Event Handling", sf::Style::Titlebar | sf::Style::Close};
const sf::Font m_font{"resources/tuffy.ttf"};
sf::Text m_logText{m_font, "", 20};
sf::Text m_handlerText{m_font, "Current Handler: Classic", 24};
sf::Text m_instructions{m_font, "Press Enter to change handler type", 24};
const sf::Font m_font{"resources/tuffy.ttf"};
sf::Text m_logText{m_font, "", 20};
sf::Text m_handlerText{m_font, "Current Handler: Classic", 24};
sf::Text m_instructions{m_font, "Press Enter to change handler type", 24};
std::vector<std::string> m_log;
HandlerType m_handlerType{HandlerType::Classic};
};
Expand Down
10 changes: 5 additions & 5 deletions include/SFML/Audio/InputSoundFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,12 @@ class SFML_AUDIO_API InputSoundFile
////////////////////////////////////////////////////////////
// Member data
////////////////////////////////////////////////////////////
std::unique_ptr<SoundFileReader> m_reader; //!< Reader that handles I/O on the file's format
std::unique_ptr<SoundFileReader> m_reader; //!< Reader that handles I/O on the file's format
std::unique_ptr<InputStream, StreamDeleter> m_stream{nullptr, false}; //!< Input stream used to access the file's data
std::uint64_t m_sampleOffset{}; //!< Sample Read Position
std::uint64_t m_sampleCount{}; //!< Total number of samples in the file
unsigned int m_sampleRate{}; //!< Number of samples per second
std::vector<SoundChannel> m_channelMap; //!< The map of position in sample frame to sound channel
std::uint64_t m_sampleOffset{}; //!< Sample Read Position
std::uint64_t m_sampleCount{}; //!< Total number of samples in the file
unsigned int m_sampleRate{}; //!< Number of samples per second
std::vector<SoundChannel> m_channelMap; //!< The map of position in sample frame to sound channel
};

} // namespace sf
Expand Down
4 changes: 2 additions & 2 deletions include/SFML/Audio/SoundBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ class SFML_AUDIO_API SoundBuffer
std::vector<std::int16_t> m_samples; //!< Samples buffer
unsigned int m_sampleRate{44100}; //!< Number of samples per second
std::vector<SoundChannel> m_channelMap{SoundChannel::Mono}; //!< The map of position in sample frame to sound channel
Time m_duration; //!< Sound duration
mutable SoundList m_sounds; //!< List of sounds that are using this buffer
Time m_duration; //!< Sound duration
mutable SoundList m_sounds; //!< List of sounds that are using this buffer
};

} // namespace sf
Expand Down
2 changes: 1 addition & 1 deletion include/SFML/Graphics/StencilMode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ struct SFML_GRAPHICS_API StencilMode
StencilUpdateOperation::Keep}; //!< The update operation to perform if the stencil test passes
StencilValue stencilReference{0}; //!< The reference value we're performing the stencil test with
StencilValue stencilMask{~0u}; //!< The mask to apply to both the reference value and the value in the stencil buffer
bool stencilOnly{}; //!< Whether we should update the color buffer in addition to the stencil buffer
bool stencilOnly{}; //!< Whether we should update the color buffer in addition to the stencil buffer
};

////////////////////////////////////////////////////////////
Expand Down
8 changes: 4 additions & 4 deletions include/SFML/Network/Http.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,10 @@ class SFML_NETWORK_API Http
NotModified = 304, //!< For conditional requests, means the requested page hasn't changed and doesn't need to be refreshed

// 4xx: client error
BadRequest = 400, //!< The server couldn't understand the request (syntax error)
Unauthorized = 401, //!< The requested page needs an authentication to be accessed
Forbidden = 403, //!< The requested page cannot be accessed at all, even with authentication
NotFound = 404, //!< The requested page doesn't exist
BadRequest = 400, //!< The server couldn't understand the request (syntax error)
Unauthorized = 401, //!< The requested page needs an authentication to be accessed
Forbidden = 403, //!< The requested page cannot be accessed at all, even with authentication
NotFound = 404, //!< The requested page doesn't exist
RangeNotSatisfiable = 407, //!< The server can't satisfy the partial GET request (with a "Range" header field)

// 5xx: server error
Expand Down
4 changes: 2 additions & 2 deletions include/SFML/Window/Event.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ class Event
struct MouseWheelScrolled
{
Mouse::Wheel wheel{}; //!< Which wheel (for mice with multiple ones)
float delta{}; //!< Wheel offset (positive is up/left, negative is down/right). High-precision mice may use non-integral offsets.
Vector2i position; //!< Position of the mouse pointer, relative to the top left of the owner window
float delta{}; //!< Wheel offset (positive is up/left, negative is down/right). High-precision mice may use non-integral offsets.
Vector2i position; //!< Position of the mouse pointer, relative to the top left of the owner window
};

////////////////////////////////////////////////////////////
Expand Down
6 changes: 2 additions & 4 deletions src/SFML/Audio/MiniaudioUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,8 @@ MiniaudioUtils::SoundBase::SoundBase(const ma_data_source_vtable& dataSource
if (const ma_result result = ma_data_source_init(&config, &dataSourceBase); result != MA_SUCCESS)
err() << "Failed to initialize audio data source: " << ma_result_description(result) << std::endl;

resourceEntryIter = AudioDevice::registerResource(
this,
[](void* ptr) { static_cast<SoundBase*>(ptr)->deinitialize(); },
reinitializeFunc);
resourceEntryIter = AudioDevice::
registerResource(this, [](void* ptr) { static_cast<SoundBase*>(ptr)->deinitialize(); }, reinitializeFunc);
}


Expand Down
10 changes: 5 additions & 5 deletions src/SFML/Audio/MiniaudioUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ struct SoundBase
};

ma_data_source_base dataSourceBase{}; //!< The struct that makes this object a miniaudio data source (must be first member)
ma_node_vtable effectNodeVTable{}; //!< Vtable of the effect node
EffectNode effectNode; //!< The engine node that performs effect processing
ma_node_vtable effectNodeVTable{}; //!< Vtable of the effect node
EffectNode effectNode; //!< The engine node that performs effect processing
std::vector<ma_channel> soundChannelMap; //!< The map of position in sample frame to sound channel (miniaudio channels)
ma_sound sound{}; //!< The sound
SoundSource::Status status{SoundSource::Status::Stopped}; //!< The status
SoundSource::EffectProcessor effectProcessor; //!< The effect processor
ma_sound sound{}; //!< The sound
SoundSource::Status status{SoundSource::Status::Stopped}; //!< The status
SoundSource::EffectProcessor effectProcessor; //!< The effect processor
AudioDevice::ResourceEntryIter resourceEntryIter; //!< Iterator to the resource entry registered with the AudioDevice
MiniaudioUtils::SavedSettings savedSettings; //!< Saved settings used to restore ma_sound state in case we need to recreate it
};
Expand Down
18 changes: 9 additions & 9 deletions src/SFML/Audio/SoundStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,15 @@ struct SoundStream::Impl : priv::MiniaudioUtils::SoundBase
// Member data
////////////////////////////////////////////////////////////
static constexpr ma_data_source_vtable vtable{read, seek, getFormat, getCursor, getLength, setLooping, /* flags */ 0};
SoundStream* owner; //!< Owning SoundStream object
std::vector<std::int16_t> sampleBuffer; //!< Our temporary sample buffer
std::size_t sampleBufferCursor{}; //!< The current read position in the temporary sample buffer
std::uint64_t samplesProcessed{}; //!< Number of samples processed since beginning of the stream
unsigned int channelCount{}; //!< Number of channels (1 = mono, 2 = stereo, ...)
unsigned int sampleRate{}; //!< Frequency (samples / second)
std::vector<SoundChannel> channelMap; //!< The map of position in sample frame to sound channel
bool loop{}; //!< Loop flag (true to loop, false to play once)
bool streaming{true}; //!< True if we are still streaming samples from the source
SoundStream* owner; //!< Owning SoundStream object
std::vector<std::int16_t> sampleBuffer; //!< Our temporary sample buffer
std::size_t sampleBufferCursor{}; //!< The current read position in the temporary sample buffer
std::uint64_t samplesProcessed{}; //!< Number of samples processed since beginning of the stream
unsigned int channelCount{}; //!< Number of channels (1 = mono, 2 = stereo, ...)
unsigned int sampleRate{}; //!< Frequency (samples / second)
std::vector<SoundChannel> channelMap; //!< The map of position in sample frame to sound channel
bool loop{}; //!< Loop flag (true to loop, false to play once)
bool streaming{true}; //!< True if we are still streaming samples from the source
};


Expand Down
2 changes: 1 addition & 1 deletion src/SFML/Graphics/Image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ bool Image::copy(const Image& source, Vector2u dest, const IntRect& sourceRect,
const unsigned int dstStride = m_size.x * 4;

const std::uint8_t* srcPixels = source.m_pixels.data() + (srcRect.position.x + srcRect.position.y * source.m_size.x) * 4;
std::uint8_t* dstPixels = m_pixels.data() + (dest.x + dest.y * m_size.x) * 4;
std::uint8_t* dstPixels = m_pixels.data() + (dest.x + dest.y * m_size.x) * 4;

// Copy the pixels
if (applyAlpha)
Expand Down
2 changes: 1 addition & 1 deletion src/SFML/Graphics/RenderTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ void RenderTarget::drawPrimitives(PrimitiveType type, std::size_t firstVertex, s
{
// Find the OpenGL primitive type
static constexpr GLenum modes[] = {GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN};
const GLenum mode = modes[static_cast<std::size_t>(type)];
const GLenum mode = modes[static_cast<std::size_t>(type)];

// Draw the primitives
glCheck(glDrawArrays(mode, static_cast<GLint>(firstVertex), static_cast<GLsizei>(vertexCount)));
Expand Down
8 changes: 4 additions & 4 deletions src/SFML/Graphics/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,10 +515,10 @@ Image Texture::copyToImage() const
glCheck(glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, allPixels.data()));

// Then we copy the useful pixels from the temporary array to the final one
const std::uint8_t* src = allPixels.data();
std::uint8_t* dst = pixels.data();
int srcPitch = static_cast<int>(m_actualSize.x * 4);
const unsigned int dstPitch = m_size.x * 4;
const std::uint8_t* src = allPixels.data();
std::uint8_t* dst = pixels.data();
int srcPitch = static_cast<int>(m_actualSize.x * 4);
const unsigned int dstPitch = m_size.x * 4;

// Handle the case where source pixels are flipped vertically
if (m_pixelsFlipped)
Expand Down
2 changes: 1 addition & 1 deletion src/SFML/Main/MainAndroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void goToFullscreenMode(ANativeActivity& activity)
// API Level 19
if (apiLevel >= 19)
{
jfieldID fieldSystemUiFlagImmersiveSticky = lJNIEnv->GetStaticFieldID(classView,
jfieldID fieldSystemUiFlagImmersiveSticky = lJNIEnv->GetStaticFieldID(classView,
"SYSTEM_UI_FLAG_IMMERSIVE_STICKY",
"I");
const jint systemUiFlagImmersiveSticky = lJNIEnv->GetStaticIntField(classView, fieldSystemUiFlagImmersiveSticky);
Expand Down
4 changes: 2 additions & 2 deletions src/SFML/Network/Packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ Packet& Packet::operator<<(std::int64_t data)
static_cast<std::uint8_t>((data >> 24) & 0xFF),
static_cast<std::uint8_t>((data >> 16) & 0xFF),
static_cast<std::uint8_t>((data >> 8) & 0xFF),
static_cast<std::uint8_t>((data)&0xFF)};
static_cast<std::uint8_t>((data) & 0xFF)};

append(&toWrite, sizeof(toWrite));
return *this;
Expand All @@ -461,7 +461,7 @@ Packet& Packet::operator<<(std::uint64_t data)
static_cast<std::uint8_t>((data >> 24) & 0xFF),
static_cast<std::uint8_t>((data >> 16) & 0xFF),
static_cast<std::uint8_t>((data >> 8) & 0xFF),
static_cast<std::uint8_t>((data)&0xFF)};
static_cast<std::uint8_t>((data) & 0xFF)};

append(&toWrite, sizeof(toWrite));
return *this;
Expand Down
48 changes: 24 additions & 24 deletions src/SFML/Window/DRM/DRMContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,33 +757,33 @@ EGLConfig DRMContext::getBestConfig(EGLDisplay display, unsigned int bitsPerPixe
{
// Set our video settings constraint
const EGLint attributes[] =
{ EGL_BUFFER_SIZE,
static_cast<EGLint>(bitsPerPixel),
EGL_DEPTH_SIZE,
static_cast<EGLint>(settings.depthBits),
EGL_STENCIL_SIZE,
static_cast<EGLint>(settings.stencilBits),
EGL_SAMPLE_BUFFERS,
static_cast<EGLint>(settings.antiAliasingLevel),
EGL_BLUE_SIZE,
8,
EGL_GREEN_SIZE,
8,
EGL_RED_SIZE,
8,
EGL_ALPHA_SIZE,
8,

EGL_SURFACE_TYPE,
EGL_WINDOW_BIT,
{EGL_BUFFER_SIZE,
static_cast<EGLint>(bitsPerPixel),
EGL_DEPTH_SIZE,
static_cast<EGLint>(settings.depthBits),
EGL_STENCIL_SIZE,
static_cast<EGLint>(settings.stencilBits),
EGL_SAMPLE_BUFFERS,
static_cast<EGLint>(settings.antiAliasingLevel),
EGL_BLUE_SIZE,
8,
EGL_GREEN_SIZE,
8,
EGL_RED_SIZE,
8,
EGL_ALPHA_SIZE,
8,

EGL_SURFACE_TYPE,
EGL_WINDOW_BIT,
#if defined(SFML_OPENGL_ES)
EGL_RENDERABLE_TYPE,
EGL_OPENGL_ES_BIT,
EGL_RENDERABLE_TYPE,
EGL_OPENGL_ES_BIT,
#else
EGL_RENDERABLE_TYPE,
EGL_OPENGL_BIT,
EGL_RENDERABLE_TYPE,
EGL_OPENGL_BIT,
#endif
EGL_NONE };
EGL_NONE};

EGLint configCount = 0;
EGLConfig configs[1];
Expand Down
2 changes: 1 addition & 1 deletion src/SFML/Window/DRM/InputImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void uninitFileDescriptors()
}

#define BITS_PER_LONG (sizeof(unsigned long) * 8)
#define NBITS(x) ((((x)-1) / BITS_PER_LONG) + 1)
#define NBITS(x) ((((x) - 1) / BITS_PER_LONG) + 1)
#define OFF(x) ((x) % BITS_PER_LONG)
#define LONG(x) ((x) / BITS_PER_LONG)
#define TEST_BIT(bit, array) (((array)[LONG(bit)] >> OFF(bit)) & 1)
Expand Down
2 changes: 1 addition & 1 deletion src/SFML/Window/EglContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ XVisualInfo EglContext::selectBestVisual(::Display* xDisplay, unsigned int bitsP
vTemplate.visualid = static_cast<VisualID>(nativeVisualId);

// Get X11 visuals compatible with this EGL config
int visualCount = 0;
int visualCount = 0;
const auto availableVisuals = X11Ptr<XVisualInfo[]>(XGetVisualInfo(xDisplay, VisualIDMask, &vTemplate, &visualCount));

if (visualCount == 0)
Expand Down
2 changes: 1 addition & 1 deletion src/SFML/Window/GlContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ void GlContext::initialize(const ContextSettings& requestedSettings)
void GlContext::checkSettings(const ContextSettings& requestedSettings) const
{
// Perform checks to inform the user if they are getting a context they might not have expected
const int version = static_cast<int>(m_settings.majorVersion * 10u + m_settings.minorVersion);
const int version = static_cast<int>(m_settings.majorVersion * 10u + m_settings.minorVersion);
const int requestedVersion = static_cast<int>(requestedSettings.majorVersion * 10u + requestedSettings.minorVersion);

if ((m_settings.attributeFlags != requestedSettings.attributeFlags) || (version < requestedVersion) ||
Expand Down
4 changes: 2 additions & 2 deletions src/SFML/Window/Unix/CursorImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ bool CursorImpl::loadFromPixelsARGB(const std::uint8_t* pixels, Vector2u size, V
{
// Create cursor image, convert from RGBA to ARGB.
const auto cursorImage = X11Ptr<XcursorImage>(XcursorImageCreate(static_cast<int>(size.x), static_cast<int>(size.y)));
cursorImage->xhot = hotspot.x;
cursorImage->yhot = hotspot.y;
cursorImage->xhot = hotspot.x;
cursorImage->yhot = hotspot.y;

const std::size_t numPixels = static_cast<std::size_t>(size.x) * static_cast<std::size_t>(size.y);
for (std::size_t pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex)
Expand Down
2 changes: 1 addition & 1 deletion src/SFML/Window/Unix/JoystickImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ JoystickCaps JoystickImpl::getCapabilities() const
{
switch (m_mapping[static_cast<std::size_t>(i)])
{
// clang-format off
// clang-format off
case ABS_X: caps.axes[Joystick::Axis::X] = true; break;
case ABS_Y: caps.axes[Joystick::Axis::Y] = true; break;
case ABS_Z:
Expand Down
4 changes: 2 additions & 2 deletions src/SFML/Window/Unix/KeyboardImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
namespace
{

const KeyCode nullKeyCode = 0;
const int maxKeyCode = 256;
const KeyCode nullKeyCode = 0;
const int maxKeyCode = 256;
sf::priv::EnumArray<sf::Keyboard::Scancode, KeyCode, sf::Keyboard::ScancodeCount> scancodeToKeycode; ///< Mapping of SFML scancode to X11 KeyCode
std::array<sf::Keyboard::Scancode, maxKeyCode> keycodeToScancode; ///< Mapping of X11 KeyCode to SFML scancode

Expand Down
16 changes: 8 additions & 8 deletions src/SFML/Window/Unix/WindowImplX11.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,15 @@ class WindowImplX11 : public WindowImpl
RRCrtc m_oldRRCrtc{}; ///< RRCrtc in use before we switch to fullscreen
::Cursor m_hiddenCursor{}; ///< As X11 doesn't provide cursor hiding, we must create a transparent one
::Cursor m_lastCursor{None}; ///< Last cursor used -- this data is not owned by the window and is required to be always valid
bool m_keyRepeat{true}; ///< Is the KeyRepeat feature enabled?
bool m_keyRepeat{true}; ///< Is the KeyRepeat feature enabled?
Vector2i m_previousSize{-1, -1}; ///< Previous size of the window, to find if a ConfigureNotify event is a resize event (could be a move event only)
bool m_useSizeHints{}; ///< Is the size of the window fixed with size hints?
bool m_fullscreen{}; ///< Is the window in fullscreen?
bool m_cursorGrabbed{}; ///< Is the mouse cursor trapped?
bool m_windowMapped{}; ///< Has the window been mapped by the window manager?
Pixmap m_iconPixmap{}; ///< The current icon pixmap if in use
Pixmap m_iconMaskPixmap{}; ///< The current icon mask pixmap if in use
::Time m_lastInputTime{}; ///< Last time we received user input
bool m_useSizeHints{}; ///< Is the size of the window fixed with size hints?
bool m_fullscreen{}; ///< Is the window in fullscreen?
bool m_cursorGrabbed{}; ///< Is the mouse cursor trapped?
bool m_windowMapped{}; ///< Has the window been mapped by the window manager?
Pixmap m_iconPixmap{}; ///< The current icon pixmap if in use
Pixmap m_iconMaskPixmap{}; ///< The current icon mask pixmap if in use
::Time m_lastInputTime{}; ///< Last time we received user input
};

} // namespace sf::priv
Loading

0 comments on commit 2194ee6

Please sign in to comment.