From 642be3629b8ec7a0c46126e7828c25e6943d57f0 Mon Sep 17 00:00:00 2001 From: mutouyun Date: Wed, 21 Jan 2026 06:25:53 +0000 Subject: [PATCH] fix(win): replace std::hex/std::dec with ipc::spec for MinGW compatibility (issue #171) Replace I/O manipulators (std::hex, std::dec) with ipc::spec in log statements. The ipc::fmt system does not support std::iostream manipulators, which caused compilation failures under MinGW. Changed files: - src/libipc/platform/win/mutex.h (lines 78, 96) - src/libipc/platform/win/semaphore.h (line 71) The format spec "#x" produces output like "0x102" which matches the original behavior: - # flag adds the "0x" prefix automatically - x outputs lowercase hexadecimal Fixes: #171 --- src/libipc/platform/win/mutex.h | 4 ++-- src/libipc/platform/win/semaphore.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libipc/platform/win/mutex.h b/src/libipc/platform/win/mutex.h index ae0e243..10a9914 100644 --- a/src/libipc/platform/win/mutex.h +++ b/src/libipc/platform/win/mutex.h @@ -75,7 +75,7 @@ public: } break; // loop again default: - log.error("fail WaitForSingleObject[", ::GetLastError(), "]: 0x", std::hex, ret, std::dec); + log.error("fail WaitForSingleObject[", ::GetLastError(), "]: ", ipc::spec("#x")(ret)); return false; } } @@ -93,7 +93,7 @@ public: unlock(); LIBIPC_FALLTHROUGH; default: - log.error("fail WaitForSingleObject[", ::GetLastError(), "]: 0x", std::hex, ret, std::dec); + log.error("fail WaitForSingleObject[", ::GetLastError(), "]: ", ipc::spec("#x")(ret)); throw std::system_error{static_cast(ret), std::system_category()}; } } diff --git a/src/libipc/platform/win/semaphore.h b/src/libipc/platform/win/semaphore.h index b5915e9..0508c82 100644 --- a/src/libipc/platform/win/semaphore.h +++ b/src/libipc/platform/win/semaphore.h @@ -68,7 +68,7 @@ public: return false; case WAIT_ABANDONED: default: - log.error("fail WaitForSingleObject[", ::GetLastError(), "]: 0x", std::hex, ret, std::dec); + log.error("fail WaitForSingleObject[", ::GetLastError(), "]: ", ipc::spec("#x")(ret)); return false; } }