Skip to content

Commit 642be36

Browse files
author
mutouyun
committed
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
1 parent 9079ca8 commit 642be36

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/libipc/platform/win/mutex.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class mutex {
7575
}
7676
break; // loop again
7777
default:
78-
log.error("fail WaitForSingleObject[", ::GetLastError(), "]: 0x", std::hex, ret, std::dec);
78+
log.error("fail WaitForSingleObject[", ::GetLastError(), "]: ", ipc::spec("#x")(ret));
7979
return false;
8080
}
8181
}
@@ -93,7 +93,7 @@ class mutex {
9393
unlock();
9494
LIBIPC_FALLTHROUGH;
9595
default:
96-
log.error("fail WaitForSingleObject[", ::GetLastError(), "]: 0x", std::hex, ret, std::dec);
96+
log.error("fail WaitForSingleObject[", ::GetLastError(), "]: ", ipc::spec("#x")(ret));
9797
throw std::system_error{static_cast<int>(ret), std::system_category()};
9898
}
9999
}

src/libipc/platform/win/semaphore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class semaphore {
6868
return false;
6969
case WAIT_ABANDONED:
7070
default:
71-
log.error("fail WaitForSingleObject[", ::GetLastError(), "]: 0x", std::hex, ret, std::dec);
71+
log.error("fail WaitForSingleObject[", ::GetLastError(), "]: ", ipc::spec("#x")(ret));
7272
return false;
7373
}
7474
}

0 commit comments

Comments
 (0)