#60: mpfr_snprintf instead of mpfr_sprintf

This commit is contained in:
Louis Rubet 2017-05-21 19:48:23 +02:00
parent 627ae75de9
commit 2d41c64268

View file

@ -364,7 +364,6 @@ struct branch : public object
void object::show(ostream& stream) void object::show(ostream& stream)
{ {
//TODO please NOOO
char buffer[512]; char buffer[512];
switch(_type) switch(_type)
@ -373,11 +372,11 @@ void object::show(ostream& stream)
switch(((number*)this)->_representation) switch(((number*)this)->_representation)
{ {
case number::dec: case number::dec:
(void)mpfr_sprintf(buffer, s_mpfr_printf_format.c_str(), ((number*)this)->_value.mpfr); (void)mpfr_snprintf(buffer, sizeof(buffer)-1, s_mpfr_printf_format.c_str(), ((number*)this)->_value.mpfr);
stream<<buffer; stream<<buffer;
break; break;
case number::hex: case number::hex:
(void)mpfr_sprintf(buffer, s_mpfr_printf_format_hex.c_str(), ((number*)this)->_value.mpfr); (void)mpfr_snprintf(buffer, sizeof(buffer)-1, s_mpfr_printf_format_hex.c_str(), ((number*)this)->_value.mpfr);
stream<<buffer; stream<<buffer;
break; break;
case number::bin: case number::bin: