Run code through clang-modernize -loop-convert to create range-based for loops, and manually fix some stuff up.

This commit is contained in:
comex
2013-10-29 01:09:01 -04:00
parent 00fe5057f1
commit 965b32be9c
90 changed files with 688 additions and 739 deletions

View File

@ -221,8 +221,8 @@ void ControllerEmu::SaveConfig(IniFile::Section *sec, const std::string& base)
ControllerEmu::AnalogStick::AnalogStick(const char* const _name) : ControlGroup(_name, GROUP_TYPE_STICK)
{
for (unsigned int i = 0; i < 4; ++i)
controls.push_back(new Input(named_directions[i]));
for (auto& named_direction : named_directions)
controls.push_back(new Input(named_direction));
controls.push_back(new Input(_trans("Modifier")));
@ -290,8 +290,8 @@ ControllerEmu::Cursor::Cursor(const char* const _name)
: ControlGroup(_name, GROUP_TYPE_CURSOR)
, m_z(0)
{
for (unsigned int i = 0; i < 4; ++i)
controls.push_back(new Input(named_directions[i]));
for (auto& named_direction : named_directions)
controls.push_back(new Input(named_direction));
controls.push_back(new Input("Forward"));
controls.push_back(new Input("Backward"));
controls.push_back(new Input(_trans("Hide")));

View File

@ -222,9 +222,9 @@ Keyboard::Key::Key(IOHIDElementRef element, IOHIDDeviceRef device)
};
const uint32_t keycode = IOHIDElementGetUsage(m_element);
for (uint32_t i = 0; i < sizeof named_keys / sizeof *named_keys; i++)
if (named_keys[i].code == keycode) {
m_name = named_keys[i].name;
for (auto & named_key : named_keys)
if (named_key.code == keycode) {
m_name = named_key.name;
return;
}

View File

@ -160,12 +160,12 @@ void UDPWiimote::mainThread()
{
int maxfd=0;
FD_ZERO(&fds);
for (std::list<sock_t>::iterator i=d->sockfds.begin(); i!=d->sockfds.end(); i++)
for (auto& fd : d->sockfds)
{
FD_SET(*i,&fds);
FD_SET(fd,&fds);
#ifndef _WIN32
if (*i>=maxfd)
maxfd=(*i)+1;
if (fd>=maxfd)
maxfd=(fd)+1;
#endif
}
@ -194,11 +194,10 @@ void UDPWiimote::mainThread()
if (rt)
{
for (std::list<sock_t>::iterator i=d->sockfds.begin(); i!=d->sockfds.end(); i++)
for (sock_t fd : d->sockfds)
{
if (FD_ISSET(*i,&fds))
if (FD_ISSET(fd,&fds))
{
sock_t fd=*i;
u8 bf[64];
int size=60;
size_t addr_len;
@ -235,8 +234,8 @@ UDPWiimote::~UDPWiimote()
std::lock_guard<std::mutex> lk(d->termLock);
d->thread.join();
}
for (std::list<sock_t>::iterator i=d->sockfds.begin(); i!=d->sockfds.end(); i++)
close(*i);
for (auto& elem : d->sockfds)
close(elem);
close(d->bipv4_fd);
close(d->bipv6_fd);
cleanup;