/
| 356 | |
| 357 | /*****************************************************************************/ |
| 358 | static paralist *pj_expand_init_internal(PJ_CONTEXT *ctx, paralist *init, int allow_init_epsg) { |
| 359 | /****************************************************************************** |
| 360 | Append expansion of <key> to the paralist <init>. The expansion is appended, |
| 361 | rather than inserted at <init>'s place, since <init> may contain |
| 362 | overrides to the expansion. These must take precedence, and hence come first |
| 363 | in the expanded list. |
| 364 | |
| 365 | Consider e.g. the key 'foo:bar' which (hypothetically) expands to 'proj=utm |
| 366 | zone=32 ellps=GRS80', i.e. a UTM projection on the GRS80 ellipsoid. |
| 367 | |
| 368 | The expression 'init=foo:bar ellps=intl' will then expand to: |
| 369 | |
| 370 | 'init=foo:bar ellps=intl proj=utm zone=32 ellps=GRS80', |
| 371 | |
| 372 | where 'ellps=intl' precedes 'ellps=GRS80', and hence takes precedence, |
| 373 | turning the expansion into an UTM projection on the Hayford ellipsoid. |
| 374 | |
| 375 | Note that 'init=foo:bar' stays in the list. It is ignored after expansion. |
| 376 | |
| 377 | ******************************************************************************/ |
| 378 | paralist *last; |
| 379 | paralist *expn; |
| 380 | |
| 381 | /* Nowhere to start? */ |
| 382 | if (nullptr==init) |
| 383 | return nullptr; |
| 384 | |
| 385 | expn = get_init(ctx, init->param, allow_init_epsg); |
| 386 | |
| 387 | /* Nothing in expansion? */ |
| 388 | if (nullptr==expn) |
| 389 | return nullptr; |
| 390 | |
| 391 | /* Locate the end of the list */ |
| 392 | for (last = init; last && last->next; last = last->next); |
| 393 | |
| 394 | /* Then append and return */ |
| 395 | last->next = expn; |
| 396 | return init; |
| 397 | } |
| 398 | |
| 399 | paralist *pj_expand_init(PJ_CONTEXT *ctx, paralist *init) { |
| 400 | return pj_expand_init_internal(ctx, init, TRUE); |
no test coverage detected