Opened 8 years ago

Last modified 7 years ago

#9991 assigned Bugs

WConversion issue in json_parser_write.hpp

Reported by: abhi.california@… Owned by: Sebastian Redl
Milestone: To Be Determined Component: property_tree
Version: Boost 1.54.0 Severity: Problem
Keywords: JSON property tree Cc:

Description

File Name: 1_54_0/boost/property_tree/detail/json_parser_write.hpp

There is a severe problem with the -Wconversion issue in the json_parser_write.hpp

Problematic code:

else

{

const char *hexdigits = "0123456789ABCDEF"; typedef typename make_unsigned<Ch>::type UCh; unsigned long u = (std::min)(static_cast<unsigned long>(

static_cast<UCh>(*b)),

0xFFFFul);

int d1 = u / 4096; u -= d1 * 4096;

int d2 = u / 256; u -= d2 * 256; int d3 = u / 16; u -= d3 * 16; int d4 = u;

result += Ch('
'); result += Ch('u'); result += Ch(hexdigits[d1]); result += Ch(hexdigits[d2]); result += Ch(hexdigits[d3]); result += Ch(hexdigits[d4]);

}

Either we need to do explicit static cast to suppress the Conversion Warning. When we turn on the -Wconversion as well as -Werror both together, which is good practice for production ready code. compiler Just dont allow this to compile.

the above need to be fixed.

Change History (3)

comment:1 by anonymous, 8 years ago

Component: Noneproperty_tree
Owner: set to Sebastian Redl

comment:2 by anonymous, 8 years ago

Keywords: property tree added

comment:3 by Sebastian Redl, 7 years ago

Status: newassigned

Fixed by commit #6a033ffca2b8219bb581c013c3bbd6c31f8151ff

Note: See TracTickets for help on using tickets.