Skip to content

Commit

Permalink
change info app lib
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsumner committed Jun 10, 2024
1 parent 687f7db commit 1d59436
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions inst/include/gdalapplib/gdalapplib.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@ inline CharacterVector gdalinfo_applib_cpp(CharacterVector dsn,

//put -json in the input options for this call
//Rcpp::CharacterVector argv = {"-json", "-stats", "-hist"};
std::vector<char *> opt(options.size() + 1);
char** papszArg = nullptr;
for (R_xlen_t i = 0; i < options.size(); ++i) {
opt[i] = (char *) (options[i]);
if (!options[0].empty()) {
papszArg = CSLAddString(papszArg, options[i]);
}
}
opt[options.size()] = nullptr;
GDALInfoOptions* psOptions = GDALInfoOptionsNew(opt.data(), nullptr);
if (psOptions == nullptr)
GDALInfoOptions* psOptions = GDALInfoOptionsNew(papszArg, nullptr);
CSLDestroy(papszArg);
if (psOptions == nullptr) {
Rcpp::stop("creation of GDALInfoOptions failed");

}
CharacterVector out(dsn.size());
for (R_xlen_t i = 0; i < out.size(); i++) {

Expand Down

0 comments on commit 1d59436

Please sign in to comment.