Use ranged-for loops

This commit is contained in:
Chris Thrasher authored and Lukas Dürrenberger committed 2024-02-19 23:30:30 +01:00
1 parent 7676dfd95e
commit 3401cade6e
3 files changed
+9 -9

No files matched your search

+2 -2
View File
@@ -90,9 +90,9 @@ const char** sfSoundRecorder_getAvailableDevices(size_t* count)
if (cstringDevices.empty() && !stringDevices.empty()) if (cstringDevices.empty() && !stringDevices.empty())
{ {
for (std::vector<std::string>::const_iterator it = stringDevices.begin(); it != stringDevices.end(); ++it) for (const auto& stringDevice : stringDevices)
{ {
cstringDevices.push_back(it->c_str()); cstringDevices.push_back(stringDevice.c_str());
} }
} }
+2 -2
View File
@@ -81,8 +81,8 @@ struct sfFtpListingResponse
~sfFtpListingResponse() ~sfFtpListingResponse()
{ {
for (std::vector<const char*>::iterator it = Filenames.begin(); it != Filenames.end(); ++it) for (const auto& filename : Filenames)
delete[] *it; delete[] filename;
} }
sf::Ftp::ListingResponse This; sf::Ftp::ListingResponse This;
+5 -5
View File
@@ -51,13 +51,13 @@ const sfVideoMode* sfVideoMode_getFullscreenModes(size_t* count)
// Populate the array on first call // Populate the array on first call
if (modes.empty()) if (modes.empty())
{ {
const std::vector<sf::VideoMode>& SFMLModes = sf::VideoMode::getFullscreenModes(); const std::vector<sf::VideoMode>& sfmlModes = sf::VideoMode::getFullscreenModes();
for (std::vector<sf::VideoMode>::const_iterator it = SFMLModes.begin(); it != SFMLModes.end(); ++it) for (const auto& sfmlMode : sfmlModes)
{ {
sfVideoMode mode; sfVideoMode mode;
mode.width = it->width; mode.width = sfmlMode.width;
mode.height = it->height; mode.height = sfmlMode.height;
mode.bitsPerPixel = it->bitsPerPixel; mode.bitsPerPixel = sfmlMode.bitsPerPixel;
modes.push_back(mode); modes.push_back(mode);
} }
} }