diff --git a/apps/graph/graph/graph_controller.cpp b/apps/graph/graph/graph_controller.cpp index 5bd7a3004..cc9dbb93a 100644 --- a/apps/graph/graph/graph_controller.cpp +++ b/apps/graph/graph/graph_controller.cpp @@ -129,8 +129,8 @@ float GraphController::interestingXHalfRange() const { } // Compute the combined range of the functions assert(f->plotType() == ContinuousFunction::PlotType::Cartesian); // So that tMin tMax represents xMin xMax - tMin = std::min(tMin, f->tMin()); - tMax = std::max(tMax, f->tMax()); + tMin = std::min(tMin, f->tMin()); + tMax = std::max(tMax, f->tMax()); } constexpr float rangeMultiplicator = 1.6f; if (characteristicRange > 0.0f ) { diff --git a/apps/probability/distribution/chi_squared_distribution.cpp b/apps/probability/distribution/chi_squared_distribution.cpp index 4f0998fce..9338c8c4b 100644 --- a/apps/probability/distribution/chi_squared_distribution.cpp +++ b/apps/probability/distribution/chi_squared_distribution.cpp @@ -78,7 +78,7 @@ double ChiSquaredDistribution::cumulativeDistributiveInverseForProbability(doubl 2.0 * *probability * std::exp(std::lgamma(ceilKOver2)) / (exp(-kOver2Minus1) * std::pow(kOver2Minus1, kOver2Minus1)) : 30.0; // Ad hoc value xmax = std::isnan(xmax) ? 1000000000.0 : xmax; - return cumulativeDistributiveInverseForProbabilityUsingIncreasingFunctionRoot(probability, FLT_EPSILON, std::max(xMax(), xmax)); + return cumulativeDistributiveInverseForProbabilityUsingIncreasingFunctionRoot(probability, FLT_EPSILON, std::max(xMax(), xmax)); } } diff --git a/apps/probability/distribution/fisher_distribution.cpp b/apps/probability/distribution/fisher_distribution.cpp index 5e76c3fca..66201ac0c 100644 --- a/apps/probability/distribution/fisher_distribution.cpp +++ b/apps/probability/distribution/fisher_distribution.cpp @@ -73,7 +73,7 @@ double FisherDistribution::cumulativeDistributiveInverseForProbability(double * if (*probability < DBL_EPSILON) { return 0.0; } - return cumulativeDistributiveInverseForProbabilityUsingIncreasingFunctionRoot(probability, DBL_EPSILON, std::max(xMax(), 100.0)); // Ad-hoc value; + return cumulativeDistributiveInverseForProbabilityUsingIncreasingFunctionRoot(probability, DBL_EPSILON, std::max(xMax(), 100.0)); // Ad-hoc value; } float FisherDistribution::mode() const { diff --git a/apps/regression/graph_controller.cpp b/apps/regression/graph_controller.cpp index d8c00d067..f582d315e 100644 --- a/apps/regression/graph_controller.cpp +++ b/apps/regression/graph_controller.cpp @@ -162,7 +162,7 @@ void GraphController::reloadBannerView() { } if (!coefficientsAreDefined) { // Force the "Data not suitable" message to be on the next line - int numberOfCharToCompleteLine = std::max(Ion::Display::Width / BannerView::Font()->glyphSize().width() - strlen(I18n::translate(formula)), 0); + int numberOfCharToCompleteLine = std::max(Ion::Display::Width / BannerView::Font()->glyphSize().width() - strlen(I18n::translate(formula)), 0); numberOfChar = 0; // Padding Shared::TextHelpers::PadWithSpaces(buffer, bufferSize, &numberOfChar, numberOfCharToCompleteLine - 1); @@ -387,8 +387,8 @@ InteractiveCurveViewRangeDelegate::Range GraphController::computeYRange(Interact for (int series = 0; series < Store::k_numberOfSeries; series++) { for (int k = 0; k < m_store->numberOfPairsOfSeries(series); k++) { if (m_store->xMin() <= m_store->get(series, 0, k) && m_store->get(series, 0, k) <= m_store->xMax()) { - minY = std::min(minY, m_store->get(series, 1, k)); - maxY = std::max(maxY, m_store->get(series, 1, k)); + minY = std::min(minY, m_store->get(series, 1, k)); + maxY = std::max(maxY, m_store->get(series, 1, k)); } } } diff --git a/apps/regression/store.cpp b/apps/regression/store.cpp index 69e7b6729..e7d827cb2 100644 --- a/apps/regression/store.cpp +++ b/apps/regression/store.cpp @@ -197,7 +197,7 @@ void Store::resetMemoization() { float Store::maxValueOfColumn(int series, int i) const { float maxColumn = -FLT_MAX; for (int k = 0; k < numberOfPairsOfSeries(series); k++) { - maxColumn = std::max(maxColumn, m_data[series][i][k]); + maxColumn = std::max(maxColumn, m_data[series][i][k]); } return maxColumn; } @@ -205,7 +205,7 @@ float Store::maxValueOfColumn(int series, int i) const { float Store::minValueOfColumn(int series, int i) const { float minColumn = FLT_MAX; for (int k = 0; k < numberOfPairsOfSeries(series); k++) { - minColumn = std::min(minColumn, m_data[series][i][k]); + minColumn = std::min(minColumn, m_data[series][i][k]); } return minColumn; } diff --git a/apps/sequence/graph/graph_controller.cpp b/apps/sequence/graph/graph_controller.cpp index cd4c36fdc..d35077101 100644 --- a/apps/sequence/graph/graph_controller.cpp +++ b/apps/sequence/graph/graph_controller.cpp @@ -52,7 +52,7 @@ float GraphController::interestingXHalfRange() const { Sequence * s = functionStore()->modelForRecord(functionStore()->activeRecordAtIndex(i)); int firstInterestingIndex = s->initialRank(); nmin = std::min(nmin, firstInterestingIndex); - nmax = std::max(nmax, firstInterestingIndex + standardRange); + nmax = std::max(nmax, firstInterestingIndex + static_cast(standardRange)); } assert(nmax - nmin >= standardRange); return nmax - nmin; diff --git a/apps/sequence/list/list_controller.cpp b/apps/sequence/list/list_controller.cpp index 0144c8cd7..f066c4ecb 100644 --- a/apps/sequence/list/list_controller.cpp +++ b/apps/sequence/list/list_controller.cpp @@ -54,7 +54,7 @@ KDCoordinate ListController::expressionRowHeight(int j) { return defaultHeight; } KDCoordinate sequenceHeight = layout.layoutSize().height(); - return std::max(defaultHeight, sequenceHeight + 2*k_expressionCellVerticalMargin); + return std::max(defaultHeight, sequenceHeight + 2*k_expressionCellVerticalMargin); } void ListController::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) { diff --git a/apps/settings/sub_menu/preferences_controller.cpp b/apps/settings/sub_menu/preferences_controller.cpp index cb9a22116..5013a2bd4 100644 --- a/apps/settings/sub_menu/preferences_controller.cpp +++ b/apps/settings/sub_menu/preferences_controller.cpp @@ -144,7 +144,7 @@ void PreferencesController::setPreferenceWithValueIndex(I18n::Message message, i /* In Engineering mode, the number of significant digits cannot be lower * than 3, because we need to be able to display 100 for instance. */ // TODO: Add warning about signifiant digits change ? - preferences->setNumberOfSignificantDigits(std::max(preferences->numberOfSignificantDigits(), 3)); + preferences->setNumberOfSignificantDigits(std::max(preferences->numberOfSignificantDigits(), 3)); } } else if (message == I18n::Message::EditionMode) { preferences->setEditionMode((Preferences::EditionMode)valueIndex); diff --git a/apps/settings/sub_menu/selectable_view_with_messages.cpp b/apps/settings/sub_menu/selectable_view_with_messages.cpp index e1cb5933c..08ede69b5 100644 --- a/apps/settings/sub_menu/selectable_view_with_messages.cpp +++ b/apps/settings/sub_menu/selectable_view_with_messages.cpp @@ -51,7 +51,7 @@ void SelectableViewWithMessages::layoutSubviews(bool force) { // Layout the text KDCoordinate textHeight = KDFont::SmallFont->glyphSize().height(); - KDCoordinate defOrigin = std::max(bounds().height() - Metric::CommonBottomMargin - m_numberOfMessages*textHeight, tableHeight); + KDCoordinate defOrigin = std::max(bounds().height() - Metric::CommonBottomMargin - m_numberOfMessages*textHeight, tableHeight); for (int i = 0; i < m_numberOfMessages; i++) { m_messageLines[i].setFrame(KDRect(0, defOrigin, bounds().width(), textHeight), force); diff --git a/apps/shared/continuous_function.cpp b/apps/shared/continuous_function.cpp index 5f103363f..ebac4e160 100644 --- a/apps/shared/continuous_function.cpp +++ b/apps/shared/continuous_function.cpp @@ -310,8 +310,8 @@ Coordinate2D ContinuousFunction::nextIntersectionFrom(double start, doub constexpr int bufferSize = CodePoint::MaxCodePointCharLength + 1; char unknownX[bufferSize]; SerializationHelper::CodePoint(unknownX, bufferSize, UCodePointUnknown); - double domainMin = std::max(tMin(), eDomainMin); - double domainMax = std::min(tMax(), eDomainMax); + double domainMin = std::max(tMin(), eDomainMin); + double domainMax = std::min(tMax(), eDomainMax); if (step > 0.0f) { start = std::max(start, domainMin); max = std::min(max, domainMax); @@ -328,19 +328,19 @@ Coordinate2D ContinuousFunction::nextPointOfInterestFrom(double start, d char unknownX[bufferSize]; SerializationHelper::CodePoint(unknownX, bufferSize, UCodePointUnknown); if (step > 0.0f) { - start = std::max(start, tMin()); - max = std::min(max, tMax()); + start = std::max(start, tMin()); + max = std::min(max, tMax()); } else { - start = std::min(start, tMax()); - max = std::max(max, tMin()); + start = std::min(start, tMax()); + max = std::max(max, tMin()); } return compute(expressionReduced(context), unknownX, start, step, max, context); } Poincare::Expression ContinuousFunction::sumBetweenBounds(double start, double end, Poincare::Context * context) const { assert(plotType() == PlotType::Cartesian); - start = std::max(start, tMin()); - end = std::min(end, tMax()); + start = std::max(start, tMin()); + end = std::min(end, tMax()); return Poincare::Integral::Builder(expressionReduced(context).clone(), Poincare::Symbol::Builder(UCodePointUnknown), Poincare::Float::Builder(start), Poincare::Float::Builder(end)); // Integral takes ownership of args /* TODO: when we approximate integral, we might want to simplify the integral * here. However, we might want to do it once for all x (to avoid lagging in diff --git a/apps/shared/curve_view.cpp b/apps/shared/curve_view.cpp index f2e6166c1..d8776179d 100644 --- a/apps/shared/curve_view.cpp +++ b/apps/shared/curve_view.cpp @@ -179,7 +179,7 @@ void CurveView::computeLabels(Axis axis) { int labelMaxGlyphLength = labelMaxGlyphLengthSize(); if (axis == Axis::Horizontal) { float pixelsPerLabel = std::max(0.0f, ((float)Ion::Display::Width)/((float)axisLabelsCount) - k_labelMargin); - labelMaxGlyphLength = std::min(labelMaxGlyphLengthSize(), pixelsPerLabel/k_font->glyphSize().width()); + labelMaxGlyphLength = std::min(labelMaxGlyphLengthSize(), pixelsPerLabel/k_font->glyphSize().width()); } if (labelValue < step && labelValue > -step) { diff --git a/apps/shared/function_graph_controller.cpp b/apps/shared/function_graph_controller.cpp index 8169bbb04..21b3c652b 100644 --- a/apps/shared/function_graph_controller.cpp +++ b/apps/shared/function_graph_controller.cpp @@ -88,13 +88,13 @@ InteractiveCurveViewRangeDelegate::Range FunctionGraphController::computeYRange( if (std::isnan(tMin)) { tMin = xMin; } else if (f->shouldClipTRangeToXRange()) { - tMin = std::max(tMin, xMin); + tMin = std::max(tMin, xMin); } double tMax = f->tMax(); if (std::isnan(tMax)) { tMax = xMax; } else if (f->shouldClipTRangeToXRange()) { - tMax = std::min(tMax, xMax); + tMax = std::min(tMax, xMax); } /* In practice, a step smaller than a pixel's width is needed for sampling * the values of a function. Otherwise some relevant extremal values may be @@ -163,7 +163,7 @@ bool FunctionGraphController::moveCursorVertically(int direction) { double clippedT = m_cursor->t(); if (!std::isnan(f->tMin())) { assert(!std::isnan(f->tMax())); - clippedT = std::min(f->tMax(), std::max(f->tMin(), clippedT)); + clippedT = std::min(f->tMax(), std::max(f->tMin(), clippedT)); } Poincare::Coordinate2D cursorPosition = f->evaluateXYAtParameter(clippedT, context); m_cursor->moveTo(clippedT, cursorPosition.x1(), cursorPosition.x2()); diff --git a/apps/shared/function_list_controller.cpp b/apps/shared/function_list_controller.cpp index 7f937525a..bac65396f 100644 --- a/apps/shared/function_list_controller.cpp +++ b/apps/shared/function_list_controller.cpp @@ -261,7 +261,7 @@ KDCoordinate FunctionListController::maxFunctionNameWidth() { const char * functionName = record.fullName(); const char * dotPosition = strchr(functionName, Ion::Storage::k_dotChar); assert(dotPosition != nullptr); - maxNameLength = std::max(maxNameLength, dotPosition-functionName); + maxNameLength = std::max(maxNameLength, static_cast(dotPosition-functionName)); } return nameWidth(maxNameLength + Function::k_parenthesedArgumentCodePointLength); } diff --git a/apps/statistics/histogram_controller.cpp b/apps/statistics/histogram_controller.cpp index 1f200e55d..42d5c52a3 100644 --- a/apps/statistics/histogram_controller.cpp +++ b/apps/statistics/histogram_controller.cpp @@ -191,8 +191,8 @@ void HistogramController::preinitXRangeParameters() { float maxValue = -FLT_MAX; for (int i = 0; i < Store::k_numberOfSeries; i ++) { if (!m_store->seriesIsEmpty(i)) { - minValue = std::min(minValue, m_store->minValue(i)); - maxValue = std::max(maxValue, m_store->maxValue(i)); + minValue = std::min(minValue, m_store->minValue(i)); + maxValue = std::max(maxValue, m_store->maxValue(i)); } } m_store->setXMin(minValue); diff --git a/apps/variable_box_controller.cpp b/apps/variable_box_controller.cpp index 2842ff8c5..5b5f41dce 100644 --- a/apps/variable_box_controller.cpp +++ b/apps/variable_box_controller.cpp @@ -127,7 +127,7 @@ KDCoordinate VariableBoxController::rowHeight(int index) { if (m_currentPage != Page::RootMenu) { Layout layoutR = expressionLayoutForRecord(recordAtIndex(index), index); if (!layoutR.isUninitialized()) { - return std::max(layoutR.layoutSize().height()+k_leafMargin, Metric::ToolboxRowHeight); + return std::max(layoutR.layoutSize().height()+k_leafMargin, Metric::ToolboxRowHeight); } } return NestedMenuController::rowHeight(index); diff --git a/escher/src/expression_view.cpp b/escher/src/expression_view.cpp index 2f96ed35a..35f0f65cf 100644 --- a/escher/src/expression_view.cpp +++ b/escher/src/expression_view.cpp @@ -64,7 +64,7 @@ KDSize ExpressionView::minimalSizeForOptimalDisplay() const { KDPoint ExpressionView::drawingOrigin() const { KDSize expressionSize = m_layout.layoutSize(); - return KDPoint(m_horizontalMargin + m_horizontalAlignment*(m_frame.width() - 2*m_horizontalMargin - expressionSize.width()), std::max(0, m_verticalAlignment*(m_frame.height() - expressionSize.height()))); + return KDPoint(m_horizontalMargin + m_horizontalAlignment*(m_frame.width() - 2*m_horizontalMargin - expressionSize.width()), std::max(0, m_verticalAlignment*(m_frame.height() - expressionSize.height()))); } KDPoint ExpressionView::absoluteDrawingOrigin() const { diff --git a/escher/src/layout_field.cpp b/escher/src/layout_field.cpp index 66bed4bc9..4002038c3 100644 --- a/escher/src/layout_field.cpp +++ b/escher/src/layout_field.cpp @@ -610,7 +610,7 @@ void LayoutField::scrollToBaselinedRect(KDRect rect, KDCoordinate baseline) { // Show the rect area around its baseline KDCoordinate underBaseline = rect.height() - baseline; KDCoordinate minAroundBaseline = std::min(baseline, underBaseline); - minAroundBaseline = std::min(minAroundBaseline, bounds().height() / 2); + minAroundBaseline = std::min(minAroundBaseline, bounds().height() / 2); KDRect balancedRect(rect.x(), rect.y() + baseline - minAroundBaseline, rect.width(), 2 * minAroundBaseline); scrollToContentRect(balancedRect, true); } diff --git a/escher/src/scroll_view.cpp b/escher/src/scroll_view.cpp index 6782f5604..35b049198 100644 --- a/escher/src/scroll_view.cpp +++ b/escher/src/scroll_view.cpp @@ -74,8 +74,8 @@ void ScrollView::scrollToContentPoint(KDPoint p, bool allowOverscroll) { // Handle cases when the size of the view has decreased. setContentOffset(KDPoint( - std::min(contentOffset().x(), std::max(minimalSizeForOptimalDisplay().width() - bounds().width(), 0)), - std::min(contentOffset().y(), std::max(minimalSizeForOptimalDisplay().height() - bounds().height(), 0)))); + std::min(contentOffset().x(), std::max(minimalSizeForOptimalDisplay().width() - bounds().width(), KDCoordinate{0})), + std::min(contentOffset().y(), std::max(minimalSizeForOptimalDisplay().height() - bounds().height(), 0)))); } void ScrollView::scrollToContentRect(KDRect rect, bool allowOverscroll) { diff --git a/escher/src/table_cell.cpp b/escher/src/table_cell.cpp index 767601ef7..85446c28c 100644 --- a/escher/src/table_cell.cpp +++ b/escher/src/table_cell.cpp @@ -93,21 +93,21 @@ void TableCell::layoutSubviews(bool force) { KDCoordinate y = k_separatorThickness; if (label) { y += k_verticalMargin; - KDCoordinate labelHeight = std::min(labelSize.height(), height - y - k_separatorThickness - k_verticalMargin); + KDCoordinate labelHeight = std::min(labelSize.height(), height - y - k_separatorThickness - k_verticalMargin); label->setFrame(KDRect(horizontalMargin, y, width-2*horizontalMargin, labelHeight), force); y += labelHeight + k_verticalMargin; } horizontalMargin = k_separatorThickness + k_horizontalMargin; - y = std::max(y, height - k_separatorThickness - withMargin(accessorySize.height(), Metric::TableCellVerticalMargin) - withMargin(subAccessorySize.height(), 0)); + y = std::max(y, height - k_separatorThickness - withMargin(accessorySize.height(), Metric::TableCellVerticalMargin) - withMargin(subAccessorySize.height(), 0)); if (subAccessory) { - KDCoordinate subAccessoryHeight = std::min(subAccessorySize.height(), height - y - k_separatorThickness - Metric::TableCellVerticalMargin); + KDCoordinate subAccessoryHeight = std::min(subAccessorySize.height(), height - y - k_separatorThickness - Metric::TableCellVerticalMargin); accessory->setFrame(KDRect(horizontalMargin, y, width - 2*horizontalMargin, subAccessoryHeight), force); y += subAccessoryHeight; } horizontalMargin = k_separatorThickness + accessoryMargin(); - y = std::max(y, height - k_separatorThickness - withMargin(accessorySize.height(), Metric::TableCellVerticalMargin)); + y = std::max(y, height - k_separatorThickness - withMargin(accessorySize.height(), Metric::TableCellVerticalMargin)); if (accessory) { - KDCoordinate accessoryHeight = std::min(accessorySize.height(), height - y - k_separatorThickness - Metric::TableCellVerticalMargin); + KDCoordinate accessoryHeight = std::min(accessorySize.height(), height - y - k_separatorThickness - Metric::TableCellVerticalMargin); accessory->setFrame(KDRect(horizontalMargin, y, width - 2*horizontalMargin, accessoryHeight), force); } } else { @@ -139,25 +139,25 @@ void TableCell::layoutSubviews(bool force) { KDCoordinate accessoryX = std::max(k_separatorThickness + accessoryMargin(), width - k_separatorThickness - withMargin(accessorySize.width(), accessoryMargin())); if (label) { x = labelX; - KDCoordinate labelWidth = std::min(labelSize.width(), width - x - k_separatorThickness - labelMargin()); + KDCoordinate labelWidth = std::min(labelSize.width(), width - x - k_separatorThickness - labelMargin()); if (m_layout == Layout::HorizontalRightOverlap) { - labelWidth = std::min(labelWidth, subAccessoryX - x - labelMargin()); + labelWidth = std::min(labelWidth, subAccessoryX - x - labelMargin()); } label->setFrame(KDRect(x, verticalMargin, labelWidth, height-2*verticalMargin), force); x += labelWidth + labelMargin(); } if (subAccessory) { x = std::max(x, subAccessoryX); - KDCoordinate subAccessoryWidth = std::min(subAccessorySize.width(), width - x - k_separatorThickness - k_horizontalMargin); + KDCoordinate subAccessoryWidth = std::min(subAccessorySize.width(), width - x - k_separatorThickness - k_horizontalMargin); if (m_layout == Layout::HorizontalRightOverlap) { - subAccessoryWidth = std::min(subAccessoryWidth, accessoryX - x); + subAccessoryWidth = std::min(subAccessoryWidth, accessoryX - x); } subAccessory->setFrame(KDRect(x, verticalMargin, subAccessoryWidth, height-2*verticalMargin), force); x += subAccessoryWidth; } if (accessory) { x = std::max(x, accessoryX); - KDCoordinate accessoryWidth = std::min(accessorySize.width(), width - x - k_separatorThickness - accessoryMargin()); + KDCoordinate accessoryWidth = std::min(accessorySize.width(), width - x - k_separatorThickness - accessoryMargin()); accessory->setFrame(KDRect(x, verticalMargin, accessoryWidth, height-2*verticalMargin), force); } } diff --git a/escher/src/text_area.cpp b/escher/src/text_area.cpp index 1b413a120..5a28a2a18 100644 --- a/escher/src/text_area.cpp +++ b/escher/src/text_area.cpp @@ -417,7 +417,7 @@ void TextArea::ContentView::drawStringAt(KDContext * ctx, int line, int column, m_font, textColor, backgroundColor, - drawSelection ? (selectionStart >= text ? std::min(length, selectionStart - text) : 0) : length + drawSelection ? (selectionStart >= text ? std::min(length, selectionStart - text) : 0) : length ); if (!drawSelection) { return; diff --git a/ion/src/device/shared/usb/stack/endpoint0.h b/ion/src/device/shared/usb/stack/endpoint0.h index a0ef41686..42d39dbef 100644 --- a/ion/src/device/shared/usb/stack/endpoint0.h +++ b/ion/src/device/shared/usb/stack/endpoint0.h @@ -23,7 +23,7 @@ public: }; constexpr static int k_maxPacketSize = 64; - constexpr static int MaxTransferSize = 2048; + constexpr static uint16_t MaxTransferSize = 2048; constexpr Endpoint0(RequestRecipient * device, RequestRecipient * interface) : m_forceNAK(false), diff --git a/ion/src/shared/unicode/utf8_helper.cpp b/ion/src/shared/unicode/utf8_helper.cpp index 6a3a94a8e..07c5c5838 100644 --- a/ion/src/shared/unicode/utf8_helper.cpp +++ b/ion/src/shared/unicode/utf8_helper.cpp @@ -173,7 +173,8 @@ size_t CopyUntilCodePoint(char * dst, size_t dstSize, const char * src, CodePoin codePointPointer = decoder.stringPosition(); codePoint = decoder.nextCodePoint(); } - size_t copySize = std::min(dstSize - 1, codePointPointer - src); + assert(codePointPointer >= src); + size_t copySize = std::min(dstSize - 1, static_cast(codePointPointer - src)); assert(UTF8Helper::CodePointIs(src + copySize, 0) || UTF8Helper::CodePointIs(src + copySize, c)); memmove(dst, src, copySize); assert(copySize < dstSize); diff --git a/poincare/src/bracket_layout.cpp b/poincare/src/bracket_layout.cpp index c6287dc65..fa9c08854 100644 --- a/poincare/src/bracket_layout.cpp +++ b/poincare/src/bracket_layout.cpp @@ -137,10 +137,10 @@ KDCoordinate BracketLayoutNode::computeChildHeight() { } KDCoordinate siblingHeight = sibling->layoutSize().height(); KDCoordinate siblingBaseline = sibling->baseline(); - maxUnderBaseline = std::max(maxUnderBaseline, siblingHeight - siblingBaseline); + maxUnderBaseline = std::max(maxUnderBaseline, siblingHeight - siblingBaseline); maxAboveBaseline = std::max(maxAboveBaseline, siblingBaseline); } - return std::max(result, maxUnderBaseline + maxAboveBaseline); + return std::max(result, maxUnderBaseline + maxAboveBaseline); } KDPoint BracketLayoutNode::positionOfChild(LayoutNode * child) { diff --git a/poincare/src/condensed_sum_layout.cpp b/poincare/src/condensed_sum_layout.cpp index c1e72e88f..8843a321a 100644 --- a/poincare/src/condensed_sum_layout.cpp +++ b/poincare/src/condensed_sum_layout.cpp @@ -14,7 +14,7 @@ KDSize CondensedSumLayoutNode::computeSize() { KDSize subscriptSize = subscriptLayout()->layoutSize(); KDSize superscriptSize = superscriptLayout()->layoutSize(); KDCoordinate sizeWidth = baseSize.width() + std::max(subscriptSize.width(), superscriptSize.width()); - KDCoordinate sizeHeight = std::max(baseSize.height()/2, subscriptSize.height()) + std::max(baseSize.height()/2, superscriptSize.height()); + KDCoordinate sizeHeight = std::max(baseSize.height()/2, subscriptSize.height()) + std::max(baseSize.height()/2, superscriptSize.height()); return KDSize(sizeWidth, sizeHeight); } @@ -28,7 +28,7 @@ KDPoint CondensedSumLayoutNode::positionOfChild(LayoutNode * child) { } if (child == subscriptLayout()) { x = baseSize.width(); - y = std::max(baseSize.height()/2, superscriptSize.height()); + y = std::max(baseSize.height()/2, superscriptSize.height()); } if (child == superscriptLayout()) { x = baseSize.width(); diff --git a/poincare/src/grid_layout.cpp b/poincare/src/grid_layout.cpp index 06f0e0b17..5839d5b0e 100644 --- a/poincare/src/grid_layout.cpp +++ b/poincare/src/grid_layout.cpp @@ -233,7 +233,7 @@ KDCoordinate GridLayoutNode::rowHeight(int i) const { int j = 0; for (LayoutNode * l : const_cast(this)->childrenFromIndex(i*m_numberOfColumns)) { KDCoordinate b = l->baseline(); - underBaseline = std::max(underBaseline, l->layoutSize().height() - b); + underBaseline = std::max(underBaseline, l->layoutSize().height() - b); aboveBaseline = std::max(aboveBaseline, b); j++; if (j >= m_numberOfColumns) { diff --git a/poincare/src/horizontal_layout.cpp b/poincare/src/horizontal_layout.cpp index 32a974820..0f743904b 100644 --- a/poincare/src/horizontal_layout.cpp +++ b/poincare/src/horizontal_layout.cpp @@ -258,7 +258,7 @@ KDSize HorizontalLayoutNode::computeSize() { for (LayoutNode * l : children()) { KDSize childSize = l->layoutSize(); totalWidth += childSize.width(); - maxUnderBaseline = std::max(maxUnderBaseline, childSize.height() - l->baseline()); + maxUnderBaseline = std::max(maxUnderBaseline, childSize.height() - l->baseline()); maxAboveBaseline = std::max(maxAboveBaseline, l->baseline()); } return KDSize(totalWidth, maxUnderBaseline + maxAboveBaseline); @@ -310,7 +310,7 @@ KDRect HorizontalLayoutNode::relativeSelectionRect(const Layout * selectionStart for (int i = firstSelectedNodeIndex; i <= secondSelectedNodeIndex; i++) { Layout childi = thisLayout.childAtIndex(i); KDSize childSize = childi.layoutSize(); - maxUnderBaseline = std::max(maxUnderBaseline, childSize.height() - childi.baseline()); + maxUnderBaseline = std::max(maxUnderBaseline, childSize.height() - childi.baseline()); maxAboveBaseline = std::max(maxAboveBaseline, childi.baseline()); } return KDRect(KDPoint(selectionXStart, const_cast(this)->baseline() - maxAboveBaseline), KDSize(drawWidth, maxUnderBaseline + maxAboveBaseline)); diff --git a/poincare/src/integer.cpp b/poincare/src/integer.cpp index 8eb8dc0c6..b1c197398 100644 --- a/poincare/src/integer.cpp +++ b/poincare/src/integer.cpp @@ -575,7 +575,7 @@ Integer Integer::usum(const Integer & a, const Integer & b, bool subtract, bool carry = (aDigit > result) || (bDigit > result); // There's been an overflow } } - size = std::min(size, k_maxNumberOfDigits+oneDigitOverflow); + size = std::min(size, k_maxNumberOfDigits+oneDigitOverflow); while (size>0 && s_workingBuffer[size-1] == 0) { size--; } diff --git a/poincare/src/nth_root_layout.cpp b/poincare/src/nth_root_layout.cpp index 0ac4e4c98..c27e82a6b 100644 --- a/poincare/src/nth_root_layout.cpp +++ b/poincare/src/nth_root_layout.cpp @@ -179,7 +179,7 @@ KDSize NthRootLayoutNode::computeSize() { } KDCoordinate NthRootLayoutNode::computeBaseline() { - return std::max( + return std::max( radicandLayout()->baseline() + k_radixLineThickness + k_heightMargin, adjustedIndexSize().height()); } diff --git a/poincare/src/sequence_layout.cpp b/poincare/src/sequence_layout.cpp index 348719612..8a10e262c 100644 --- a/poincare/src/sequence_layout.cpp +++ b/poincare/src/sequence_layout.cpp @@ -176,7 +176,7 @@ KDSize SequenceLayoutNode::computeSize() { } KDCoordinate SequenceLayoutNode::computeBaseline() { - return std::max(upperBoundLayout()->layoutSize().height()+k_boundHeightMargin+(k_symbolHeight+1)/2, argumentLayout()->baseline()); + return std::max(upperBoundLayout()->layoutSize().height()+k_boundHeightMargin+(k_symbolHeight+1)/2, argumentLayout()->baseline()); } KDPoint SequenceLayoutNode::positionOfChild(LayoutNode * l) { @@ -271,7 +271,7 @@ KDCoordinate SequenceLayoutNode::completeLowerBoundX() { } KDCoordinate SequenceLayoutNode::subscriptBaseline() { - return std::max(std::max(variableLayout()->baseline(), lowerBoundLayout()->baseline()), k_font->stringSize(k_equal).height()/2); + return std::max(std::max(variableLayout()->baseline(), lowerBoundLayout()->baseline()), k_font->stringSize(k_equal).height()/2); } } diff --git a/poincare/src/symbol_abstract.cpp b/poincare/src/symbol_abstract.cpp index 998c88620..64aea0222 100644 --- a/poincare/src/symbol_abstract.cpp +++ b/poincare/src/symbol_abstract.cpp @@ -13,8 +13,6 @@ namespace Poincare { -static inline int std::min(int x, int y) { return x < y ? x : y; } - size_t SymbolAbstractNode::size() const { return nodeSize() + strlen(name()) + 1; } @@ -42,7 +40,7 @@ int SymbolAbstractNode::simplificationOrderSameType(const ExpressionNode * e, bo } int SymbolAbstractNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const { - return std::min(strlcpy(buffer, name(), bufferSize), bufferSize - 1); + return std::min(strlcpy(buffer, name(), bufferSize), bufferSize - 1); } template diff --git a/poincare/src/undefined.cpp b/poincare/src/undefined.cpp index c322d8c13..dfc7b4d15 100644 --- a/poincare/src/undefined.cpp +++ b/poincare/src/undefined.cpp @@ -24,7 +24,7 @@ Layout UndefinedNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, } int UndefinedNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const { - return std::min(strlcpy(buffer, Undefined::Name(), bufferSize), bufferSize - 1); + return std::min(strlcpy(buffer, Undefined::Name(), bufferSize), bufferSize - 1); } template Evaluation UndefinedNode::templatedApproximate() const { diff --git a/poincare/src/unit.cpp b/poincare/src/unit.cpp index 0ffc4a2f6..321615aa6 100644 --- a/poincare/src/unit.cpp +++ b/poincare/src/unit.cpp @@ -18,7 +18,7 @@ static inline int absInt(int x) { return x >= 0 ? x : -x; } int UnitNode::Prefix::serialize(char * buffer, int bufferSize) const { assert(bufferSize >= 0); - return std::min(strlcpy(buffer, m_symbol, bufferSize), bufferSize - 1); + return std::min(strlcpy(buffer, m_symbol, bufferSize), bufferSize - 1); } bool UnitNode::Representative::canParse(const char * symbol, size_t length, @@ -51,7 +51,7 @@ int UnitNode::Representative::serialize(char * buffer, int bufferSize, const Pre bufferSize -= length; } assert(bufferSize >= 0); - length += std::min(strlcpy(buffer, m_rootSymbol, bufferSize), bufferSize - 1); + length += std::min(strlcpy(buffer, m_rootSymbol, bufferSize), bufferSize - 1); return length; } @@ -134,7 +134,7 @@ Layout UnitNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, int int UnitNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const { assert(bufferSize >= 0); - int underscoreLength = std::min(strlcpy(buffer, "_", bufferSize), bufferSize - 1); + int underscoreLength = std::min(strlcpy(buffer, "_", bufferSize), bufferSize - 1); buffer += underscoreLength; bufferSize -= underscoreLength; return underscoreLength + m_representative->serialize(buffer, bufferSize, m_prefix); diff --git a/poincare/src/unreal.cpp b/poincare/src/unreal.cpp index c71721f0f..10e0eb6fd 100644 --- a/poincare/src/unreal.cpp +++ b/poincare/src/unreal.cpp @@ -14,7 +14,7 @@ Layout UnrealNode::createLayout(Preferences::PrintFloatMode floatDisplayMode, in } int UnrealNode::serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const { - return std::min(strlcpy(buffer, Unreal::Name(), bufferSize), bufferSize - 1); + return std::min(strlcpy(buffer, Unreal::Name(), bufferSize), bufferSize - 1); } }