Fix building under MSVC#160
Open
SergioFLS wants to merge 5 commits into
Open
Conversation
- Add vcpkg integration (CMakePresets.json, vcpkg.json, vcpkg-configuration.json) for dependency management - Update .gitignore for more build/IDE artifacts - Refactor CMakeLists.txt for MSVC/MinGW with conditional warnings - Replace VLA with calloc for MSVC compatibility; ensure proper memory freeing - Add ALIGN and NOINLINE macros; improve safe memory allocation functions - Make for-each/repeat macros portable for compilers without typeof - Replace switch-case ranges with explicit cases for MSVC - Add MSVC-specific workarounds (e.g., disable WASAPI in miniaudio) - General memory safety and portability improvements(?)
Open
Un1q32
reviewed
May 24, 2026
Un1q32
reviewed
May 24, 2026
Un1q32
reviewed
May 24, 2026
Un1q32
reviewed
May 24, 2026
| #define forEach(type, item, array, count) \ | ||
| for (typeof(count) item##_i_ = 0; item##_i_ < (count); item##_i_++) \ | ||
| for (type* item = &(array)[item##_i_]; item; item = NULL) | ||
| for (TYPEOF(count) item##_i_ = 0; item##_i_ < (long long)(count); item##_i_++) \ |
Contributor
There was a problem hiding this comment.
why cast count to long long here?
Un1q32
reviewed
May 26, 2026
| void filterAlphabets(char *str) { | ||
| char result[strlen(str) + 1]; | ||
| size_t resultLen = strlen(str) + 1; | ||
| char *result = (char*)malloc(resultLen); |
Contributor
There was a problem hiding this comment.
you should actually use safeMalloc for this so it handles failed allocations right.
Un1q32
reviewed
May 26, 2026
| size_t bufSize = (size_t)sz + 1; | ||
| char *buf = malloc(bufSize); | ||
| snprintf(buf, bufSize, "audiogroup%d.dat", groupIndex); | ||
| free(buf); |
Contributor
There was a problem hiding this comment.
you free buf here right before it gets used the very next line, you need to free it later
Un1q32
reviewed
May 30, 2026
| #include <string.h> | ||
| #include <stdio.h> | ||
| #ifndef _MSC_VER | ||
| #include <sys/time.h> |
Contributor
There was a problem hiding this comment.
move the sys/time.h header to right below time.h a little further down.
change it from
#else
#include <time.h>
#endifto
#else
#include <time.h>
#ifndef CLOCK_MONOTONIC
#include <sys/time.h>
#endif
#endif
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tested on VS2026 Community (latest as of writing this), not sure what happens when using earlier versions
Also ASAN for some reason seems to detect a null pointer reference in dsound.dll, making it crash when compiled with ASAN enabled
This also adds a new dependency exclusive to Windows: getopt-win32, which has a LGPLv3-only license. Probably not problematic for proprietary forks unless linked statically with it.