From 42e39d799ba5415dc8a5df1ff19919501b6adcf1 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 30 Jun 2022 10:28:55 -0400 Subject: [PATCH] change std::span/std::as_bytes to pw::span/pw::as_bytes to make pigweed polyfill happy --- examples/common/pigweed/RpcService.cpp | 4 ++-- examples/common/pigweed/mbed/Rpc.cpp | 4 ++-- examples/common/pigweed/system_rpc_server.cc | 2 +- examples/platform/ameba/PigweedLogger.cpp | 2 +- examples/platform/ameba/pw_sys_io/sys_io_ameba.cc | 4 ++-- examples/platform/bouffalolab/bl602/PigweedLogger.cpp | 2 +- examples/platform/bouffalolab/bl602/pw_sys_io/sys_io_efr32.cc | 4 ++-- examples/platform/efr32/PigweedLogger.cpp | 2 +- examples/platform/efr32/pw_sys_io/sys_io_efr32.cc | 4 ++-- examples/platform/esp32/PigweedLogger.cpp | 2 +- examples/platform/esp32/pw_sys_io/sys_io_esp32.cc | 4 ++-- examples/platform/mbed/pw_sys_io/sys_io_mbed.cpp | 4 ++-- examples/platform/mbed/util/PigweedLogger.cpp | 2 +- examples/platform/nrfconnect/pw_sys_io/sys_io_nrfconnect.cc | 4 ++-- examples/platform/nrfconnect/util/PigweedLogger.cpp | 2 +- examples/platform/qpg/PigweedLogger.cpp | 2 +- examples/platform/qpg/pw_sys_io/sys_io_qpg.cc | 4 ++-- 17 files changed, 26 insertions(+), 26 deletions(-) diff --git a/examples/common/pigweed/RpcService.cpp b/examples/common/pigweed/RpcService.cpp index 9616b61b49e4be..9e799fd389e545 100644 --- a/examples/common/pigweed/RpcService.cpp +++ b/examples/common/pigweed/RpcService.cpp @@ -56,7 +56,7 @@ class ChipRpcChannelOutput : public pw::rpc::ChannelOutput pw::rpc::ChannelOutput(channel_name), mWriter(writer), mAddress(address) {} - pw::Status Send(std::span buffer) override + pw::Status Send(pw::span buffer) override { if (buffer.empty()) { @@ -102,7 +102,7 @@ void Start(void (*RegisterServices)(pw::rpc::Server &), ::chip::rpc::Mutex * uar { uart_mutex->Lock(); } - pw::hdlc::WriteUIFrame(1, std::as_bytes(std::span(log)), sysIoWriter); + pw::hdlc::WriteUIFrame(1, pw::as_bytes(pw::span(log)), sysIoWriter); if (uart_mutex) { uart_mutex->Unlock(); diff --git a/examples/common/pigweed/mbed/Rpc.cpp b/examples/common/pigweed/mbed/Rpc.cpp index e16c3afc816673..65e9d48824160a 100644 --- a/examples/common/pigweed/mbed/Rpc.cpp +++ b/examples/common/pigweed/mbed/Rpc.cpp @@ -123,10 +123,10 @@ Thread * Init() ChipLogProgress(NotSpecified, "RPC service starting...\r\n"); - auto error = rpcThread.start(RunRpcService); + long error = rpcThread.start(RunRpcService); if (error != osOK) { - ChipLogError(NotSpecified, "Run RPC service failed[%d]", error); + ChipLogError(NotSpecified, "Run RPC service failed[%ld]", error); return NULL; } diff --git a/examples/common/pigweed/system_rpc_server.cc b/examples/common/pigweed/system_rpc_server.cc index 6fe87c6e877dea..5c69c7ca5b910e 100644 --- a/examples/common/pigweed/system_rpc_server.cc +++ b/examples/common/pigweed/system_rpc_server.cc @@ -43,7 +43,7 @@ void Init() { // Send log messages to HDLC address 1. This prevents logs from interfering // with pw_rpc communications. - pw::log_basic::SetOutput([](std::string_view log) { pw::hdlc::WriteUIFrame(1, std::as_bytes(std::span(log)), writer); }); + pw::log_basic::SetOutput([](std::string_view log) { pw::hdlc::WriteUIFrame(1, pw::as_bytes(std::span(log)), writer); }); } rpc::Server & Server() diff --git a/examples/platform/ameba/PigweedLogger.cpp b/examples/platform/ameba/PigweedLogger.cpp index 625c6c4a901586..25bb2843be548c 100644 --- a/examples/platform/ameba/PigweedLogger.cpp +++ b/examples/platform/ameba/PigweedLogger.cpp @@ -41,7 +41,7 @@ bool uartInitialised; void send() { - pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter); + pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter); sWriteBufferPos = 0; } diff --git a/examples/platform/ameba/pw_sys_io/sys_io_ameba.cc b/examples/platform/ameba/pw_sys_io/sys_io_ameba.cc index a57880bc4780f9..9657ebd7e89de4 100644 --- a/examples/platform/ameba/pw_sys_io/sys_io_ameba.cc +++ b/examples/platform/ameba/pw_sys_io/sys_io_ameba.cc @@ -72,13 +72,13 @@ Status WriteByte(std::byte b) StatusWithSize WriteLine(const std::string_view & s) { size_t chars_written = 0; - StatusWithSize result = WriteBytes(std::as_bytes(std::span(s))); + StatusWithSize result = WriteBytes(pw::as_bytes(std::span(s))); if (!result.ok()) { return result; } chars_written += result.size(); - result = WriteBytes(std::as_bytes(std::span("\r\n", 2))); + result = WriteBytes(pw::as_bytes(std::span("\r\n", 2))); chars_written += result.size(); return StatusWithSize(result.status(), chars_written); diff --git a/examples/platform/bouffalolab/bl602/PigweedLogger.cpp b/examples/platform/bouffalolab/bl602/PigweedLogger.cpp index 065161021f6b51..4e434acf954824 100644 --- a/examples/platform/bouffalolab/bl602/PigweedLogger.cpp +++ b/examples/platform/bouffalolab/bl602/PigweedLogger.cpp @@ -52,7 +52,7 @@ static char sWriteBuffer[kWriteBufferSize]; static void send(void) { - pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter); + pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter); sWriteBufferPos = 0; } diff --git a/examples/platform/bouffalolab/bl602/pw_sys_io/sys_io_efr32.cc b/examples/platform/bouffalolab/bl602/pw_sys_io/sys_io_efr32.cc index aff53278e1a2af..c64a4d466544e9 100644 --- a/examples/platform/bouffalolab/bl602/pw_sys_io/sys_io_efr32.cc +++ b/examples/platform/bouffalolab/bl602/pw_sys_io/sys_io_efr32.cc @@ -66,13 +66,13 @@ Status WriteByte(std::byte b) StatusWithSize WriteLine(const std::string_view & s) { size_t chars_written = 0; - StatusWithSize result = WriteBytes(std::as_bytes(std::span(s))); + StatusWithSize result = WriteBytes(pw::as_bytes(std::span(s))); if (!result.ok()) { return result; } chars_written += result.size(); - result = WriteBytes(std::as_bytes(std::span("\r\n", 2))); + result = WriteBytes(pw::as_bytes(std::span("\r\n", 2))); chars_written += result.size(); return StatusWithSize(result.status(), chars_written); diff --git a/examples/platform/efr32/PigweedLogger.cpp b/examples/platform/efr32/PigweedLogger.cpp index a7d25c6f5157de..5a48459080749b 100644 --- a/examples/platform/efr32/PigweedLogger.cpp +++ b/examples/platform/efr32/PigweedLogger.cpp @@ -52,7 +52,7 @@ static char sWriteBuffer[kWriteBufferSize]; static void send(void) { - pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter); + pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter); sWriteBufferPos = 0; } diff --git a/examples/platform/efr32/pw_sys_io/sys_io_efr32.cc b/examples/platform/efr32/pw_sys_io/sys_io_efr32.cc index aff53278e1a2af..c64a4d466544e9 100644 --- a/examples/platform/efr32/pw_sys_io/sys_io_efr32.cc +++ b/examples/platform/efr32/pw_sys_io/sys_io_efr32.cc @@ -66,13 +66,13 @@ Status WriteByte(std::byte b) StatusWithSize WriteLine(const std::string_view & s) { size_t chars_written = 0; - StatusWithSize result = WriteBytes(std::as_bytes(std::span(s))); + StatusWithSize result = WriteBytes(pw::as_bytes(std::span(s))); if (!result.ok()) { return result; } chars_written += result.size(); - result = WriteBytes(std::as_bytes(std::span("\r\n", 2))); + result = WriteBytes(pw::as_bytes(std::span("\r\n", 2))); chars_written += result.size(); return StatusWithSize(result.status(), chars_written); diff --git a/examples/platform/esp32/PigweedLogger.cpp b/examples/platform/esp32/PigweedLogger.cpp index 39851850bfa34c..2ebcd42533012b 100644 --- a/examples/platform/esp32/PigweedLogger.cpp +++ b/examples/platform/esp32/PigweedLogger.cpp @@ -39,7 +39,7 @@ bool uartInitialised; void send() { - pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter); + pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter); sWriteBufferPos = 0; } diff --git a/examples/platform/esp32/pw_sys_io/sys_io_esp32.cc b/examples/platform/esp32/pw_sys_io/sys_io_esp32.cc index 84dc2a23ff54a8..f16477fb56b448 100644 --- a/examples/platform/esp32/pw_sys_io/sys_io_esp32.cc +++ b/examples/platform/esp32/pw_sys_io/sys_io_esp32.cc @@ -95,13 +95,13 @@ Status WriteByte(std::byte b) StatusWithSize WriteLine(const std::string_view & s) { size_t chars_written = 0; - StatusWithSize result = WriteBytes(std::as_bytes(std::span(s))); + StatusWithSize result = WriteBytes(pw::as_bytes(std::span(s))); if (!result.ok()) { return result; } chars_written += result.size(); - result = WriteBytes(std::as_bytes(std::span("\r\n", 2))); + result = WriteBytes(pw::as_bytes(std::span("\r\n", 2))); chars_written += result.size(); return StatusWithSize(result.status(), chars_written); diff --git a/examples/platform/mbed/pw_sys_io/sys_io_mbed.cpp b/examples/platform/mbed/pw_sys_io/sys_io_mbed.cpp index eb7ebc9b520e61..2a75081438c435 100644 --- a/examples/platform/mbed/pw_sys_io/sys_io_mbed.cpp +++ b/examples/platform/mbed/pw_sys_io/sys_io_mbed.cpp @@ -60,7 +60,7 @@ Status WriteByte(std::byte b) StatusWithSize WriteLine(const std::string_view & s) { size_t chars_written = 0; - StatusWithSize result = WriteBytes(std::as_bytes(std::span(s))); + StatusWithSize result = WriteBytes(pw::as_bytes(std::span(s))); if (!result.ok()) { return result; @@ -68,7 +68,7 @@ StatusWithSize WriteLine(const std::string_view & s) chars_written += result.size(); // Write trailing newline. - result = WriteBytes(std::as_bytes(std::span("\r\n", 2))); + result = WriteBytes(pw::as_bytes(std::span("\r\n", 2))); chars_written += result.size(); return StatusWithSize(result.status(), chars_written); diff --git a/examples/platform/mbed/util/PigweedLogger.cpp b/examples/platform/mbed/util/PigweedLogger.cpp index 32b033be44e6e6..1fefd2d614afba 100644 --- a/examples/platform/mbed/util/PigweedLogger.cpp +++ b/examples/platform/mbed/util/PigweedLogger.cpp @@ -44,7 +44,7 @@ char sWriteBuffer[kWriteBufferSize]; void send() { - pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter); + pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(pw::span(sWriteBuffer, sWriteBufferPos)), sWriter); sWriteBufferPos = 0; } diff --git a/examples/platform/nrfconnect/pw_sys_io/sys_io_nrfconnect.cc b/examples/platform/nrfconnect/pw_sys_io/sys_io_nrfconnect.cc index 3781eaa738d45f..73cf2a801e9cfb 100644 --- a/examples/platform/nrfconnect/pw_sys_io/sys_io_nrfconnect.cc +++ b/examples/platform/nrfconnect/pw_sys_io/sys_io_nrfconnect.cc @@ -61,7 +61,7 @@ Status WriteByte(std::byte b) StatusWithSize WriteLine(const std::string_view & s) { size_t chars_written = 0; - StatusWithSize result = WriteBytes(std::as_bytes(std::span(s))); + StatusWithSize result = WriteBytes(pw::as_bytes(std::span(s))); if (!result.ok()) { return result; @@ -69,7 +69,7 @@ StatusWithSize WriteLine(const std::string_view & s) chars_written += result.size(); // Write trailing newline. - result = WriteBytes(std::as_bytes(std::span("\r\n", 2))); + result = WriteBytes(pw::as_bytes(std::span("\r\n", 2))); chars_written += result.size(); return StatusWithSize(result.status(), chars_written); diff --git a/examples/platform/nrfconnect/util/PigweedLogger.cpp b/examples/platform/nrfconnect/util/PigweedLogger.cpp index f3d0fa61a18406..8e5d3d03ae0416 100644 --- a/examples/platform/nrfconnect/util/PigweedLogger.cpp +++ b/examples/platform/nrfconnect/util/PigweedLogger.cpp @@ -61,7 +61,7 @@ bool sIsPanicMode; void flush() { - pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter); + pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter); sWriteBufferPos = 0; } diff --git a/examples/platform/qpg/PigweedLogger.cpp b/examples/platform/qpg/PigweedLogger.cpp index 5b9324ec67b754..7483badf8dbb38 100644 --- a/examples/platform/qpg/PigweedLogger.cpp +++ b/examples/platform/qpg/PigweedLogger.cpp @@ -54,7 +54,7 @@ static char sWriteBuffer[kWriteBufferSize]; static void send(void) { - pw::hdlc::WriteUIFrame(kLogHdlcAddress, std::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter); + pw::hdlc::WriteUIFrame(kLogHdlcAddress, pw::as_bytes(std::span(sWriteBuffer, sWriteBufferPos)), sWriter); sWriteBufferPos = 0; } diff --git a/examples/platform/qpg/pw_sys_io/sys_io_qpg.cc b/examples/platform/qpg/pw_sys_io/sys_io_qpg.cc index ce3e424253b24f..8441a9b0f83825 100644 --- a/examples/platform/qpg/pw_sys_io/sys_io_qpg.cc +++ b/examples/platform/qpg/pw_sys_io/sys_io_qpg.cc @@ -61,13 +61,13 @@ Status WriteByte(std::byte b) StatusWithSize WriteLine(const std::string_view & s) { size_t chars_written = 0; - StatusWithSize result = WriteBytes(std::as_bytes(std::span(s))); + StatusWithSize result = WriteBytes(pw::as_bytes(std::span(s))); if (!result.ok()) { return result; } chars_written += result.size(); - result = WriteBytes(std::as_bytes(std::span("\r\n", 2))); + result = WriteBytes(pw::as_bytes(std::span("\r\n", 2))); chars_written += result.size(); return StatusWithSize(result.status(), chars_written);