pw_kvs: Make kvs compile with C++14
A series of small changes to ensure KVS compiles with C++14.
Change-Id: Idd514c20583b9f3ed192baa38cc5824e3c1ac1a3
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/27141
Commit-Queue: Rob Oliver <rgoliver@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
diff --git a/pw_kvs/public/pw_kvs/flash_memory.h b/pw_kvs/public/pw_kvs/flash_memory.h
index d1864b4..3b25d88 100644
--- a/pw_kvs/public/pw_kvs/flash_memory.h
+++ b/pw_kvs/public/pw_kvs/flash_memory.h
@@ -23,7 +23,8 @@
#include "pw_status/status.h"
#include "pw_status/status_with_size.h"
-namespace pw::kvs {
+namespace pw {
+namespace kvs {
enum class PartitionPermission : bool {
kReadOnly,
@@ -41,7 +42,7 @@
size_t alignment,
uint32_t start_address = 0,
uint32_t sector_start = 0,
- std::byte erased_memory_content = std::byte{0xFF})
+ std::byte erased_memory_content = std::byte(0xFF))
: sector_size_(sector_size),
flash_sector_count_(sector_count),
alignment_(alignment),
@@ -78,7 +79,8 @@
virtual StatusWithSize Read(Address address, std::span<std::byte> output) = 0;
StatusWithSize Read(Address address, void* buffer, size_t len) {
- return Read(address, std::span(static_cast<std::byte*>(buffer), len));
+ return Read(address,
+ std::span<std::byte>(static_cast<std::byte*>(buffer), len));
}
// Writes bytes to flash. Blocking call. Returns:
@@ -93,8 +95,9 @@
StatusWithSize Write(Address destination_flash_address,
const void* data,
size_t len) {
- return Write(destination_flash_address,
- std::span(static_cast<const std::byte*>(data), len));
+ return Write(
+ destination_flash_address,
+ std::span<const std::byte>(static_cast<const std::byte*>(data), len));
}
// Convert an Address to an MCU pointer, this can be used for memory
@@ -207,7 +210,8 @@
virtual StatusWithSize Read(Address address, std::span<std::byte> output);
StatusWithSize Read(Address address, size_t length, void* output) {
- return Read(address, std::span(static_cast<std::byte*>(output), length));
+ return Read(address,
+ std::span<std::byte>(static_cast<std::byte*>(output), length));
}
// Writes bytes to flash. Address and data.size_bytes() must both be a
@@ -296,4 +300,5 @@
const PartitionPermission permission_;
};
-} // namespace pw::kvs
+} // namespace kvs
+} // namespace pw
\ No newline at end of file