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

Changeset b1b500b in mainline


Ignore:
Timestamp:
2018-07-05T21:41:18Z (2 years ago)
Author:
Dzejrou <dzejrou@…>
Branches:
master
Children:
27473fb8
Parents:
9315761
git-author:
Jaroslav Jindrak <dzejrou@…> (2017-10-30 13:49:31)
git-committer:
Dzejrou <dzejrou@…> (2018-07-05 21:41:18)
Message:

cpp: fixed bugs found by append tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/cpp/include/impl/string.hpp

    r9315761 rb1b500b  
    642642                {
    643643                    auto len = min(n, str.size() - pos);
    644                     ensure_free_space_(len);
    645644
    646645                    return append(str.data() + pos, len);
     
    653652                // TODO: if (size_ + n > max_size()) throw length_error
    654653                ensure_free_space_(n);
    655                 traits_type::copy(data_ + size_, str, n);
    656                 size_ += n;
     654                traits_type::copy(data_ + size_ - 1, str, n);
     655                size_ += n - 1; // We are not copying str's null terminator.
    657656                ensure_null_terminator_();
    658657
Note: See TracChangeset for help on using the changeset viewer.