Differences From Artifact [c6d392a88f]:
- File
src/OFSystemInfo.m
— part of check-in
[6dff0f5922]
at
2017-01-07 02:34:39
on branch trunk
— Always use "." for the decimal point
This is achieved by replacing the locale's decimal point with "." after
formatting and replacing "." with the locale's decimal point before
parsing.To still use the decimal point from the locale for formatting, the new
flag "," is introduced to formats. This is useful for just printing a
string to the user that is not saved to a file or sent via a network.While this is an ugly hack, there is no better way to do this other than
implementing the functionality of printf and strtod myself, as POSIX
does not specify versions of these that take a locale as an argument.
While this is a lot of work and error-prone, I will most likely end up
doing this eventually.This commit also enables the locale in OFApplication to notice when
things break. As a nice side effect, ofhttp now uses the locale's
decimal point in its user interface. (user: js, size: 9986) [annotate] [blame] [check-ins using]
To Artifact [13b78669de]:
- File src/OFSystemInfo.m — part of check-in [f12cecf014] at 2017-01-08 02:38:36 on branch trunk — Get native8BitEncoding from locale (user: js, size: 10069) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
20 21 22 23 24 25 26 | /* Work around __block being used by glibc */ #include <stdlib.h> /* include any libc header to get the libc defines */ #ifdef __GLIBC__ # undef __USE_XOPEN #endif | < | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | /* Work around __block being used by glibc */ #include <stdlib.h> /* include any libc header to get the libc defines */ #ifdef __GLIBC__ # undef __USE_XOPEN #endif #include <unistd.h> #include "platform.h" #ifdef OF_MAC_OS_X # include <sys/sysctl.h> #endif |
︙ | ︙ | |||
62 63 64 65 66 67 68 69 70 71 72 73 74 75 | struct x86_regs { uint32_t eax, ebx, ecx, edx; }; #endif static size_t pageSize; static size_t numberOfCPUs; #if defined(OF_X86_64) || defined(OF_X86) static OF_INLINE struct x86_regs OF_CONST_FUNC x86_cpuid(uint32_t eax, uint32_t ecx) { struct x86_regs regs; | > > > > | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | struct x86_regs { uint32_t eax, ebx, ecx, edx; }; #endif static size_t pageSize; static size_t numberOfCPUs; of_string_encoding_t of_system_info_native_8bit_encoding = OF_STRING_ENCODING_UTF_8; OFString *of_system_info_decimal_point = @"."; #if defined(OF_X86_64) || defined(OF_X86) static OF_INLINE struct x86_regs OF_CONST_FUNC x86_cpuid(uint32_t eax, uint32_t ecx) { struct x86_regs regs; |
︙ | ︙ | |||
142 143 144 145 146 147 148 | + (size_t)numberOfCPUs { return numberOfCPUs; } + (of_string_encoding_t)native8BitEncoding { | < | | | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | + (size_t)numberOfCPUs { return numberOfCPUs; } + (of_string_encoding_t)native8BitEncoding { return of_system_info_native_8bit_encoding; } + (OFString*)decimalPoint { return of_system_info_decimal_point; } + (OFString*)userDataPath { #if defined(OF_MAC_OS_X) || defined(OF_IOS) void *pool = objc_autoreleasePoolPush(); char pathC[PATH_MAX]; |
︙ | ︙ |