From 87d7d5883202489d2dc6a803ece098400a6b32b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Tue, 29 Jan 2019 10:36:35 +0100 Subject: [PATCH] [poincare] Fix Decimal serialization --- poincare/src/decimal.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/poincare/src/decimal.cpp b/poincare/src/decimal.cpp index 62dcab336..b92880660 100644 --- a/poincare/src/decimal.cpp +++ b/poincare/src/decimal.cpp @@ -195,11 +195,13 @@ int DecimalNode::convertToText(char * buffer, int bufferSize, Preferences::Print return currentChar; } /* Case 1: Decimal mode */ + assert(UTF8Decoder::CharSizeOfCodePoint('.') == 1); + assert(UTF8Decoder::CharSizeOfCodePoint('0') == 1); int deltaCharMantissa = exponent < 0 ? -exponent+1 : 0; strlcpy(buffer+currentChar+deltaCharMantissa, tempBuffer, maxInt(0, bufferSize-deltaCharMantissa-currentChar)); if (exponent < 0) { for (int i = 0; i <= -exponent; i++) { - currentChar += SerializationHelper::CodePoint(buffer + currentChar, bufferSize - currentChar, i == 1 ? '.' : '0'); + buffer[currentChar++] = i == 1 ? '.' : '0'; if (currentChar >= bufferSize-1) { return bufferSize-1; } } }