diff --git a/ioc/field.cpp b/ioc/field.cpp index dbdde48..0b71797 100644 --- a/ioc/field.cpp +++ b/ioc/field.cpp @@ -59,7 +59,7 @@ Value Field::findIn(Value valueTarget) const { if (component.isArray()) { // Get required array capacity auto index = component.index; - shared_array constValueArray = valueTarget.as>(); + auto constValueArray = valueTarget.as>(); valueTarget = shared_array(); shared_array valueArray(constValueArray.thaw()); auto size = valueArray.size(); diff --git a/ioc/groupsource.cpp b/ioc/groupsource.cpp index fbd14d7..6d17107 100644 --- a/ioc/groupsource.cpp +++ b/ioc/groupsource.cpp @@ -391,7 +391,7 @@ bool getGroupField(const Field& field, Value valueTarget, const std::string& gro errorString << "Error retrieving value for pvName: " << groupName << (field.name.empty() ? "/" : ".") << field.fullName << " : " << e.what(); - getOperation->error(errorString.str().c_str()); + getOperation->error(errorString.str()); return false; } return true; diff --git a/ioc/groupsourcehooks.cpp b/ioc/groupsourcehooks.cpp index 90a74d7..9b5050b 100644 --- a/ioc/groupsourcehooks.cpp +++ b/ioc/groupsourcehooks.cpp @@ -40,7 +40,7 @@ namespace ioc { */ static void dbLoadGroupCmd(const char* jsonFileName, const char *macros) { - iocshSetError(dbLoadGroup(jsonFileName, macros)); + iocshSetError(!!dbLoadGroup(jsonFileName, macros)); GroupConfigProcessor().loadConfigFiles(); } diff --git a/ioc/iocsource.cpp b/ioc/iocsource.cpp index 8cbff68..2a52c3b 100644 --- a/ioc/iocsource.cpp +++ b/ioc/iocsource.cpp @@ -169,7 +169,7 @@ void getArrayValue(dbChannel* pChannel, throw std::runtime_error(SB()<size() >= 1u) { + if(final_type == DBR_CHAR && value.type()==TypeCode::String && !buf->empty()) { // long string (*buf)[buf->size()-1u] = '\0'; // paranoia? value = std::string(buf->data()); @@ -611,7 +611,7 @@ void putArray(dbChannel* pDbChannel, const Value& value) * @param pDbChannel the channel to put the value into * @param value the value to put */ -void IOCSource::put(dbChannel* pDbChannel, const Value& node, MappingInfo info) { +void IOCSource::put(dbChannel* pDbChannel, const Value& node, const MappingInfo &info) { Value value; switch(info.type) { case MappingInfo::Meta: diff --git a/ioc/iocsource.h b/ioc/iocsource.h index 1710909..9116a46 100644 --- a/ioc/iocsource.h +++ b/ioc/iocsource.h @@ -52,7 +52,7 @@ public: UpdateType::type change, dbChannel *pChannel, db_field_log* pDbFieldLog); - static void put(dbChannel* pDbChannel, const Value& value, MappingInfo info); + static void put(dbChannel* pDbChannel, const Value& value, const MappingInfo& info); static void doPostProcessing(dbChannel* pDbChannel, TriState forceProcessing); static void doPreProcessing(dbChannel* pDbChannel, SecurityLogger& securityLogger, const Credentials& credentials, const SecurityClient& securityClient); diff --git a/ioc/singlesource.cpp b/ioc/singlesource.cpp index 8e1c0a0..68b7167 100644 --- a/ioc/singlesource.cpp +++ b/ioc/singlesource.cpp @@ -71,11 +71,10 @@ void subscriptionCallback(SingleSourceSubscriptionCtx* subscriptionContext, } } -static void subscriptionValueCallback(void* userArg, struct dbChannel* pChannel, int, struct db_field_log* pDbFieldLog) { auto subscriptionContext = (SingleSourceSubscriptionCtx*)userArg; subscriptionContext->hadValueEvent = true; - UpdateType::type change = UpdateType::type(UpdateType::Value | UpdateType::Alarm); + auto change = UpdateType::type(UpdateType::Value | UpdateType::Alarm); #if EPICS_VERSION_INT >= VERSION_INT(7, 0, 6, 0) if(pDbFieldLog) { // when available, use DBE mask from db_field_log @@ -85,7 +84,6 @@ void subscriptionValueCallback(void* userArg, struct dbChannel* pChannel, int, s subscriptionCallback(subscriptionContext, change, pChannel, pDbFieldLog); } -static void subscriptionPropertiesCallback(void* userArg, struct dbChannel* pChannel, int, struct db_field_log* pDbFieldLog) { auto subscriptionContext = (SingleSourceSubscriptionCtx*)userArg; diff --git a/ioc/singlesourcehooks.cpp b/ioc/singlesourcehooks.cpp index b9fbb93..bc3445c 100644 --- a/ioc/singlesourcehooks.cpp +++ b/ioc/singlesourcehooks.cpp @@ -75,7 +75,7 @@ void qReport(unsigned level) noexcept { try{ if (auto pPvxsServer = pvxsServer.load()) { std::ostringstream strm; - Detailed D(strm, level); + Detailed D(strm, (int)level); strm << *pPvxsServer; printf("%s", strm.str().c_str()); } diff --git a/src/clientget.cpp b/src/clientget.cpp index 6f742b2..9d6ec23 100644 --- a/src/clientget.cpp +++ b/src/clientget.cpp @@ -564,8 +564,8 @@ void Connection::handle_RPC() { handle_GPR(CMD_RPC); } static std::shared_ptr gpr_setup(const std::shared_ptr& context, - std::string name, // need to capture by value - std::string server, + const std::string& name, + const std::string& server, std::shared_ptr&& op, bool syncCancel) { diff --git a/src/clientimpl.h b/src/clientimpl.h index c26ef1c..d910191 100644 --- a/src/clientimpl.h +++ b/src/clientimpl.h @@ -197,7 +197,7 @@ struct Channel { size_t nSearch = 0u; // GUID of last positive reply when state!=Searching - ServerGUID guid; + ServerGUID guid{}; SockAddr replyAddr; std::list> pending; diff --git a/src/conn.cpp b/src/conn.cpp index 10ebf47..80a0c66 100644 --- a/src/conn.cpp +++ b/src/conn.cpp @@ -33,6 +33,7 @@ ConnBase::ConnBase(bool isClient, bool sendBE, bufferevent* bev, const SockAddr& ,sendBE(sendBE) ,peerBE(true) // arbitrary choice, default should be overwritten before use ,expectSeg(false) + ,peerVersion(0) ,segCmd(0xff) ,segBuf(__FILE__, __LINE__, evbuffer_new()) ,txBody(__FILE__, __LINE__, evbuffer_new()) diff --git a/src/datafmt.cpp b/src/datafmt.cpp index e21dff1..6514cef 100644 --- a/src/datafmt.cpp +++ b/src/datafmt.cpp @@ -110,7 +110,7 @@ struct FmtDelta { field(prefix, val, verytop); if(val.type()==TypeCode::Struct) { - for(auto fld : val.imarked()) { + for(const auto& fld : val.imarked()) { std::string cprefix(prefix); if(!verytop) cprefix += '.'; diff --git a/src/log.cpp b/src/log.cpp index eb54394..1d3e0c3 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -136,7 +136,7 @@ namespace { void evlog_handler(int severity, const char *msg) { const char *sevr = "<\?\?\?>"; - Level lvl = Level::Crit; + Level lvl; switch(severity) { #define CASE(EVLVL, PLVL) case EVENT_LOG_##EVLVL : lvl = Level::PLVL; sevr = #PLVL; break CASE(DEBUG, Debug); @@ -144,6 +144,7 @@ void evlog_handler(int severity, const char *msg) CASE(WARN, Warn); CASE(ERR, Err); #undef CASE + default: lvl = Level::Crit; break; } if(logerr.test(lvl)) errlogPrintf("libevent %s: %s\n", sevr, msg); @@ -289,7 +290,7 @@ void xerrlogHexPrintf(const void *buf, size_t buflen) // printed line (4 groups of 4 bytes) // addr : AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD char buf[4][9] = {"","","",""}; - const unsigned addr = unsigned(pos); + const auto addr = unsigned(pos); for(unsigned grp=0; grp<4 && pos &conn, diff --git a/src/servermon.cpp b/src/servermon.cpp index dffa0a2..463506d 100644 --- a/src/servermon.cpp +++ b/src/servermon.cpp @@ -94,7 +94,7 @@ struct MonitorOp : public ServerOp, op->doReply(); } else { // connection TX queue is too full - conn->backlog.push_back(std::bind(&MonitorOp::doReply, op)); + conn->backlog.emplace_back([op]() { op->doReply(); }); } }); diff --git a/src/util.cpp b/src/util.cpp index 2da17a6..43ba7c6 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -49,8 +49,6 @@ unsigned long pvxs_version_abi_int() namespace pvxs { -DEFINE_LOGGER(log, "pvxs.util"); - #define stringifyX(X) #X #define stringify(X) stringifyX(X) @@ -198,7 +196,7 @@ int Detailed::level(std::ostream &strm) if(idx==INT_MIN) { strm<<"Hint: Wrap with pvxs::Detailed()\n"; } else { - ret = strm.iword(idx); + ret = (int)strm.iword(idx); } return ret; } @@ -871,7 +869,6 @@ done: for(; R < r_lines.size(); R++) { out<<"+ \""<