Commit Graph

9 Commits

Author SHA1 Message Date
Wyatt Hepler
1b3da3a983 pw_status: Replace Status::Ok() with OkStatus()
- Mark Status::Ok() and StatusWithSize::Ok() as deprecated.
- Replace Status::Ok() with OkStatus().
- Replace StatusWithSize::Ok() with StatusWithSize().

Change-Id: If7192282446bf6d7f90990bb0b4f1b1b89a9228a
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/29003
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Keir Mierle <keir@google.com>
2021-01-11 20:28:12 +00:00
Wyatt Hepler
d78f7c6b75 pw_status: Update Status::CODE to Status::Code()
- Update Status::CODE style to Status::Code() using
  pw_status/update_style.py.
- Make minor adjustments to the pw_assert tests to get them passing.

Change-Id: Ie54c3c605178fd1e42c7cedbcff324115f3ed279
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19165
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Ewout van Bekkum <ewout@google.com>
2020-09-30 18:09:44 +00:00
Wyatt Hepler
6d1a6c6939 pw_span: Move pw_string, pw_unit_test to std::span
- Update pw_string and the test framework to std::span.
- Have pw_string pass std::span by value, for consistency with other
  uses in Pigweed.
- Recommend using template specializations instead of overloads for
  custom ToString implementations. Template specializations are
  preferred because the main ToString definition is a template.

Change-Id: Ib67c6bce1752c4a90e2138bdb1f20c6671f55d50
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/12841
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
2020-06-23 20:45:28 +00:00
Wyatt Hepler
fc35b267ac pw_string: Remove problematic test
Remove a test that attempts to trigger a negative (error) return value
for snprintf. The format strings that trigger these errors vary by
platform, and a format that returns a negative result on one platform
(Linux) may crash another (Windows).

Change-Id: I7b60bc301cd534d0e78228829ea6288687e05c43
2020-01-24 18:16:08 -08:00
Wyatt Hepler
2596fe5418 pw_string: Rename va_list Format to FormatVaList
On Windows, sometimes the va_list overload would be used when formatting
with a single argument. To avoid potential conflicts like these, the
va_list versions of string::Format and StringBuilder::Format are renamed
to FormatVaList.

Change-Id: Id29fae21b13ed420b13841a479e3748a1d3b91ce
2020-01-24 22:53:22 +00:00
Alexei Frolov
dddc4fd7ce Initial Windows GN build
This change configures the Windows host target for GN. It should allow
building unit tests for the host.

Change-Id: Ib92c9a83b9b858a9b7ed55487199c63896580af1
2020-01-22 13:54:15 -08:00
Wyatt Hepler
956ea9dd52 pw_string: Fix test for limited snprintfs
snprintf should return a negative number if there is a formatting error.
Limited snprintf implementations may not detect these errors. This
caused the test to fail on the STM32 Discovery F429i.

Change-Id: I1da8593c258508c0d3e2fa6c440a58493ce15597
2019-12-03 11:11:13 -08:00
Wyatt Hepler
1a96094ce6 Fix copyright notices
- Add missing copright header in conf.py.
- Fix inconsistent copyright notice line breaking.

Change-Id: Ib78f7768643069c49ff986a48a176df9fd06e891
2019-11-27 22:34:02 +00:00
Wyatt Hepler
e2dc6d18d6 Safer snprintf / vsnprintf functions
Provide a string::Format function that writes to a span. The snprintf
return value is interpreted and returned as a StatusWithSize.

Change-Id: Ib7fed684dc333d5feaef85c1bb558cb45e3936bd
2019-11-15 21:54:48 +00:00