mdbx-windows: исправление минорных предупреждений MingGW.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2022-11-08 15:52:06 +03:00
parent 987509f90f
commit 652ca2b5cb
2 changed files with 35 additions and 34 deletions

View File

@ -112,11 +112,10 @@ static
#define LCK_WAITFOR 0
#define LCK_DONTWAIT LOCKFILE_FAIL_IMMEDIATELY
static int flock_with_event(HANDLE fd, HANDLE event, DWORD flags,
uint64_t offset, size_t bytes) {
TRACE("lock>>: fd %p, event %p, flags 0x%x offset %" PRId64 ", bytes %" PRId64
" >>",
fd, event, flags, offset, bytes);
static int flock_with_event(HANDLE fd, HANDLE event, unsigned flags,
size_t offset, size_t bytes) {
TRACE("lock>>: fd %p, event %p, flags 0x%x offset %zu, bytes %zu >>", fd,
event, flags, offset, bytes);
OVERLAPPED ov;
ov.Internal = 0;
ov.InternalHigh = 0;
@ -124,9 +123,8 @@ static int flock_with_event(HANDLE fd, HANDLE event, DWORD flags,
ov.Offset = (DWORD)offset;
ov.OffsetHigh = HIGH_DWORD(offset);
if (LockFileEx(fd, flags, 0, (DWORD)bytes, HIGH_DWORD(bytes), &ov)) {
TRACE("lock<<: fd %p, event %p, flags 0x%x offset %" PRId64
", bytes %" PRId64 " << %s",
fd, event, flags, offset, bytes, "done");
TRACE("lock<<: fd %p, event %p, flags 0x%x offset %zu, bytes %zu << %s", fd,
event, flags, offset, bytes, "done");
return MDBX_SUCCESS;
}
@ -134,8 +132,7 @@ static int flock_with_event(HANDLE fd, HANDLE event, DWORD flags,
if (rc == ERROR_IO_PENDING) {
if (event) {
if (GetOverlappedResult(fd, &ov, &rc, true)) {
TRACE("lock<<: fd %p, event %p, flags 0x%x offset %" PRId64
", bytes %" PRId64 " << %s",
TRACE("lock<<: fd %p, event %p, flags 0x%x offset %zu, bytes %zu << %s",
fd, event, flags, offset, bytes, "overlapped-done");
return MDBX_SUCCESS;
}
@ -143,25 +140,24 @@ static int flock_with_event(HANDLE fd, HANDLE event, DWORD flags,
} else
CancelIo(fd);
}
TRACE("lock<<: fd %p, event %p, flags 0x%x offset %" PRId64 ", bytes %" PRId64
" << err %d",
fd, event, flags, offset, bytes, rc);
TRACE("lock<<: fd %p, event %p, flags 0x%x offset %zu, bytes %zu << err %d",
fd, event, flags, offset, bytes, (int)rc);
return (int)rc;
}
static __inline int flock(HANDLE fd, DWORD flags, uint64_t offset,
static __inline int flock(HANDLE fd, unsigned flags, size_t offset,
size_t bytes) {
return flock_with_event(fd, 0, flags, offset, bytes);
}
static __inline int flock_data(const MDBX_env *env, DWORD flags,
uint64_t offset, size_t bytes) {
static __inline int flock_data(const MDBX_env *env, unsigned flags,
size_t offset, size_t bytes) {
return flock_with_event(env->me_fd4data, env->me_data_lock_event, flags,
offset, bytes);
}
static int funlock(mdbx_filehandle_t fd, uint64_t offset, size_t bytes) {
TRACE("unlock: fd %p, offset %" PRId64 ", bytes %" PRId64, fd, offset, bytes);
static int funlock(mdbx_filehandle_t fd, size_t offset, size_t bytes) {
TRACE("unlock: fd %p, offset %zu, bytes %zu", fd, offset, bytes);
return UnlockFile(fd, (DWORD)offset, HIGH_DWORD(offset), (DWORD)bytes,
HIGH_DWORD(bytes))
? MDBX_SUCCESS

View File

@ -853,9 +853,10 @@ osal_ioring_write(osal_ioring_t *ior) {
if (unlikely(r.err != ERROR_IO_PENDING)) {
ERROR("%s: fd %p, item %p (%zu), pgno %u, bytes %zu, offset %" PRId64
", err %d",
"WriteFileGather", ior->fd, item, item - ior->pool,
((MDBX_page *)item->single.iov_base)->mp_pgno, bytes,
item->ov.Offset + ((uint64_t)item->ov.OffsetHigh << 32), r.err);
"WriteFileGather", ior->fd, __Wpedantic_format_voidptr(item),
item - ior->pool, ((MDBX_page *)item->single.iov_base)->mp_pgno,
bytes, item->ov.Offset + ((uint64_t)item->ov.OffsetHigh << 32),
r.err);
goto bailout_rc;
}
assert(wait_for > ior->event_pool + ior->event_stack);
@ -874,9 +875,10 @@ osal_ioring_write(osal_ioring_t *ior) {
default:
ERROR("%s: fd %p, item %p (%zu), pgno %u, bytes %zu, offset %" PRId64
", err %d",
"WriteFileEx", ior->fd, item, item - ior->pool,
((MDBX_page *)item->single.iov_base)->mp_pgno, bytes,
item->ov.Offset + ((uint64_t)item->ov.OffsetHigh << 32), r.err);
"WriteFileEx", ior->fd, __Wpedantic_format_voidptr(item),
item - ior->pool, ((MDBX_page *)item->single.iov_base)->mp_pgno,
bytes, item->ov.Offset + ((uint64_t)item->ov.OffsetHigh << 32),
r.err);
goto bailout_rc;
case ERROR_NOT_FOUND:
case ERROR_USER_MAPPED_FILE:
@ -884,9 +886,10 @@ osal_ioring_write(osal_ioring_t *ior) {
WARNING(
"%s: fd %p, item %p (%zu), pgno %u, bytes %zu, offset %" PRId64
", err %d",
"WriteFileEx", ior->fd, item, item - ior->pool,
((MDBX_page *)item->single.iov_base)->mp_pgno, bytes,
item->ov.Offset + ((uint64_t)item->ov.OffsetHigh << 32), r.err);
"WriteFileEx", ior->fd, __Wpedantic_format_voidptr(item),
item - ior->pool, ((MDBX_page *)item->single.iov_base)->mp_pgno,
bytes, item->ov.Offset + ((uint64_t)item->ov.OffsetHigh << 32),
r.err);
SleepEx(0, true);
goto retry;
case ERROR_INVALID_USER_BUFFER:
@ -906,9 +909,10 @@ osal_ioring_write(osal_ioring_t *ior) {
r.err = (int)GetLastError();
ERROR("%s: fd %p, item %p (%zu), pgno %u, bytes %zu, offset %" PRId64
", err %d",
"WriteFile", ior->fd, item, item - ior->pool,
((MDBX_page *)item->single.iov_base)->mp_pgno, bytes,
item->ov.Offset + ((uint64_t)item->ov.OffsetHigh << 32), r.err);
"WriteFile", ior->fd, __Wpedantic_format_voidptr(item),
item - ior->pool, ((MDBX_page *)item->single.iov_base)->mp_pgno,
bytes, item->ov.Offset + ((uint64_t)item->ov.OffsetHigh << 32),
r.err);
goto bailout_rc;
} else if (unlikely(written != bytes)) {
r.err = ERROR_WRITE_FAULT;
@ -973,10 +977,11 @@ osal_ioring_write(osal_ioring_t *ior) {
!GetOverlappedResult(ior->fd, &item->ov, &written, true))) {
ERROR("%s: item %p (%zu), pgno %u, bytes %zu, offset %" PRId64
", err %d",
"GetOverlappedResult", item, item - ior->pool,
"GetOverlappedResult", __Wpedantic_format_voidptr(item),
item - ior->pool,
((MDBX_page *)item->single.iov_base)->mp_pgno, bytes,
item->ov.Offset + ((uint64_t)item->ov.OffsetHigh << 32),
GetLastError());
(int)GetLastError());
goto bailout_geterr;
}
assert(MDBX_SUCCESS == item->ov.Internal);
@ -994,10 +999,10 @@ osal_ioring_write(osal_ioring_t *ior) {
r.err = (int)GetLastError();
ERROR("%s: item %p (%zu), pgno %u, bytes %zu, offset %" PRId64
", err %d",
"Result", item, item - ior->pool,
"Result", __Wpedantic_format_voidptr(item), item - ior->pool,
((MDBX_page *)item->single.iov_base)->mp_pgno, bytes,
item->ov.Offset + ((uint64_t)item->ov.OffsetHigh << 32),
GetLastError());
(int)GetLastError());
goto bailout_rc;
}
if (unlikely(item->ov.InternalHigh != bytes)) {