Project

General

Profile

Bug #1232 » locale.diff

Jason King, 2011-07-20 09:09 PM

View differences:

usr/src/lib/libc/port/locale/lnumeric.c Tue Jul 19 10:35:32 2011 -0700 → usr/src/lib/libc/port/locale/lnumeric.c Wed Jul 20 15:48:48 2011 -0500
51 51
int
52 52
__numeric_load_locale(const char *name)
53 53
{
54
	const struct lc_numeric_T *leg = _C_numeric_locale;
55

  
54 56
	int ret;
55 57

  
56 58
	ret = __part_load_locale(name, &_numeric_using_locale,
57 59
	    &_numeric_locale_buf, "LC_NUMERIC", LCNUMERIC_SIZE, LCNUMERIC_SIZE,
58 60
	    (const char **)&_numeric_locale);
59
	if (ret != _LDP_ERROR)
60
		__nlocale_changed = 1;
61
	if (ret == _LDP_ERROR)
62
		return (ret);
63

  
64
	__nlocale_changed = 1;
61 65
	if (ret == _LDP_LOADED) {
62 66
		/* Can't be empty according to C99 */
63 67
		if (*_numeric_locale.decimal_point == '\0')
......
65 69
			    _C_numeric_locale.decimal_point;
66 70
		_numeric_locale.grouping =
67 71
		    __fix_locale_grouping_str(_numeric_locale.grouping);
68

  
69
		/* This is Solaris legacy, required for _doprnt */
70
		_numeric[0] = *_numeric_locale.decimal_point;
71
		_numeric[1] = *_numeric_locale.grouping;
72
		leg = (const lc_numeric_T *)&_numeric_locale;
72 73
	}
74
	/* This is Solaris legacy, required for ABI compatability */
75
	_numeric[0] = *leg->decimal_point;
76
	_numeric[1] = *leg->grouping;
73 77
	return (ret);
74 78
}
75 79

  
usr/src/lib/libc/port/print/doprnt.c Tue Jul 19 10:35:32 2011 -0700 → usr/src/lib/libc/port/print/doprnt.c Wed Jul 20 15:48:48 2011 -0500
573 573
					/* arglst[1] is the second arg, etc */
574 574

  
575 575
	int	starflg = 0;	/* set to 1 if * format specifier seen */
576
	struct lconv *locptr = localeconv();
577
	char	decimal_point = *locptr->decimal_point;
578

  
576 579
	/*
577 580
	 * Initialize args and sargs to the start of the argument list.
578 581
	 * We don't know any portable way to copy an arbitrary C object
......
1343 1346

  
1344 1347
			/* put in a decimal point if needed */
1345 1348
			if (prec != 0 || (flagword & FSHARP))
1346
				*p++ = _numeric[0];
1349
				*p++ = decimal_point;
1347 1350

  
1348 1351
			/* create the rest of the mantissa */
1349 1352
			rz = prec;
......
1449 1452

  
1450 1453
			/* Put in a decimal point if needed */
1451 1454
			if (prec != 0 || (flagword & FSHARP))
1452
				*p++ = _numeric[0];
1455
				*p++ = decimal_point;
1453 1456

  
1454 1457
			/* Create the rest of the mantissa */
1455 1458
			rz = prec;
......
1574 1577

  
1575 1578
				/* Decide whether we need a decimal point */
1576 1579
				if ((flagword & FSHARP) || prec > 0)
1577
					*p++ = _numeric[0];
1580
					*p++ = decimal_point;
1578 1581

  
1579 1582
				/* Digits (if any) after the decimal point */
1580 1583
				nn = min(prec, MAXFCVT);
(1-1/3)