Merge pull request #1465 from admshao/vla-removal
Add compiler checks to avoid VLA
This commit is contained in:
commit
22c8dba718
@ -67,8 +67,8 @@ if(${CMAKE_C_COMPILER_ID} MATCHES "Clang" OR ${CMAKE_CXX_COMPILER_ID} MATCHES "C
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG)
|
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG)
|
||||||
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused-function -Werror-implicit-function-declaration -Wno-missing-field-initializers ${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
|
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wvla -Wno-unused-function -Werror-implicit-function-declaration -Wno-missing-field-initializers ${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
|
||||||
set(CMAKE_C_FLAGS "-Wall -Wextra -Wno-unused-function -Werror-implicit-function-declaration -Wno-missing-braces -Wno-missing-field-initializers ${CMAKE_C_FLAGS} -std=gnu99 -fno-strict-aliasing")
|
set(CMAKE_C_FLAGS "-Wall -Wextra -Wvla -Wno-unused-function -Werror-implicit-function-declaration -Wno-missing-braces -Wno-missing-field-initializers ${CMAKE_C_FLAGS} -std=gnu99 -fno-strict-aliasing")
|
||||||
|
|
||||||
option(USE_LIBC++ "Use libc++ instead of libstdc++" ${APPLE})
|
option(USE_LIBC++ "Use libc++ instead of libstdc++" ${APPLE})
|
||||||
if(USE_LIBC++)
|
if(USE_LIBC++)
|
||||||
|
@ -307,14 +307,15 @@ int_fast32_t pulseaudio_connect_playback(pa_stream *s, const char *name,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
size_t dev_len = strlen(name) - 8;
|
size_t dev_len = strlen(name) - 8;
|
||||||
char device[dev_len];
|
char *device = bzalloc(dev_len + 1);
|
||||||
memcpy(device, name, dev_len);
|
memcpy(device, name, dev_len);
|
||||||
device[dev_len] = '\0';
|
|
||||||
|
|
||||||
pulseaudio_lock();
|
pulseaudio_lock();
|
||||||
int_fast32_t ret = pa_stream_connect_playback(s, device, attr, flags,
|
int_fast32_t ret = pa_stream_connect_playback(s, device, attr, flags,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
pulseaudio_unlock();
|
pulseaudio_unlock();
|
||||||
|
|
||||||
|
bfree(device);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user