12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#if defined(HAVE_STRTOF_L) || defined(HAVE_STRTOD_L)
# include <locale.h>
|
<
|
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#include <errno.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#if defined(HAVE_STRTOF_L) || defined(HAVE_STRTOD_L)
# include <locale.h>
|
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
|
if (options & OF_JSON_REPRESENTATION_JSON5) {
[JSON replaceOccurrencesOfString: @"\n"
withString: @"\\\n"];
if (options & OF_JSON_REPRESENTATION_IDENTIFIER) {
const char *cString = [self UTF8String];
if ((!isalpha((int)cString[0]) && cString[0] != '_' &&
cString[0] != '$') ||
strpbrk(cString, " \n\r\t\b\f\\\"'") != NULL) {
[JSON prependString: @"\""];
[JSON appendString: @"\""];
}
} else {
[JSON prependString: @"\""];
[JSON appendString: @"\""];
|
|
|
|
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
|
if (options & OF_JSON_REPRESENTATION_JSON5) {
[JSON replaceOccurrencesOfString: @"\n"
withString: @"\\\n"];
if (options & OF_JSON_REPRESENTATION_IDENTIFIER) {
const char *cString = [self UTF8String];
if ((!of_ascii_isalpha(cString[0]) &&
cString[0] != '_' && cString[0] != '$') ||
strpbrk(cString, " \n\r\t\b\f\\\"'") != NULL) {
[JSON prependString: @"\""];
[JSON appendString: @"\""];
}
} else {
[JSON prependString: @"\""];
[JSON appendString: @"\""];
|