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
This commit is contained in:
mutouyun 2026-01-21 06:25:53 +00:00
parent 9079ca83ce
commit 642be3629b
2 changed files with 3 additions and 3 deletions

View File

@ -75,7 +75,7 @@ public:
} }
break; // loop again break; // loop again
default: default:
log.error("fail WaitForSingleObject[", ::GetLastError(), "]: 0x", std::hex, ret, std::dec); log.error("fail WaitForSingleObject[", ::GetLastError(), "]: ", ipc::spec("#x")(ret));
return false; return false;
} }
} }
@ -93,7 +93,7 @@ public:
unlock(); unlock();
LIBIPC_FALLTHROUGH; LIBIPC_FALLTHROUGH;
default: 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<int>(ret), std::system_category()}; throw std::system_error{static_cast<int>(ret), std::system_category()};
} }
} }

View File

@ -68,7 +68,7 @@ public:
return false; return false;
case WAIT_ABANDONED: case WAIT_ABANDONED:
default: default:
log.error("fail WaitForSingleObject[", ::GetLastError(), "]: 0x", std::hex, ret, std::dec); log.error("fail WaitForSingleObject[", ::GetLastError(), "]: ", ipc::spec("#x")(ret));
return false; return false;
} }
} }