From: Bruno Haible Date: Mon, 18 Nov 2019 00:32:13 +0000 (+0100) Subject: Fix long-standing bug in the "signed" variants of fprinthexadecimal. X-Git-Tag: cln_1-3-6~3 X-Git-Url: https://www.ginac.de/CLN/cln.git//cln.git?a=commitdiff_plain;h=7db08a66a3dbdc7c8b8569514067dba9965e90a4;p=cln.git Fix long-standing bug in the "signed" variants of fprinthexadecimal. --- diff --git a/src/base/output/cl_output_hex.cc b/src/base/output/cl_output_hex.cc index d71994f..69a6f56 100644 --- a/src/base/output/cl_output_hex.cc +++ b/src/base/output/cl_output_hex.cc @@ -30,10 +30,10 @@ static void fprinthexadecimal_impl (std::ostream& stream, uintptr_t x) static void fprinthexadecimal_impl (std::ostream& stream, intptr_t x) { if (x >= 0) - fprintdecimal(stream,(uintptr_t)x); + fprinthexadecimal(stream,(uintptr_t)x); else { fprintchar(stream,'-'); - fprintdecimal(stream,(uintptr_t)(-1-x)+1); + fprinthexadecimal(stream,(uintptr_t)(-1-x)+1); } } @@ -83,10 +83,10 @@ void fprinthexadecimal (std::ostream& stream, long long x) fprinthexadecimal_impl(stream,(intptr_t)x); #else if (x >= 0) - fprintdecimal(stream,(unsigned long long)x); + fprinthexadecimal(stream,(unsigned long long)x); else { fprintchar(stream,'-'); - fprintdecimal(stream,(unsigned long long)(-1-x)+1); + fprinthexadecimal(stream,(unsigned long long)(-1-x)+1); } #endif }