Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return value of DavFile::get is -1 but no error is thrown #69

Closed
mxxo opened this issue Jun 15, 2021 · 1 comment
Closed

Return value of DavFile::get is -1 but no error is thrown #69

mxxo opened this issue Jun 15, 2021 · 1 comment

Comments

@mxxo
Copy link
Contributor

mxxo commented Jun 15, 2021

Hello,

I would like to use DavFile::get to download some files. For the few cases I have tried it seems that DavFile::get returns -1 instead of the number of bytes read, but as far as I can tell, the read succeeds and no DavixError is thrown. I wanted to ask if I am indeed making an error here.

e.g.

#include <davix.hpp>
#include <iostream>
#include <vector>

int main() {
   Davix::Context c;
   Davix::RequestParams p;
   Davix::DavFile file(c, p, Davix::Uri("https://root.cern/files/LHCb002_data_v1.root"));

   std::vector<char> buf;
   auto ret = file.get(nullptr, buf);
   // file size is 11461 B
   if (buf.size() != 11461) {
      std::cout << "expected 11461 bytes read, got " << buf.size() << "\n";
   }
   std::cout << "got ret: " << ret << "\n";
   return 0;
}

prints

got ret: -1

Thank you very much for your time.

Setup

  • davix built from source, devel branch
  • Ubuntu 18.04
@mpatrascoiu
Copy link
Contributor

Hello,

I also had a look at the DavixFile::get(..) function and came up to the same problem as outlined in MergeRequest #70.

Many thanks for reporting and fixing this!

Cheers,
Mihai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants