Date
1 - 2 of 2
Handling of std::locale during parse
dresserd@...
We ran into an issue at ImageEngine with the locale unexpectedly being changed, and tracked it down to something to do with OSL. The correct solution is probably that we should just set the locale before doing anything that depends on it, so we can work around it, but this lead to looking at what OSL is doing with the locale, and it seems a little weird.
OSOReader::parse_memory only sets the locale if OIIO_STRUTIL_HAS_STOF is unset. But OSOReader::parse_file doesn't check OIIO_STRUTIL_HAS_STOF, and in addition has an early out for file not found which skips restoring the locale at the bottom of the function. Where OIIO_STRUTIL_HAS_STOF is used, there is a comment about this code "we can remove it entirely when OIIO 1.9 is the minimum". Since it appears the minimum is now OIIO 2.3, is it fair to say that we could now remove any use of locale::global around parsing? I can put up a PR to do this - just wanted to make sure it makes sense first. |
|
Larry Gritz
Yeah, that sounds fine.
The OIIO::Strutil::stof is locale-independent, so if we're using that, we don't need to mess with locales.
|
|