[Analyzers][CPP]Turn on C26451 and fix code (#21230)

* Turn on rule as error and fixing code

* Add packages to external include paths

* Disable warrnings on external code.
This commit is contained in:
sosssego
2022-10-25 17:33:23 +01:00
committed by GitHub
parent a8ee7c58ea
commit 19c4255c7d
10 changed files with 21 additions and 17 deletions

View File

@@ -139,9 +139,9 @@ ZonesMap CalculateGridZones(FancyZonesUtils::Rect workArea, FancyZonesDataTypes:
columnInfo[col].Extent = columnInfo[col].End - columnInfo[col].Start;
}
for (int row = 0; row < gridLayoutInfo.rows(); row++)
for (int64_t row = 0; row < gridLayoutInfo.rows(); row++)
{
for (int col = 0; col < gridLayoutInfo.columns(); col++)
for (int64_t col = 0; col < gridLayoutInfo.columns(); col++)
{
int i = gridLayoutInfo.cellChildMap()[row][col];
if (((row == 0) || (gridLayoutInfo.cellChildMap()[row - 1][col] != i)) &&
@@ -150,12 +150,12 @@ ZonesMap CalculateGridZones(FancyZonesUtils::Rect workArea, FancyZonesDataTypes:
long left = columnInfo[col].Start;
long top = rowInfo[row].Start;
int maxRow = row;
int64_t maxRow = row;
while (((maxRow + 1) < gridLayoutInfo.rows()) && (gridLayoutInfo.cellChildMap()[maxRow + 1][col] == i))
{
maxRow++;
}
int maxCol = col;
int64_t maxCol = col;
while (((maxCol + 1) < gridLayoutInfo.columns()) && (gridLayoutInfo.cellChildMap()[row][maxCol + 1] == i))
{
maxCol++;
@@ -165,9 +165,9 @@ ZonesMap CalculateGridZones(FancyZonesUtils::Rect workArea, FancyZonesDataTypes:
long bottom = rowInfo[maxRow].End;
top += row == 0 ? spacing : spacing / 2;
bottom -= maxRow == gridLayoutInfo.rows() - 1 ? spacing : spacing / 2;
bottom -= maxRow == static_cast<int64_t>(gridLayoutInfo.rows()) - 1 ? spacing : spacing / 2;
left += col == 0 ? spacing : spacing / 2;
right -= maxCol == gridLayoutInfo.columns() - 1 ? spacing : spacing / 2;
right -= maxCol == static_cast<int64_t>(gridLayoutInfo.columns()) - 1 ? spacing : spacing / 2;
auto zone = MakeZone(RECT{ left, top, right, bottom }, i);
if (zone)

View File

@@ -709,11 +709,11 @@ ZoneIndexSet ZoneSet::ZoneSelectSubregion(const ZoneIndexSet& capturedZones, POI
if (verticalSplit)
{
zoneIndex = (pt.y - overlap.top) * capturedZones.size() / height;
zoneIndex = (static_cast<int64_t>(pt.y) - overlap.top) * capturedZones.size() / height;
}
else
{
zoneIndex = (pt.x - overlap.left) * capturedZones.size() / width;
zoneIndex = (static_cast<int64_t>(pt.x) - overlap.left) * capturedZones.size() / width;
}
zoneIndex = std::clamp(zoneIndex, ZoneIndex(0), static_cast<ZoneIndex>(capturedZones.size()) - 1);