From 22347af1708c1a118744e506b432cb1e985750bb Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Thu, 4 Dec 2025 14:17:36 +0100 Subject: [PATCH] use c++ style output to avoid porability problems with printf format --- modules/libcom/src/fdmgr/fdManager.cpp | 34 ++++++++++++++++---------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/modules/libcom/src/fdmgr/fdManager.cpp b/modules/libcom/src/fdmgr/fdManager.cpp index f087436f2..e8be7712f 100644 --- a/modules/libcom/src/fdmgr/fdManager.cpp +++ b/modules/libcom/src/fdmgr/fdManager.cpp @@ -19,6 +19,8 @@ // 1) This library is not thread safe // +#include + #define instantiateRecourceLib #include "epicsAssert.h" #include "epicsThread.h" @@ -365,11 +367,15 @@ fdReg::~fdReg() // void fdReg::show(unsigned level) const { - printf("fdReg at %p\n", this); - if (level > 1u) { - printf("\tstate = %d, onceOnly = %d\n", - state, onceOnly); - } + std::cout << "fdReg at " << this << "\n"; + if (level > 1) + std::cout << "\tstate = " << ( + state == active ? "active" : + state == pending ? "pending" : + state == limbo ? "limbo" : + "invalid") + << ", onceOnly = " << (onceOnly ? "true" : "false") + << "\n"; fdRegId::show(level); } @@ -378,15 +384,17 @@ void fdReg::show(unsigned level) const // void fdRegId::show(unsigned level) const { - printf("fdRegId at %p\n", this); - if (level > 1u) { - printf("\tfd = %" -#if defined(_WIN32) - "ll" -#endif - "d, type = %d\n", - fd, type); + std::cout << "fdRegId at " << this << "\n"; + if (level > 1) { + std::cout << "\tfd = " << fd + << ", type = " << ( + type == fdrRead ? "fdrRead" : + type == fdrWrite ? "fdrWrite" : + type == fdrException ? "fdrException" : + "invalid") + << "\n"; } + std::cout << std::flush; } //