/
| 380 | |
| 381 | /*****************************************************************************/ |
| 382 | char *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 | /*****************************************************************************/ |
| 413 | void proj_context_errno_set(PJ_CONTEXT *ctx, int err) { |
no test coverage detected