@@ -1577,7 +1577,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
1577
1577
__nc = __libcpp_asprintf_l (&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int )__iob.precision (), __v);
1578
1578
else
1579
1579
__nc = __libcpp_asprintf_l (&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
1580
- if (__nb == nullptr )
1580
+ if (__nc == - 1 )
1581
1581
__throw_bad_alloc ();
1582
1582
__nbh.reset (__nb);
1583
1583
}
@@ -1628,7 +1628,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
1628
1628
__nc = __libcpp_asprintf_l (&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int )__iob.precision (), __v);
1629
1629
else
1630
1630
__nc = __libcpp_asprintf_l (&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
1631
- if (__nb == nullptr )
1631
+ if (__nc == - 1 )
1632
1632
__throw_bad_alloc ();
1633
1633
__nbh.reset (__nb);
1634
1634
}
@@ -3402,17 +3402,17 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
3402
3402
char * __bb = __buf;
3403
3403
char_type __digits[__bs];
3404
3404
char_type* __db = __digits;
3405
- size_t __n = static_cast < size_t >( snprintf (__bb, __bs, " %.0Lf" , __units) );
3405
+ int __n = snprintf (__bb, __bs, " %.0Lf" , __units);
3406
3406
unique_ptr<char , void (*)(void *)> __hn (nullptr , free);
3407
3407
unique_ptr<char_type, void (*)(void *)> __hd (0 , free);
3408
3408
// secure memory for digit storage
3409
- if (__n > __bs-1 )
3409
+ if (static_cast < size_t >( __n) > __bs-1 )
3410
3410
{
3411
- __n = static_cast < size_t >( __libcpp_asprintf_l (&__bb, _LIBCPP_GET_C_LOCALE, " %.0Lf" , __units) );
3412
- if (__bb == nullptr )
3411
+ __n = __libcpp_asprintf_l (&__bb, _LIBCPP_GET_C_LOCALE, " %.0Lf" , __units);
3412
+ if (__n == - 1 )
3413
3413
__throw_bad_alloc ();
3414
3414
__hn.reset (__bb);
3415
- __hd.reset ((char_type*)malloc (__n * sizeof (char_type)));
3415
+ __hd.reset ((char_type*)malloc (static_cast < size_t >( __n) * sizeof (char_type)));
3416
3416
if (__hd == nullptr )
3417
3417
__throw_bad_alloc ();
3418
3418
__db = __hd.get ();
@@ -3434,9 +3434,9 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
3434
3434
char_type __mbuf[__bs];
3435
3435
char_type* __mb = __mbuf;
3436
3436
unique_ptr<char_type, void (*)(void *)> __hw (0 , free);
3437
- size_t __exn = static_cast < int >( __n) > __fd ?
3438
- (__n - static_cast <size_t >(__fd)) * 2 + __sn. size () +
3439
- __sym.size () + static_cast <size_t >(__fd) + 1
3437
+ size_t __exn = __n > __fd ?
3438
+ (static_cast < size_t >( __n) - static_cast <size_t >(__fd)) * 2 +
3439
+ __sn. size () + __sym.size () + static_cast <size_t >(__fd) + 1
3440
3440
: __sn.size () + __sym.size () + static_cast <size_t >(__fd) + 2 ;
3441
3441
if (__exn > __bs)
3442
3442
{
0 commit comments