Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 0d14c25 in mainline


Ignore:
Timestamp:
2019-05-27T12:38:26Z (20 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
bebd154
Parents:
bc56f30
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-24 16:25:38)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-05-27 12:38:26)
Message:

Fix behavior of stream >> for invalid numeric conversion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/cpp/include/__bits/locale/num_get.hpp

    rbc56f30 r0d14c25  
    303303                    int olderrno{errno};
    304304                    errno = EOK;
     305                    char *endptr = NULL;
    305306
    306307                    if constexpr (is_signed<BaseType>::value)
    307                         res = ::strtoll(base.buffer_, nullptr, num_base);
    308                     else
    309                         res = ::strtoull(base.buffer_, nullptr, num_base);
    310 
    311                     if (errno != EOK)
     308                        res = ::strtoll(base.buffer_, &endptr, num_base);
     309                    else
     310                        res = ::strtoull(base.buffer_, &endptr, num_base);
     311
     312                    if (errno != EOK || endptr == base.buffer_)
    312313                        err |= ios_base::failbit;
    313314
Note: See TracChangeset for help on using the changeset viewer.