ObjFW  Diff

Differences From Artifact [e942c20c56]:

To Artifact [669a08ac5c]:

  • File src/OFApplication.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: 10856) [annotate] [blame] [check-ins using]


16
17
18
19
20
21
22

23
24
25
26
27
28
29

#include "config.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>


#include <signal.h>

#import "OFApplication.h"
#import "OFString.h"
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFSystemInfo.h"







>







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

#include "config.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <locale.h>
#include <signal.h>

#import "OFApplication.h"
#import "OFString.h"
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFSystemInfo.h"
96
97
98
99
100
101
102


103
104
105
106
107
108
109
of_application_main(int *argc, char **argv[], Class cls)
{
	id <OFApplicationDelegate> delegate;
#ifdef OF_WINDOWS
	wchar_t **wargv, **wenvp;
	int wargc, si = 0;
#endif



	if ([cls isSubclassOfClass: [OFApplication class]]) {
		fprintf(stderr, "FATAL ERROR:\n  Class %s is a subclass of "
		    "class OFApplication, but class\n  %s was specified as "
		    "application delegate!\n  Most likely, you wanted to "
		    "subclass OFObject instead or specified\n  the wrong class "
		    "with OF_APPLICATION_DELEGATE().\n",







>
>







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
of_application_main(int *argc, char **argv[], Class cls)
{
	id <OFApplicationDelegate> delegate;
#ifdef OF_WINDOWS
	wchar_t **wargv, **wenvp;
	int wargc, si = 0;
#endif

	setlocale(LC_ALL, "");

	if ([cls isSubclassOfClass: [OFApplication class]]) {
		fprintf(stderr, "FATAL ERROR:\n  Class %s is a subclass of "
		    "class OFApplication, but class\n  %s was specified as "
		    "application delegate!\n  Most likely, you wanted to "
		    "subclass OFObject instead or specified\n  the wrong class "
		    "with OF_APPLICATION_DELEGATE().\n",