/
| 255 | |
| 256 | /*************************************************************************************/ |
| 257 | PJ *proj_create_argv(PJ_CONTEXT *ctx, int argc, char **argv) { |
| 258 | /************************************************************************************** |
| 259 | Create a new PJ object in the context ctx, using the given definition |
| 260 | argument array argv. If ctx==0, the default context is used, if |
| 261 | definition==0, or invalid, a null-pointer is returned. The definition |
| 262 | arguments may use '+' as argument start indicator, as in {"+proj=utm", |
| 263 | "+zone=32"}, or leave it out, as in {"proj=utm", "zone=32"}. |
| 264 | **************************************************************************************/ |
| 265 | |
| 266 | if (nullptr == ctx) |
| 267 | ctx = pj_get_default_ctx(); |
| 268 | if (nullptr == argv) { |
| 269 | proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP_MISSING_ARG); |
| 270 | return nullptr; |
| 271 | } |
| 272 | |
| 273 | /* We assume that free format is used, and build a full proj_create |
| 274 | * compatible string */ |
| 275 | char *c = pj_make_args(argc, argv); |
| 276 | if (nullptr == c) { |
| 277 | proj_context_errno_set(ctx, PROJ_ERR_INVALID_OP /* ENOMEM */); |
| 278 | return nullptr; |
| 279 | } |
| 280 | |
| 281 | PJ *P = proj_create(ctx, c); |
| 282 | |
| 283 | free((char *)c); |
| 284 | return P; |
| 285 | } |
| 286 | |
| 287 | /*************************************************************************************/ |
| 288 | PJ *pj_create_argv_internal(PJ_CONTEXT *ctx, int argc, char **argv) { |