Fix build for Release mode.

This commit is contained in:
Themaister 2011-12-25 11:45:27 +01:00
parent 381498e945
commit c272ba56ad
3 changed files with 13 additions and 8 deletions

View File

@ -288,11 +288,13 @@ void init_audio(void)
size_t max_bufsamples = AUDIO_CHUNK_SIZE_NONBLOCKING * 2;
// Used for recording even if audio isn't enabled.
assert((g_extern.audio_data.conv_outsamples = (int16_t*)malloc(max_bufsamples * sizeof(int16_t) * AUDIO_MAX_RATIO)));
g_extern.audio_data.conv_outsamples = (int16_t*)malloc(max_bufsamples * sizeof(int16_t) * AUDIO_MAX_RATIO);
assert(g_extern.audio_data.conv_outsamples);
g_extern.audio_data.chunk_size = g_extern.audio_data.block_chunk_size;
// Needs to be able to hold full content of a full max_bufsamples in addition to its own.
assert((g_extern.audio_data.rewind_buf = (int16_t*)malloc(max_bufsamples * sizeof(int16_t))));
g_extern.audio_data.rewind_buf = (int16_t*)malloc(max_bufsamples * sizeof(int16_t));
assert(g_extern.audio_data.rewind_buf);
g_extern.audio_data.rewind_size = max_bufsamples;
if (!g_settings.audio.enable)
@ -326,10 +328,13 @@ void init_audio(void)
if (!g_extern.audio_data.source)
g_extern.audio_active = false;
assert((g_extern.audio_data.data = (float*)malloc(max_bufsamples * sizeof(float))));
g_extern.audio_data.data = (float*)malloc(max_bufsamples * sizeof(float));
assert(g_extern.audio_data.data);
g_extern.audio_data.data_ptr = 0;
assert(g_settings.audio.out_rate < g_settings.audio.in_rate * AUDIO_MAX_RATIO);
assert((g_extern.audio_data.outsamples = (float*)malloc(max_bufsamples * sizeof(float) * AUDIO_MAX_RATIO)));
g_extern.audio_data.outsamples = (float*)malloc(max_bufsamples * sizeof(float) * AUDIO_MAX_RATIO);
assert(g_extern.audio_data.outsamples);
g_extern.audio_data.src_ratio =
(double)g_settings.audio.out_rate / g_settings.audio.in_rate;

2
file.c
View File

@ -518,7 +518,7 @@ void load_ram_file(const char *path, int type)
void *buf = NULL;
ssize_t rc = read_file(path, &buf);
if (rc <= (ssize_t)size)
if (rc > 0 && rc <= (ssize_t)size)
memcpy(data, buf, rc);
free(buf);

View File

@ -55,7 +55,7 @@
<ExceptionHandling>false</ExceptionHandling>
<FloatingPointModel>Precise</FloatingPointModel>
<CompileAs>CompileAsCpp</CompileAs>
<AdditionalOptions>/D HAVE_SDL /D PACKAGE_VERSION=\"0.9.3\" /D _CRT_SECURE_NO_WARNINGS /D HAVE_NETPLAY /D HAVE_THREADS /D HAVE_OPENGL /D HAVE_DYLIB /D HAVE_DYNAMIC /D HAVE_CG /D HAVE_XAUDIO /D HAVE_FBO /D HAVE_CONFIGFILE %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/D HAVE_SDL /D PACKAGE_VERSION=\"0.9.3\" /D _CRT_SECURE_NO_WARNINGS /D HAVE_NETPLAY /D HAVE_THREADS /D HAVE_OPENGL /D HAVE_DYLIB /D HAVE_DYNAMIC /D HAVE_CG /D HAVE_XAUDIO /D HAVE_FBO /D HAVE_CONFIGFILE /D HAVE_DSOUND %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -72,13 +72,13 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalOptions>/D HAVE_SDL /D PACKAGE_VERSION=\"0.9.3\" /D _CRT_SECURE_NO_WARNINGS /D HAVE_NETPLAY /D HAVE_THREADS /D HAVE_OPENGL /D HAVE_DYLIB /D HAVE_DYNAMIC /D HAVE_CG /D HAVE_XAUDIO /D HAVE_FBO /D HAVE_CONFIGFILE %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/D HAVE_SDL /D PACKAGE_VERSION=\"0.9.3\" /D _CRT_SECURE_NO_WARNINGS /D HAVE_NETPLAY /D HAVE_THREADS /D HAVE_OPENGL /D HAVE_DYLIB /D HAVE_DYNAMIC /D HAVE_CG /D HAVE_XAUDIO /D HAVE_FBO /D HAVE_CONFIGFILE /D HAVE_DSOUND %(AdditionalOptions)</AdditionalOptions>
<CompileAs>CompileAsCpp</CompileAs>
<FloatingPointModel>Fast</FloatingPointModel>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>SDL.lib;opengl32.lib;ws2_32.lib;dxguid.lib;dinput8.lib;cg.lib;cgGL.lib;winmm.lib;shlwapi.lib;dsound.lib;%(AdditionalDependencies)</AdditionalDependencies>