mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 12:10:34 +00:00
Avoid usage of variable length arrays, which is a C99 feature
This commit is contained in:
parent
3c92d6a7c6
commit
80c4cdd1cb
@ -38,6 +38,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
labsat23_source_sptr labsat23_make_source_sptr(const char *signal_file_basename, int channel_selector, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue)
|
labsat23_source_sptr labsat23_make_source_sptr(const char *signal_file_basename, int channel_selector, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue)
|
||||||
@ -428,8 +429,8 @@ int labsat23_source::general_work(int noutput_items,
|
|||||||
int n_int16_to_read = noutput_items / 8;
|
int n_int16_to_read = noutput_items / 8;
|
||||||
if (n_int16_to_read > 0)
|
if (n_int16_to_read > 0)
|
||||||
{
|
{
|
||||||
int16_t memblock[n_int16_to_read];
|
std::vector<int16_t> memblock(n_int16_to_read);
|
||||||
binary_input_file->read(reinterpret_cast<char *>(memblock), n_int16_to_read * 2);
|
binary_input_file->read(reinterpret_cast<char *>(memblock.data()), n_int16_to_read * 2);
|
||||||
n_int16_to_read = binary_input_file->gcount() / 2; // from bytes to int16
|
n_int16_to_read = binary_input_file->gcount() / 2; // from bytes to int16
|
||||||
if (n_int16_to_read > 0)
|
if (n_int16_to_read > 0)
|
||||||
{
|
{
|
||||||
@ -486,8 +487,8 @@ int labsat23_source::general_work(int noutput_items,
|
|||||||
int n_int16_to_read = noutput_items / 4;
|
int n_int16_to_read = noutput_items / 4;
|
||||||
if (n_int16_to_read > 0)
|
if (n_int16_to_read > 0)
|
||||||
{
|
{
|
||||||
int16_t memblock[n_int16_to_read];
|
std::vector<int16_t> memblock(n_int16_to_read);
|
||||||
binary_input_file->read(reinterpret_cast<char *>(memblock), n_int16_to_read * 2);
|
binary_input_file->read(reinterpret_cast<char *>(memblock.data()), n_int16_to_read * 2);
|
||||||
n_int16_to_read = binary_input_file->gcount() / 2; // from bytes to int16
|
n_int16_to_read = binary_input_file->gcount() / 2; // from bytes to int16
|
||||||
if (n_int16_to_read > 0)
|
if (n_int16_to_read > 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user