Commit 835c21a
committed
BUG: Locale-independent itk::StringToDouble/Float; remove NumericLocale
itk::StringToDouble and itk::StringToFloat (itkStringConvert.h) used
std::stod/std::stof, which follow the ambient LC_NUMERIC locale: under a
decimal-comma locale "0.878906" parsed as 0 at every IO call site that
was migrated to these helpers.
Parse with strtod_l/strtof_l against a cached "C" locale, keeping the
itk::ExceptionObject contract. Only overflow throws; ERANGE underflow
yields a valid subnormal or zero and is accepted (std::stod rejected
those valid inputs on some platforms). An unobtainable "C" locale
throws instead of silently parsing under the ambient locale.
Remove the NumericLocale RAII class (never in a release): switching the
thread-local locale via uselocale() is a no-op for the non-_l
std::strtod on macOS 13 and earlier libc, so the class cannot honor its
contract; its last users are gone (NrrdIO is locale-independent by
construction and DCMTKTransformIO now parses DICOM Decimal Strings via
itk::StringToDouble, gaining itk::ExceptionObject wrapping). The
newlocale/_configthreadlocale try_compile checks remain for
itkStringConvert.1 parent e015fde commit 835c21a
10 files changed
Lines changed: 148 additions & 421 deletions
File tree
- Modules
- Core/Common
- include
- src
- test
- IO/IOTransformDCMTK/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
46 | 52 | | |
47 | 53 | | |
48 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
110 | 109 | | |
111 | 110 | | |
112 | 111 | | |
| |||
This file was deleted.
0 commit comments