Replaced anonymous enums with constexpr per #2328

Addressed review comments


Addressed review comments


Changed NOLINTBEGIN/END to NOLINTNEXTLINE


Addressed CI complaint


Fixed BSD CI issues
This commit is contained in:
Norm Evangelista 2023-01-24 14:14:06 -08:00 committed by Chris Thrasher
parent ca5ca65004
commit 4c8b770992
8 changed files with 24 additions and 33 deletions

View File

@ -327,11 +327,10 @@ private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
void awaitStreamingThread(); void awaitStreamingThread();
enum // NOLINTBEGIN(readability-identifier-naming)
{ static constexpr unsigned int BufferCount{3}; //!< Number of audio buffers used by the streaming loop
BufferCount = 3, //!< Number of audio buffers used by the streaming loop static constexpr unsigned int BufferRetries{2}; //!< Number of retries (excluding initial try) for onGetData()
BufferRetries = 2 //!< Number of retries (excluding initial try) for onGetData() // NOLINTEND(readability-identifier-naming)
};
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Member data // Member data

View File

@ -479,10 +479,7 @@ private:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
struct StatesCache struct StatesCache
{ {
enum static constexpr std::size_t VertexCacheSize{4}; // NOLINT(readability-identifier-naming)
{
VertexCacheSize = 4
};
bool enable; //!< Is the cache enabled? bool enable; //!< Is the cache enabled?
bool glStatesSet{}; //!< Are our internal GL states set yet? bool glStatesSet{}; //!< Are our internal GL states set yet?

View File

@ -62,10 +62,8 @@ public:
/// \brief Some special values used by sockets /// \brief Some special values used by sockets
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
enum // NOLINTNEXTLINE(readability-identifier-naming)
{ static constexpr unsigned short AnyPort{0}; //!< Special value that tells the system to pick any available port
AnyPort = 0 //!< Special value that tells the system to pick any available port
};
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Destructor /// \brief Destructor

View File

@ -50,10 +50,8 @@ public:
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Constants // Constants
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
enum // NOLINTNEXTLINE(readability-identifier-naming)
{ static constexpr std::size_t MaxDatagramSize{65507}; //!< The maximum number of bytes that can be sent in a single UDP datagram
MaxDatagramSize = 65507 //!< The maximum number of bytes that can be sent in a single UDP datagram
};
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Default constructor /// \brief Default constructor

View File

@ -41,12 +41,11 @@ namespace sf::Joystick
/// \brief Constants related to joysticks capabilities /// \brief Constants related to joysticks capabilities
/// ///
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
enum // NOLINTBEGIN(readability-identifier-naming)
{ static constexpr unsigned int Count{8}; //!< Maximum number of supported joysticks
Count = 8, //!< Maximum number of supported joysticks static constexpr unsigned int ButtonCount{32}; //!< Maximum number of supported buttons
ButtonCount = 32, //!< Maximum number of supported buttons static constexpr unsigned int AxisCount{8}; //!< Maximum number of supported axes
AxisCount = 8 //!< Maximum number of supported axes // NOLINTEND(readability-identifier-naming)
};
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
/// \brief Axes supported by SFML joysticks /// \brief Axes supported by SFML joysticks

View File

@ -113,7 +113,7 @@ void updatePluggedList()
if (directory) if (directory)
{ {
int joystickCount = 0; unsigned int joystickCount = 0;
struct dirent* directoryEntry = readdir(directory); struct dirent* directoryEntry = readdir(directory);
while (directoryEntry && joystickCount < sf::Joystick::Count) while (directoryEntry && joystickCount < sf::Joystick::Count)

View File

@ -114,7 +114,7 @@ void updatePluggedList()
if (directory) if (directory)
{ {
int joystickCount = 0; unsigned int joystickCount = 0;
struct dirent* directoryEntry = readdir(directory); struct dirent* directoryEntry = readdir(directory);
while (directoryEntry && joystickCount < sf::Joystick::Count) while (directoryEntry && joystickCount < sf::Joystick::Count)

View File

@ -668,7 +668,7 @@ bool JoystickImpl::openDInput(unsigned int index)
data[8 * 4 + i].dwFlags = 0; data[8 * 4 + i].dwFlags = 0;
} }
for (int i = 0; i < sf::Joystick::ButtonCount; ++i) for (unsigned int i = 0; i < sf::Joystick::ButtonCount; ++i)
{ {
data[8 * 4 + 4 + i].pguid = nullptr; data[8 * 4 + 4 + i].pguid = nullptr;
data[8 * 4 + 4 + i].dwOfs = static_cast<DWORD>(DIJOFS_BUTTON(i)); data[8 * 4 + 4 + i].dwOfs = static_cast<DWORD>(DIJOFS_BUTTON(i));
@ -872,7 +872,7 @@ JoystickCaps JoystickImpl::getCapabilitiesDInput() const
} }
// Check which axes have valid offsets // Check which axes have valid offsets
for (int i = 0; i < Joystick::AxisCount; ++i) for (unsigned int i = 0; i < Joystick::AxisCount; ++i)
caps.axes[i] = (m_axes[i] != -1); caps.axes[i] = (m_axes[i] != -1);
return caps; return caps;
@ -923,7 +923,7 @@ JoystickState JoystickImpl::updateDInputBuffered()
bool eventHandled = false; bool eventHandled = false;
// Get the current state of each axis // Get the current state of each axis
for (int j = 0; j < Joystick::AxisCount; ++j) for (unsigned int j = 0; j < Joystick::AxisCount; ++j)
{ {
if (m_axes[j] == static_cast<int>(events[i].dwOfs)) if (m_axes[j] == static_cast<int>(events[i].dwOfs))
{ {
@ -959,7 +959,7 @@ JoystickState JoystickImpl::updateDInputBuffered()
continue; continue;
// Get the current state of each button // Get the current state of each button
for (int j = 0; j < Joystick::ButtonCount; ++j) for (unsigned int j = 0; j < Joystick::ButtonCount; ++j)
{ {
if (m_buttons[j] == static_cast<int>(events[i].dwOfs)) if (m_buttons[j] == static_cast<int>(events[i].dwOfs))
m_state.buttons[j] = (events[i].dwData != 0); m_state.buttons[j] = (events[i].dwData != 0);
@ -1012,7 +1012,7 @@ JoystickState JoystickImpl::updateDInputPolled()
} }
// Get the current state of each axis // Get the current state of each axis
for (int i = 0; i < Joystick::AxisCount; ++i) for (unsigned int i = 0; i < Joystick::AxisCount; ++i)
{ {
if (m_axes[i] != -1) if (m_axes[i] != -1)
{ {
@ -1049,7 +1049,7 @@ JoystickState JoystickImpl::updateDInputPolled()
} }
// Get the current state of each button // Get the current state of each button
for (int i = 0; i < Joystick::ButtonCount; ++i) for (unsigned int i = 0; i < Joystick::ButtonCount; ++i)
{ {
if (m_buttons[i] != -1) if (m_buttons[i] != -1)
{ {
@ -1153,11 +1153,11 @@ BOOL CALLBACK JoystickImpl::deviceObjectEnumerationCallback(const DIDEVICEOBJECT
else if (DIDFT_GETTYPE(deviceObjectInstance->dwType) & DIDFT_BUTTON) else if (DIDFT_GETTYPE(deviceObjectInstance->dwType) & DIDFT_BUTTON)
{ {
// Buttons // Buttons
for (int i = 0; i < Joystick::ButtonCount; ++i) for (unsigned int i = 0; i < Joystick::ButtonCount; ++i)
{ {
if (joystick.m_buttons[i] == -1) if (joystick.m_buttons[i] == -1)
{ {
joystick.m_buttons[i] = DIJOFS_BUTTON(i); joystick.m_buttons[i] = DIJOFS_BUTTON(static_cast<int>(i));
break; break;
} }
} }