diff options
author | MelvinYG <melvingeorge204@gmail.com> | 2024-10-19 02:39:53 +0530 |
---|---|---|
committer | Hossein <hossein@libreoffice.org> | 2024-11-03 22:44:18 +0100 |
commit | e04742c0a55f0361bf9bae19c65fe21a3099e60a (patch) | |
tree | b92ac0616d9105d94ef8079c2e656c3e4122df24 | |
parent | 3015db08c9a8a1b29af1018044955c905c9015aa (diff) |
tdf#145538: Use range based for loops
Change-Id: I1865d2fab8d29bfbc81b10a9497b47c5c94f1af9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175186
Reviewed-by: Hossein <hossein@libreoffice.org>
Tested-by: Jenkins
-rw-r--r-- | vcl/source/helper/driverblocklist.cxx | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/vcl/source/helper/driverblocklist.cxx b/vcl/source/helper/driverblocklist.cxx index b14b146491fd..bb87927c8763 100644 --- a/vcl/source/helper/driverblocklist.cxx +++ b/vcl/source/helper/driverblocklist.cxx @@ -611,69 +611,69 @@ bool FindBlocklistedDeviceInList(std::vector<DriverInfo>& aDeviceInfos, VersionT ParseDriverVersion(sDriverVersion, driverVersion, versionType); bool match = false; - for (std::vector<DriverInfo>::size_type i = 0; i < aDeviceInfos.size(); i++) + for (const auto& rDeviceInfo : aDeviceInfos) { bool osMatch = false; - if (aDeviceInfos[i].meOperatingSystem == DRIVER_OS_ALL) + if (rDeviceInfo.meOperatingSystem == DRIVER_OS_ALL) osMatch = true; - else if (aDeviceInfos[i].meOperatingSystem == system) + else if (rDeviceInfo.meOperatingSystem == system) osMatch = true; - else if (aDeviceInfos[i].meOperatingSystem == DRIVER_OS_WINDOWS_ALL + else if (rDeviceInfo.meOperatingSystem == DRIVER_OS_WINDOWS_ALL && system >= DRIVER_OS_WINDOWS_FIRST && system <= DRIVER_OS_WINDOWS_LAST) osMatch = true; - else if (aDeviceInfos[i].meOperatingSystem == DRIVER_OS_OSX_ALL - && system >= DRIVER_OS_OSX_FIRST && system <= DRIVER_OS_OSX_LAST) + else if (rDeviceInfo.meOperatingSystem == DRIVER_OS_OSX_ALL && system >= DRIVER_OS_OSX_FIRST + && system <= DRIVER_OS_OSX_LAST) osMatch = true; if (!osMatch) { continue; } - if (!aDeviceInfos[i].maAdapterVendor.equalsIgnoreAsciiCase(GetVendorId(VendorAll)) - && !aDeviceInfos[i].maAdapterVendor.equalsIgnoreAsciiCase(sAdapterVendorID)) + if (!rDeviceInfo.maAdapterVendor.equalsIgnoreAsciiCase(GetVendorId(VendorAll)) + && !rDeviceInfo.maAdapterVendor.equalsIgnoreAsciiCase(sAdapterVendorID)) { continue; } - if (std::none_of(aDeviceInfos[i].maDevices.begin(), aDeviceInfos[i].maDevices.end(), + if (std::none_of(rDeviceInfo.maDevices.begin(), rDeviceInfo.maDevices.end(), compareIgnoreAsciiCase(u"all"_ustr)) - && std::none_of(aDeviceInfos[i].maDevices.begin(), aDeviceInfos[i].maDevices.end(), + && std::none_of(rDeviceInfo.maDevices.begin(), rDeviceInfo.maDevices.end(), compareIgnoreAsciiCase(sAdapterDeviceID))) { continue; } - switch (aDeviceInfos[i].meComparisonOp) + switch (rDeviceInfo.meComparisonOp) { case DRIVER_LESS_THAN: - match = driverVersion < aDeviceInfos[i].mnDriverVersion; + match = driverVersion < rDeviceInfo.mnDriverVersion; break; case DRIVER_LESS_THAN_OR_EQUAL: - match = driverVersion <= aDeviceInfos[i].mnDriverVersion; + match = driverVersion <= rDeviceInfo.mnDriverVersion; break; case DRIVER_GREATER_THAN: - match = driverVersion > aDeviceInfos[i].mnDriverVersion; + match = driverVersion > rDeviceInfo.mnDriverVersion; break; case DRIVER_GREATER_THAN_OR_EQUAL: - match = driverVersion >= aDeviceInfos[i].mnDriverVersion; + match = driverVersion >= rDeviceInfo.mnDriverVersion; break; case DRIVER_EQUAL: - match = driverVersion == aDeviceInfos[i].mnDriverVersion; + match = driverVersion == rDeviceInfo.mnDriverVersion; break; case DRIVER_NOT_EQUAL: - match = driverVersion != aDeviceInfos[i].mnDriverVersion; + match = driverVersion != rDeviceInfo.mnDriverVersion; break; case DRIVER_BETWEEN_EXCLUSIVE: - match = driverVersion > aDeviceInfos[i].mnDriverVersion - && driverVersion < aDeviceInfos[i].mnDriverVersionMax; + match = driverVersion > rDeviceInfo.mnDriverVersion + && driverVersion < rDeviceInfo.mnDriverVersionMax; break; case DRIVER_BETWEEN_INCLUSIVE: - match = driverVersion >= aDeviceInfos[i].mnDriverVersion - && driverVersion <= aDeviceInfos[i].mnDriverVersionMax; + match = driverVersion >= rDeviceInfo.mnDriverVersion + && driverVersion <= rDeviceInfo.mnDriverVersionMax; break; case DRIVER_BETWEEN_INCLUSIVE_START: - match = driverVersion >= aDeviceInfos[i].mnDriverVersion - && driverVersion < aDeviceInfos[i].mnDriverVersionMax; + match = driverVersion >= rDeviceInfo.mnDriverVersion + && driverVersion < rDeviceInfo.mnDriverVersionMax; break; case DRIVER_COMPARISON_IGNORED: // We don't have a comparison op, so we match everything. @@ -684,19 +684,19 @@ bool FindBlocklistedDeviceInList(std::vector<DriverInfo>& aDeviceInfos, VersionT break; } - if (match || aDeviceInfos[i].mnDriverVersion == allDriverVersions) + if (match || rDeviceInfo.mnDriverVersion == allDriverVersions) { // white listed drivers - if (aDeviceInfos[i].mbAllowlisted) + if (rDeviceInfo.mbAllowlisted) { SAL_INFO("vcl.driver", "allowlisted driver"); return false; } match = true; - if (!aDeviceInfos[i].maSuggestedVersion.isEmpty()) + if (!rDeviceInfo.maSuggestedVersion.isEmpty()) { - SAL_WARN("vcl.driver", "use : " << aDeviceInfos[i].maSuggestedVersion); + SAL_WARN("vcl.driver", "use : " << rDeviceInfo.maSuggestedVersion); } break; } |