Opened 17 years ago

Closed 17 years ago

#405 closed Bugs (Fixed)

call to split_winmain raises exception for 8-bit locale

Reported by: nobody Owned by: Vladimir Prus
Milestone: Component: None
Version: None Severity:
Keywords: Cc:

Description

This bug is detected for
boost::program_options::split_winmain function and
debug version CRT of the VC 7.0 under WinXP.
The problem is:
split_winmain (winmain.cpp, line 62) uses isspace()
from VC CRT. The isspace() got int value which < 0 and
not EOF and raises exception.
That int value is russian symbol in rus_russia.1251
locale and casted to int.

Before to call to winmain i had setted locales for CRT
and STL:
if (NULL == setlocale(LC_ALL, "rus_russia.1251")) {
...
}
std::locale::global(std::locale("rus_russia.1251"));
...

I suppose, there is simple fix:
change isspace(*i) call to isspace((unsigned char)*i)

Change History (1)

comment:1 by Vladimir Prus, 17 years ago

Status: assignedclosed
Logged In: YES 
user_id=321498

Fixed. 
Note: See TracTickets for help on using tickets.