Skip to content

Commit

Permalink
Fix compilation where VLA is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
Lestropie committed Dec 26, 2024
1 parent d79d72a commit 7ed0a5d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
7 changes: 4 additions & 3 deletions cmd/mrdegibbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "command.h"
#include "image.h"
#include "progressbar.h"
#include "types.h"
#include "algo/threaded_loop.h"
#include <numeric>

Expand Down Expand Up @@ -208,15 +209,15 @@ class ComputeSlice
const int numlines = eig.cols();
shifted.resize (n, 2*nsh+1);

int shifts [2*nsh+1];
vector<int> shifts(2*nsh+1);
shifts[0] = 0;
for (int j = 0; j < nsh; j++) {
shifts[j+1] = j+1;
shifts[1+nsh+j] = -(j+1);
}

double TV1arr[2*nsh+1];
double TV2arr[2*nsh+1];
vector<double> TV1arr(2*nsh+1);
vector<double> TV2arr(2*nsh+1);

for (int k = 0; k < numlines; k++) {
shifted.col(0) = eig.col(k);
Expand Down
5 changes: 3 additions & 2 deletions core/file/mgh.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "header.h"
#include "raw.h"
#include "types.h"
#include "file/gz.h"
#include "file/nifti_utils.h"

Expand Down Expand Up @@ -378,7 +379,7 @@ namespace MR
const int64_t fend = in.tellg();
const int64_t empty_space_len = len - (fend - fstart);
if (empty_space_len > 0) {
char buffer[empty_space_len];
VLA(buffer, char, empty_space_len);
in.read (buffer, empty_space_len);
}

Expand Down Expand Up @@ -806,7 +807,7 @@ namespace MR
const int64_t fend = out.tellp();
const int64_t extra_space_len = len - (fend - fstart);
if (extra_space_len > 0) {
char buffer[extra_space_len];
VLA(buffer, char, extra_space_len);
memset (buffer, 0x00, extra_space_len);
out.write (buffer, extra_space_len);
}
Expand Down
4 changes: 3 additions & 1 deletion src/gui/mrview/mode/lightbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#include "gui/mrview/mode/lightbox.h"

#include "types.h"

namespace MR
{
namespace GUI
Expand Down Expand Up @@ -259,7 +261,7 @@ namespace MR
gl::EnableVertexAttribArray (0);
gl::VertexAttribPointer (0, 2, gl::FLOAT, gl::FALSE_, 0, (void*)0);

GLfloat data[num_points];
VLA(data, GLfloat, num_points);

// Grid line stride
float x_inc = 2.f / n_cols;
Expand Down
3 changes: 2 additions & 1 deletion src/gui/mrview/sync/localsocketreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

#include "exception.h"
#include "types.h"
#include "gui/mrview/sync/localsocketreader.h"

namespace MR
Expand Down Expand Up @@ -74,7 +75,7 @@ namespace MR
}

//Read delivered data
char read[sizeOfMessage];
VLA(read, char, sizeOfMessage);
socket->read(read, sizeOfMessage);
std::shared_ptr<QByteArray> readData = std::shared_ptr<QByteArray>(new QByteArray());
readData->insert(0, read, sizeOfMessage);
Expand Down

0 comments on commit 7ed0a5d

Please sign in to comment.