| 2782 | // --------------------------------------------------------------------------- |
| 2783 | |
| 2784 | ListOfGenericGrids pj_generic_grid_init(PJ *P, const char *gridkey) { |
| 2785 | std::string key("s"); |
| 2786 | key += gridkey; |
| 2787 | const char *gridnames = pj_param(P->ctx, P->params, key.c_str()).s; |
| 2788 | if (gridnames == nullptr) |
| 2789 | return {}; |
| 2790 | |
| 2791 | auto listOfGridNames = internal::split(std::string(gridnames), ','); |
| 2792 | ListOfGenericGrids grids; |
| 2793 | for (const auto &gridnameStr : listOfGridNames) { |
| 2794 | const char *gridname = gridnameStr.c_str(); |
| 2795 | bool canFail = false; |
| 2796 | if (gridname[0] == '@') { |
| 2797 | canFail = true; |
| 2798 | gridname++; |
| 2799 | } |
| 2800 | auto gridSet = GenericShiftGridSet::open(P->ctx, gridname); |
| 2801 | if (!gridSet) { |
| 2802 | if (!canFail) { |
| 2803 | if (proj_context_errno(P->ctx) != |
| 2804 | PROJ_ERR_OTHER_NETWORK_ERROR) { |
| 2805 | proj_context_errno_set( |
| 2806 | P->ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); |
| 2807 | } |
| 2808 | return {}; |
| 2809 | } |
| 2810 | proj_context_errno_set(P->ctx, |
| 2811 | 0); // don't treat as a persistent error |
| 2812 | } else { |
| 2813 | grids.emplace_back(std::move(gridSet)); |
| 2814 | } |
| 2815 | } |
| 2816 | |
| 2817 | return grids; |
| 2818 | } |
| 2819 | |
| 2820 | // --------------------------------------------------------------------------- |
| 2821 |
no test coverage detected