Skip to content

Commit

Permalink
[davix] avoid using VLA
Browse files Browse the repository at this point in the history
  • Loading branch information
silverweed committed Sep 24, 2024
1 parent 5ad0863 commit a24d36e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions net/davix/src/TDavixFile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include <sstream>
#include <string>
#include <cstring>
#include <memory>


static const std::string VERSION = "0.2.0";
Expand Down Expand Up @@ -972,8 +973,8 @@ Long64_t TDavixFile::DavixReadBuffers(Davix_fd *fd, char *buf, Long64_t *pos, In
{
DavixError *davixErr = NULL;
Double_t start_time = eventStart();
DavIOVecInput in[nbuf];
DavIOVecOuput out[nbuf];
auto in = std::make_unique<DavIOVecInput[]>(nbuf);
auto out = std::make_unique<DavIOVecOuput[]>(nbuf);

int lastPos = 0;
for (Int_t i = 0; i < nbuf; ++i) {
Expand All @@ -983,7 +984,7 @@ Long64_t TDavixFile::DavixReadBuffers(Davix_fd *fd, char *buf, Long64_t *pos, In
lastPos += len[i];
}

Long64_t ret = d_ptr->davixPosix->preadVec(fd, in, out, nbuf, &davixErr);
Long64_t ret = d_ptr->davixPosix->preadVec(fd, in.get(), out.get(), nbuf, &davixErr);
if (ret < 0) {
Error("DavixReadBuffers", "can not read data with davix: %s (%d)",
davixErr->getErrMsg().c_str(), davixErr->getStatus());
Expand Down

0 comments on commit a24d36e

Please sign in to comment.