625{
628
629 if (*_number ==
__T(
'\0') || iswspace((wint_t)*_number)) {
630 throw new NumericConvertException(_number, _base, 0);
631 }
632
633 NumericConvertException::Error error = NumericConvertException::NoError;
634 errno = 0;
635 wchar_t* endptr =
NULL;
636 unsigned long long n = wcstoull(_number, &endptr, _base);
637 if (errno == ERANGE) {
638 if (ULLONG_MAX == n) {
639 error = NumericConvertException::Overflow;
640 }
641 }
642
643 if (NumericConvertException::NoError != error) {
644 throw new NumericConvertException(
645 error,
646 _number,
647 _base
648 );
649 }
650
651 if ((endptr && *endptr != '\0') || errno == EINVAL) {
652 throw new NumericConvertException(
653 _number,
654 _base,
655 endptr ? (endptr - _number) : 0
656 );
657 }
658
659 return (uint64_t) n;
660}