From 47e9be2574aee2a7c118cccc8616b774ae412bed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Fri, 25 Jan 2019 11:54:30 +0100 Subject: [PATCH] [apps] Fix SumGraphController use of CodePointString --- apps/shared/storage_sum_graph_controller.cpp | 5 ++--- apps/shared/sum_graph_controller.cpp | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/shared/storage_sum_graph_controller.cpp b/apps/shared/storage_sum_graph_controller.cpp index ad351a459..0d05cb93d 100644 --- a/apps/shared/storage_sum_graph_controller.cpp +++ b/apps/shared/storage_sum_graph_controller.cpp @@ -242,18 +242,17 @@ void StorageSumGraphController::LegendView::setSumSymbol(Step step, double start char buffer[PrintFloat::bufferSizeForFloatsWithPrecision(Constant::MediumNumberOfSignificantDigits)]; PrintFloat::convertFloatToText(start, buffer, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::MediumNumberOfSignificantDigits), Constant::MediumNumberOfSignificantDigits, Preferences::PrintFloatMode::Decimal); m_sumLayout = CondensedSumLayout::Builder( - LayoutHelper::CodePointString(sigma, sizeof(sigma)), + LayoutHelper::CodePointString(sigma, sigmaLength), LayoutHelper::String(buffer, strlen(buffer), k_font), EmptyLayout::Builder(EmptyLayoutNode::Color::Yellow, false, k_font, false)); } else { - m_sumLayout = LayoutHelper::CodePointString(sigma, sizeof(sigma)); char buffer[2+PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits)]; PrintFloat::convertFloatToText(start, buffer, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, Preferences::PrintFloatMode::Decimal); Layout start = LayoutHelper::String(buffer, strlen(buffer), KDFont::SmallFont); PrintFloat::convertFloatToText(end, buffer, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, Preferences::PrintFloatMode::Decimal); Layout end = LayoutHelper::String(buffer, strlen(buffer), k_font); m_sumLayout = CondensedSumLayout::Builder( - LayoutHelper::CodePointString(sigma, sizeof(sigma)), + LayoutHelper::CodePointString(sigma, sigmaLength), start, end); strlcpy(buffer, "= ", 3); diff --git a/apps/shared/sum_graph_controller.cpp b/apps/shared/sum_graph_controller.cpp index 12e4d222d..deb279781 100644 --- a/apps/shared/sum_graph_controller.cpp +++ b/apps/shared/sum_graph_controller.cpp @@ -245,7 +245,6 @@ void SumGraphController::LegendView::setSumSymbol(Step step, double start, doubl LayoutHelper::String(buffer, strlen(buffer), KDFont::SmallFont), EmptyLayout::Builder(EmptyLayoutNode::Color::Yellow, false, KDFont::SmallFont, false)); } else { - m_sumLayout = LayoutHelper::CodePointString(sigma, sigmaSize); constexpr size_t bufferSize = 2+PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits); char buffer[bufferSize]; PrintFloat::convertFloatToText(start, buffer, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, Preferences::PrintFloatMode::Decimal); @@ -253,7 +252,7 @@ void SumGraphController::LegendView::setSumSymbol(Step step, double start, doubl PrintFloat::convertFloatToText(end, buffer, PrintFloat::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits, Preferences::PrintFloatMode::Decimal); Layout end = LayoutHelper::String(buffer, strlen(buffer), KDFont::SmallFont); m_sumLayout = CondensedSumLayout::Builder( - LayoutHelper::CodePointString(sigma, sizeof(sigma)), + LayoutHelper::CodePointString(sigma, sigmaSize), start, end); strlcpy(buffer, "= ", bufferSize);