mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 01:04:02 +02:00
Merge pull request #343 from Clownacy/dev
Fix `ma_log_postv` not returning anything under certain circumstances
This commit is contained in:
+8
-6
@@ -8789,11 +8789,17 @@ MA_API ma_result ma_log_postv(ma_log* pLog, ma_uint32 level, const char* pFormat
|
|||||||
formattedLen = ma_vscprintf(&pLog->allocationCallbacks, pFormat, args2);
|
formattedLen = ma_vscprintf(&pLog->allocationCallbacks, pFormat, args2);
|
||||||
va_end(args2);
|
va_end(args2);
|
||||||
|
|
||||||
if (formattedLen > 0) {
|
if (formattedLen <= 0) {
|
||||||
|
return MA_INVALID_OPERATION;
|
||||||
|
}
|
||||||
|
|
||||||
char* pFormattedMessage = NULL;
|
char* pFormattedMessage = NULL;
|
||||||
|
|
||||||
pFormattedMessage = (char*)ma_malloc(formattedLen + 1, &pLog->allocationCallbacks);
|
pFormattedMessage = (char*)ma_malloc(formattedLen + 1, &pLog->allocationCallbacks);
|
||||||
if (pFormattedMessage != NULL) {
|
if (pFormattedMessage == NULL) {
|
||||||
|
return MA_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
ma_result result;
|
ma_result result;
|
||||||
|
|
||||||
/* We'll get errors on newer versions of Visual Studio if we try to use vsprintf(). */
|
/* We'll get errors on newer versions of Visual Studio if we try to use vsprintf(). */
|
||||||
@@ -8812,10 +8818,6 @@ MA_API ma_result ma_log_postv(ma_log* pLog, ma_uint32 level, const char* pFormat
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return MA_INVALID_OPERATION;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
/* Can't do anything because we don't have a safe way of to emulate vsnprintf() without a manual solution. */
|
/* Can't do anything because we don't have a safe way of to emulate vsnprintf() without a manual solution. */
|
||||||
|
|||||||
Reference in New Issue
Block a user