Commit d8d466e0 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Instance: Fix build with MSVC 2015

asprintf isn't available
parent e86cc82f
......@@ -206,16 +206,18 @@ public:
char* psz_msg = message.get();
if (vsnprintf(psz_msg, len + 1, format, va) < 0 )
return;
char* psz_ctx;
if (asprintf(&psz_ctx, "[%s] (%s:%d) %s", psz_module, psz_file, i_line, psz_msg) < 0)
return;
std::unique_ptr<char, void(*)(void*)> ctxPtr(psz_ctx, &free);
#else
//MSVC treats passing nullptr as 1st vsnprintf(_s) as an error
char psz_msg[512];
if ( vsnprintf(psz_msg, sizeof(psz_msg) - 1, format, va) < 0 )
return;
char psz_ctx[1024];
sprintf_s(psz_ctx, "[%s] (%s:%d) %s", psz_module, psz_file, i_line, psz_msg);
#endif
char* psz_ctx;
if ( asprintf( &psz_ctx, "[%s] (%s:%d) %s", psz_module, psz_file, i_line, psz_msg ) < 0 )
return;
std::unique_ptr<char, void(*)(void*)> ctxPtr( psz_ctx, &free );
logCb( level, ctx, std::string{ psz_ctx } );
};
libvlc_log_set(*this, CallbackWrapper<(unsigned int)CallbackIdx::Log, libvlc_log_cb>::wrap( *m_callbacks, std::move(wrapper)),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment