Differences From Artifact [096a7db2b7]:
- File
src/of_asprintf.m
— part of check-in
[44f45c2e35]
at
2017-01-09 17:36:36
on branch trunk
— Update copyright
Forgot to add 2017, even though I already did quite some changes in
2017. (user: js, size: 16175) [annotate] [blame] [check-ins using]
To Artifact [c0ebec1591]:
- File src/of_asprintf.m — part of check-in [df2ee1f2f9] at 2017-03-12 01:33:01 on branch trunk — Fix using asprintf_l (user: js, size: 16071) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
78 79 80 81 82 83 84 | } lengthModifier; bool useLocale; }; #ifdef HAVE_ASPRINTF_L static locale_t cLocale; | | | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | } lengthModifier; bool useLocale; }; #ifdef HAVE_ASPRINTF_L static locale_t cLocale; static void __attribute__((constructor)) init(void) { if ((cLocale = newlocale(LC_ALL_MASK, "C", NULL)) == NULL) @throw [OFInitializationFailedException exception]; } #endif |
︙ | ︙ | |||
510 511 512 513 514 515 516 | case 'F': case 'e': case 'E': case 'g': case 'G': case 'a': case 'A': | < < < < | | | > > > | | | < > | < | < < < < < < | > | > | | | < > | | > | 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 | case 'F': case 'e': case 'E': case 'g': case 'G': case 'a': case 'A': switch (ctx->lengthModifier) { case LENGTH_MODIFIER_NONE: case LENGTH_MODIFIER_L: #ifdef HAVE_ASPRINTF_L if (!ctx->useLocale) tmpLen = asprintf_l(&tmp, cLocale, ctx->subformat, va_arg(ctx->arguments, double)); else #endif tmpLen = asprintf(&tmp, ctx->subformat, va_arg(ctx->arguments, double)); break; case LENGTH_MODIFIER_CAPITAL_L: #ifdef HAVE_ASPRINTF_L if (!ctx->useLocale) tmpLen = asprintf_l(&tmp, cLocale, ctx->subformat, va_arg(ctx->arguments, long double)); else #endif tmpLen = asprintf(&tmp, ctx->subformat, va_arg(ctx->arguments, long double)); break; default: return false; } #ifndef HAVE_ASPRINTF_L /* * If there's no asprintf_l, we have no other choice than to * use this ugly hack to replace the locale's decimal point * back to ".". */ if (!ctx->useLocale) { void *pool = objc_autoreleasePoolPush(); |
︙ | ︙ |