Misc. clang static analyzer fixes

This commit is contained in:
Émilie Feral
2020-12-08 10:45:49 +01:00
committed by LeaNumworks
parent c3ceb0074f
commit fe4e2e3e9d
5 changed files with 5 additions and 1 deletions

View File

@@ -64,6 +64,7 @@ void Model::fitLevenbergMarquardt(Store * store, int series, double * modelCoeff
while (smallChi2ChangeCounts < k_consecutiveSmallChi2ChangesLimit && iterationCount < k_maxIterations) {
// Create the alpha prime matrix (it is symmetric)
double coefficientsAPrime[Model::k_maxNumberOfCoefficients * Model::k_maxNumberOfCoefficients];
assert(n > 0); // Ensure that coefficientsAPrime is initialized
for (int i = 0; i < n; i++) {
for (int j = i; j < n; j++) {
double alphaPrime = alphaPrimeCoefficient(store, series, modelCoefficients, i, j, lambda);

View File

@@ -15,6 +15,7 @@ LocalizationController::ContentView::ContentView(LocalizationController * contro
{
m_countryTitleMessage.setBackgroundColor(Palette::WallScreen);
m_countryTitleMessage.setAlignment(0.5f, 0.5f);
assert(k_numberOfCountryWarningLines == 2); // textMessages is not overflowed
I18n::Message textMessages[k_numberOfCountryWarningLines] = {I18n::Message::CountryWarning1, I18n::Message::CountryWarning2};
for (int i = 0; i < k_numberOfCountryWarningLines; i++) {
m_countryWarningLines[i].setBackgroundColor(Palette::WallScreen);

View File

@@ -107,6 +107,7 @@ void TitleBarView::refreshPreferences() {
I18n::Message::Deg :
(angleUnit == Preferences::AngleUnit::Radian ? I18n::Message::Rad : I18n::Message::Gon);
numberOfChar += strlcpy(buffer+numberOfChar, I18n::translate(angleMessage), bufferSize - numberOfChar);
assert(numberOfChar < bufferSize-1);
}
m_preferenceView.setText(buffer);
// Layout the exam mode icon if needed

View File

@@ -101,6 +101,7 @@ void TableCell::layoutSubviews(bool force) {
y = std::max<KDCoordinate>(y, height - k_separatorThickness - withMargin(accessorySize.height(), k_verticalMargin) - withMargin(subAccessorySize.height(), 0));
if (subAccessory) {
KDCoordinate subAccessoryHeight = std::min<KDCoordinate>(subAccessorySize.height(), height - y - k_separatorThickness - k_verticalMargin);
assert(accessory);
accessory->setFrame(KDRect(horizontalMargin, y, width - 2*horizontalMargin, subAccessoryHeight), force);
y += subAccessoryHeight;
}

View File

@@ -294,7 +294,7 @@ void Zoom::RangeWithRatioForDisplay(ValueAtAbscissa evaluation, float yxRatio, f
* dealing with linear functions. */
float yRange = yxRatio * xRange;
int j = 1;
int bestIndex, bestBreadth = 0, bestDistanceToCenter;
int bestIndex = 0, bestBreadth = 0, bestDistanceToCenter;
for (int i = 0; i < sampleSize; i++) {
if (sampleSize - i < bestBreadth) {
break;