Making sure no warnings are printed (except for getenv) on windows.

This commit is contained in:
2026-04-17 13:58:28 +02:00
parent ee33c72915
commit 89b084a6a7
6 changed files with 27 additions and 16 deletions

14
shm.cpp
View File

@@ -138,7 +138,7 @@ public:
first_i->prev = p_i;
}
i->prev = SHM_NULL;
i->alloc_size = bytes;
i->alloc_size = static_cast<int>(bytes);
*_first = p_i;
place = p_i + sizeof(ShmItem);
@@ -152,8 +152,8 @@ public:
} else {
*_used = u;
i->prev = SHM_NULL;
i->size = bytes;
i->alloc_size = bytes;
i->size = static_cast<int>(bytes);
i->alloc_size = static_cast<int>(bytes);
i->next = *_first;
if (*_first != SHM_NULL) {
ShmItem *first_i;
@@ -180,6 +180,7 @@ public:
ShmPlace p_i = place - sizeof(ShmItem);
ShmItem *i;
ref(p_i, &i);
if (i == nullptr) return;
if (i->prev != SHM_NULL) {
ShmItem *prev_i;
@@ -218,8 +219,9 @@ public:
public:
ShmApiBase(const char *name, size_t size, bool owner) {
char *buf = reinterpret_cast<char *>(malloc(strlen(name) + 50));
sprintf(buf, "sem_%s", name);
size_t buf_size = strlen(name) + 50;
char *buf = reinterpret_cast<char *>(malloc(buf_size));
snprintf(buf, buf_size, "sem_%s", name);
_sem_name = _strdup(buf);
_mem_name = _strdup(name);
::free(buf);
@@ -495,7 +497,7 @@ public:
if (_owner) {
*_first = SHM_NULL;
*_free_list = SHM_NULL;
*_used = sizeof(int) + sizeof(ShmItem *) + sizeof(ShmItem *) + slots_size;
*_used = static_cast<int>(sizeof(int) + sizeof(ShmItem *) + sizeof(ShmItem *) + slots_size);
}
}
}