ObjFW  Check-in [a36ab7c79a]

Overview
Comment:OFString: Fix using strtod_l despite uselocale
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a36ab7c79a842775907bea2cc4aa4a2e9e1384f351ee83b181a7f86363482aef
User & Date: js on 2023-04-16 17:27:22
Other Links: manifest | tags
Context
2023-04-16
17:28
Add OpenBSD to GitHub Actions check-in: 351c65405c user: js tags: trunk
17:27
OFString: Fix using strtod_l despite uselocale check-in: a36ab7c79a user: js tags: trunk
17:19
autogen.sh: Use autoconf 2.71 on OpenBSD check-in: 1fb13611f7 user: js tags: trunk
Changes

Modified src/OFString.m from [6c5b7de32e] to [a697442a34].

2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
	double value;

	errno = 0;
#if defined(HAVE_STRTOD_L)
	value = strtod_l(UTF8String, &endPtr, cLocale);
#elif defined(HAVE_USELOCALE)
	locale_t previousLocale = uselocale(cLocale);
	value = strtod_l(UTF8String, &endPtr, cLocale);
	uselocale(previousLocale);
#else
	value = strtod(UTF8String, &endPtr);
#endif

	if (value == HUGE_VAL && errno == ERANGE)
		@throw [OFOutOfRangeException exception];







|







2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
	double value;

	errno = 0;
#if defined(HAVE_STRTOD_L)
	value = strtod_l(UTF8String, &endPtr, cLocale);
#elif defined(HAVE_USELOCALE)
	locale_t previousLocale = uselocale(cLocale);
	value = strtod(UTF8String, &endPtr);
	uselocale(previousLocale);
#else
	value = strtod(UTF8String, &endPtr);
#endif

	if (value == HUGE_VAL && errno == ERANGE)
		@throw [OFOutOfRangeException exception];