From 0e5bd37b6ef75c06c9569f1de7d4858509bb5962 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 29 Jun 2021 19:10:03 -0700 Subject: [PATCH] minor --- bundle/Makefile | 6 +++--- bundle/cmake/RTEMS.cmake@ | 8 ++++---- src/client.cpp | 2 +- src/pvxs/netcommon.h | 2 ++ src/server.cpp | 8 +++----- src/serverchan.cpp | 3 ++- test/testev.cpp | 2 +- 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/bundle/Makefile b/bundle/Makefile index e739098..e862264 100644 --- a/bundle/Makefile +++ b/bundle/Makefile @@ -18,7 +18,7 @@ CMAKEFLAGS = $(CMD_CMAKEFLAGS) LIBEVENT = $(LIBEVENT_$(T_A)) LIBEVENT_$(T_A) = $(INSTALL_LOCATION)/bundle/usr/$(T_A) -CMAKEFLAGS += -DCMAKE_INSTALL_PREFIX:PATH=$(abspath $(LIBEVENT_$(T_A))) +CMAKEFLAGS += -DCMAKE_INSTALL_PREFIX:PATH="$(abspath $(LIBEVENT_$(T_A)))" # not needed, and may not be available on embedded targets, so never try CMAKEFLAGS += -DEVENT__DISABLE_OPENSSL=ON @@ -31,7 +31,7 @@ CMAKEFLAGS += -DEVENT__DISABLE_TESTS=ON CMAKEFLAGS += -DEVENT__DISABLE_BENCHMARK=ON # searched for toolchain files -CMAKEFLAGS += -DCMAKE_MODULE_PATH:DIR=$(abspath $(TOP)/bundle/cmake) +CMAKEFLAGS += -DCMAKE_MODULE_PATH:DIR="$(abspath $(TOP)/bundle/cmake)" CMAKEFLAGS += -DCMAKE_MAKE_PROGRAM="$(MAKE)" @@ -68,7 +68,7 @@ endif # toolchain file when cross compiling CMAKE_TOOLCHAIN_D ?= $(CMAKE_TOOLCHAIN_D_$(T_A)) CMAKE_TOOLCHAIN ?= $(CMAKE_TOOLCHAIN_$(T_A)) -CMAKEFLAGS += $(if $(CMAKE_TOOLCHAIN),-DCMAKE_TOOLCHAIN_FILE=$(CMAKE_TOOLCHAIN)) +CMAKEFLAGS += $(if $(CMAKE_TOOLCHAIN),-DCMAKE_TOOLCHAIN_FILE="$(CMAKE_TOOLCHAIN)") # flags for cmake --build # eg. "-j 2" (that space is important) diff --git a/bundle/cmake/RTEMS.cmake@ b/bundle/cmake/RTEMS.cmake@ index 8bdc8a7..4ef1887 100644 --- a/bundle/cmake/RTEMS.cmake@ +++ b/bundle/cmake/RTEMS.cmake@ @@ -1,7 +1,7 @@ set(CMAKE_SYSTEM_NAME RTEMS) -set(CMAKE_SYSTEM_PROCESSOR @RTEMS_CPU@) -set(CMAKE_SYSTEM_VERSION @RTEMS_VERSION@) -set(RTEMS_BSP @RTEMS_BSP@) -set(RTEMS_PREFIX @RTEMS_BASE@) +set(CMAKE_SYSTEM_PROCESSOR "@RTEMS_CPU@") +set(CMAKE_SYSTEM_VERSION "@RTEMS_VERSION@") +set(RTEMS_BSP "@RTEMS_BSP@") +set(RTEMS_PREFIX "@RTEMS_BASE@") set(RTEMS_BSP_C_FLAGS "@CPU_CFLAGS@") diff --git a/src/client.cpp b/src/client.cpp index bf86739..6fec404 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -861,7 +861,7 @@ void ContextImpl::tickSearch() FixedBuf C(true, pcount, 2u); to_wire(C, count); } - auto consumed = M.save() - searchMsg.data(); + size_t consumed = M.save() - searchMsg.data(); { FixedBuf H(true, searchMsg.data(), 8); to_wire(H, Header{CMD_SEARCH, 0, uint32_t(consumed-8u)}); diff --git a/src/pvxs/netcommon.h b/src/pvxs/netcommon.h index 4dd3450..0c072c1 100644 --- a/src/pvxs/netcommon.h +++ b/src/pvxs/netcommon.h @@ -8,6 +8,8 @@ #include #include +#include + namespace pvxs { namespace impl { diff --git a/src/server.cpp b/src/server.cpp index 49ae935..c6e9fed 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -428,7 +428,7 @@ Server::Pvt::Pvt(const Config &conf) union { std::array i; std::array b; - } pun; + } pun{}; static_assert (sizeof(pun)==12, ""); // seed with some randomness to avoid making UUID a vector @@ -672,7 +672,7 @@ void Server::Pvt::doBeacons(short evt) // "NULL" serverStatus to_wire(M, uint8_t(0xff)); - auto pktlen = M.save()-beaconMsg.data(); + size_t pktlen = M.save()-beaconMsg.data(); // now going back to fill in header FixedBuf H(true, beaconMsg.data(), 8); @@ -702,12 +702,10 @@ void Server::Pvt::doBeacons(short evt) // mimic pvAccessCPP server (almost) // send a "burst" of beacons, then fallback to a longer interval - timeval interval; + timeval interval{180, 0}; if(beaconCnt<10u) { interval = {15, 0}; beaconCnt++; - } else { - interval = {180, 0}; } if(event_add(beaconTimer.get(), &interval)) log_err_printf(serversetup, "Error re-enabling beacon timer on\n%s", ""); diff --git a/src/serverchan.cpp b/src/serverchan.cpp index 91381bd..138db2e 100644 --- a/src/serverchan.cpp +++ b/src/serverchan.cpp @@ -158,7 +158,8 @@ void ServerChannelControl::close() return; auto conn = ch->conn.lock(); if(conn && ch->state==ServerChan::Active) { - // Send unsolicited Channel Destroy + log_debug_printf(connio, "%s %s Send unsolicited Channel Destroy\n", + conn->peerName.c_str(), ch->name.c_str()); auto tx = bufferevent_get_output(conn->bev.get()); EvOutBuf R(hostBE, tx); diff --git a/test/testev.cpp b/test/testev.cpp index f944294..bf75c31 100644 --- a/test/testev.cpp +++ b/test/testev.cpp @@ -80,7 +80,7 @@ void test_call() auto ival(std::make_shared(42)); base.call(std::bind([&called](std::shared_ptr& ival) { auto trash(std::move(ival)); - testEq(trash.use_count(), 1u); + testEq(trash.use_count(), 1); called = true; }, std::move(ival))); testTrue(called);