Opened 9 years ago

Closed 9 years ago

#9853 closed Bugs (fixed)

'argument' : conversion from 'int' to 'char', possible loss of data

Reported by: nn1436401@… Owned by: Vladimir Prus
Milestone: To Be Determined Component: program_options
Version: Boost 1.55.0 Severity: Problem
Keywords: Cc:

Description

boost_program_options.1.55.0.16\lib\native\src\parsers.cpp(223): warning C4242: 'argument' : conversion from 'int' to 'char', possible loss of data

tolower returns 'int' and not 'char'. The cast must be used:

result += static_cast<char>(tolower(s[n]));
                string result;
                if (s.find(prefix) == 0) {
                    for(string::size_type n = prefix.size(); n < s.size(); ++n) 
                    {   
                        // Intel-Win-7.1 does not understand
            // push_back on string.         
                        result += tolower(s[n]);
                    }

P.S. Also it is better to use boost algorithm tolower on string rather than writing it by ourselves.

Change History (1)

comment:1 by Vladimir Prus, 9 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.