diff --git a/poincare/include/poincare/print_int.h b/poincare/include/poincare/print_int.h index f7a0988c6..066f8a4d0 100644 --- a/poincare/include/poincare/print_int.h +++ b/poincare/include/poincare/print_int.h @@ -8,9 +8,11 @@ namespace Poincare { namespace PrintInt { /* PrintInt prints a uint32_t in a given buffer, without the null-terminating - * char. It returns the wanted length to print the integer. - * - Left prints on the left of the buffer - * - Right prints on the right, padding on the left with zeroes if needed */ + * char. + * - Left prints on the left of the buffer and returns the wanted length to + * print the integer. + * - Right prints on the right, padding on the left with zeroes if needed. It + * returns the number of chars written (bufferLength) */ int Left(uint32_t integer, char * buffer, int bufferLength); int Right(uint32_t integer, char * buffer, int bufferLength); diff --git a/poincare/src/print_int.cpp b/poincare/src/print_int.cpp index 63e414c87..c0e89f596 100644 --- a/poincare/src/print_int.cpp +++ b/poincare/src/print_int.cpp @@ -29,7 +29,8 @@ int PrintInt::Left(uint32_t integer, char * buffer, int bufferLength) { } int PrintInt::Right(uint32_t integer, char * buffer, int bufferLength) { - return PrintIntInBuffer(integer, buffer, bufferLength, false); + PrintIntInBuffer(integer, buffer, bufferLength, false); + return bufferLength; } } diff --git a/poincare/test/print_float.cpp b/poincare/test/print_float.cpp index 91885bf30..3ad2681e2 100644 --- a/poincare/test/print_float.cpp +++ b/poincare/test/print_float.cpp @@ -17,19 +17,20 @@ void assert_float_prints_to(T a, const char * result, Preferences::PrintFloatMod constexpr int tagSize = 8; unsigned char tag = 'O'; char taggedBuffer[250+2*tagSize]; - memset(taggedBuffer, tag, bufferSize+2*tagSize); + int taggedAreaSize = bufferSize+2*tagSize; + memset(taggedBuffer, tag, taggedAreaSize); char * buffer = taggedBuffer + tagSize; PrintFloat::ConvertFloatToText(a, buffer, bufferSize, significantDigits, mode); - for (int i=0; i