Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pw_containers: pw::Vector::resize takes size_t
For consistency with other container types, pw::Vector returns size_t from size(), max_size() and capacity() member functions. The resize() member functions take unsigned short new_size arguments. When we turn on -Wconversion, code that resizes Vectors based on their current size, max size or capacity becomes complex. This changes the the resize calls to take a size_t with a debug assertion that the size that's passed fits into an unsigned short. Compilers seem to optimize away those assertions if resize() is called with an unsigned short since they can statically determine that the assertion will never fire. Bug: b/259746255 Change-Id: I122f4e20a7eaed25f83621cb2e0a2c12b84e9094 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/146792 Commit-Queue: Ian McKellar <[email protected]> Reviewed-by: Keir Mierle <[email protected]>
- Loading branch information