MCPcopy Create free account
hub / github.com/OSGeo/PROJ / pj_make_args

Function pj_make_args

src/internal.cpp:382–410  ·  view source on GitHub ↗

/

Source from the content-addressed store, hash-verified

380
381/*****************************************************************************/
382char *pj_make_args(size_t argc, char **argv) {
383 /******************************************************************************
384 pj_make_args is the inverse of the pj_trim_argc/pj_trim_argv combo: It
385 converts free format command line input to something proj_create can
386 consume.
387
388 Allocates, and returns, an array of char, large enough to hold a whitespace
389 separated copy of the args in argv. It is the duty of the caller to free
390 this array.
391 ******************************************************************************/
392 try {
393 std::string s;
394 for (size_t i = 0; i < argc; i++) {
395 const char *equal = strchr(argv[i], '=');
396 if (equal) {
397 s += std::string(argv[i], equal - argv[i] + 1);
398 s += pj_double_quote_string_param_if_needed(equal + 1);
399 } else {
400 s += argv[i];
401 }
402 s += ' ';
403 }
404
405 char *p = pj_strdup(s.c_str());
406 return pj_shrink(p);
407 } catch (const std::exception &) {
408 return nullptr;
409 }
410}
411
412/*****************************************************************************/
413void proj_context_errno_set(PJ_CONTEXT *ctx, int err) {

Callers 1

proj_create_argvFunction · 0.85

Calls 3

pj_strdupFunction · 0.85
pj_shrinkFunction · 0.85

Tested by

no test coverage detected