chore: XWindowClipboard, use auto where possible

This commit is contained in:
sithlord48 2025-04-27 16:30:52 -04:00 committed by Nick Bolton
parent 3dfa3d5069
commit 5d4fbc8ea6

View file

@ -194,7 +194,7 @@ bool XWindowsClipboard::processRequest(Window requestor, ::Time /*time*/, Atom p
// find the property in the known requests. it should be the // find the property in the known requests. it should be the
// first property but we'll check 'em all if we have to. // first property but we'll check 'em all if we have to.
ReplyList &replies = index->second; ReplyList &replies = index->second;
for (ReplyList::iterator index2 = replies.begin(); index2 != replies.end(); ++index2) { for (auto index2 = replies.begin(); index2 != replies.end(); ++index2) {
Reply *reply = *index2; Reply *reply = *index2;
if (reply->m_replied && reply->m_property == property) { if (reply->m_replied && reply->m_property == property) {
// if reply is complete then remove it and start the // if reply is complete then remove it and start the
@ -356,7 +356,7 @@ std::string XWindowsClipboard::get(EFormat format) const
void XWindowsClipboard::clearConverters() void XWindowsClipboard::clearConverters()
{ {
for (ConverterList::iterator index = m_converters.begin(); index != m_converters.end(); ++index) { for (auto index = m_converters.begin(); index != m_converters.end(); ++index) {
delete *index; delete *index;
} }
m_converters.clear(); m_converters.clear();
@ -365,7 +365,7 @@ void XWindowsClipboard::clearConverters()
IXWindowsClipboardConverter *XWindowsClipboard::getConverter(Atom target, bool onlyIfNotAdded) const IXWindowsClipboardConverter *XWindowsClipboard::getConverter(Atom target, bool onlyIfNotAdded) const
{ {
IXWindowsClipboardConverter *converter = nullptr; IXWindowsClipboardConverter *converter = nullptr;
for (ConverterList::const_iterator index = m_converters.begin(); index != m_converters.end(); ++index) { for (auto index = m_converters.begin(); index != m_converters.end(); ++index) {
converter = *index; converter = *index;
if (converter->getAtom() == target) { if (converter->getAtom() == target) {
break; break;
@ -853,9 +853,9 @@ void XWindowsClipboard::pushReplies()
{ {
// send the first reply for each window if that reply hasn't // send the first reply for each window if that reply hasn't
// been sent yet. // been sent yet.
for (ReplyMap::iterator index = m_replies.begin(); index != m_replies.end();) { for (auto index = m_replies.begin(); index != m_replies.end();) {
assert(!index->second.empty()); assert(!index->second.empty());
ReplyList::iterator listit = index->second.begin(); auto listit = index->second.begin();
while (listit != index->second.end()) { while (listit != index->second.end()) {
if (!(*listit)->m_replied) if (!(*listit)->m_replied)
break; break;
@ -1055,7 +1055,7 @@ bool XWindowsClipboard::sendReply(Reply *reply)
void XWindowsClipboard::clearReplies() void XWindowsClipboard::clearReplies()
{ {
for (ReplyMap::iterator index = m_replies.begin(); index != m_replies.end(); ++index) { for (auto index = m_replies.begin(); index != m_replies.end(); ++index) {
clearReplies(index->second); clearReplies(index->second);
} }
m_replies.clear(); m_replies.clear();
@ -1064,7 +1064,7 @@ void XWindowsClipboard::clearReplies()
void XWindowsClipboard::clearReplies(ReplyList &replies) void XWindowsClipboard::clearReplies(ReplyList &replies)
{ {
for (ReplyList::iterator index = replies.begin(); index != replies.end(); ++index) { for (auto index = replies.begin(); index != replies.end(); ++index) {
delete *index; delete *index;
} }
replies.clear(); replies.clear();
@ -1125,7 +1125,7 @@ Atom XWindowsClipboard::getTargetsData(std::string &data, int *format) const
XWindowsUtil::appendAtomData(data, m_atomTimestamp); XWindowsUtil::appendAtomData(data, m_atomTimestamp);
// add targets we can convert to // add targets we can convert to
for (ConverterList::const_iterator index = m_converters.begin(); index != m_converters.end(); ++index) { for (auto index = m_converters.begin(); index != m_converters.end(); ++index) {
IXWindowsClipboardConverter *converter = *index; IXWindowsClipboardConverter *converter = *index;
// skip formats we don't have // skip formats we don't have