| 3211 | // --------------------------------------------------------------------------- |
| 3212 | |
| 3213 | ListOfGenericGrids pj_generic_grid_init(PJ *P, const char *gridkey) { |
| 3214 | std::string key("s"); |
| 3215 | key += gridkey; |
| 3216 | const char *gridnames = pj_param(P->ctx, P->params, key.c_str()).s; |
| 3217 | if (gridnames == nullptr) |
| 3218 | return {}; |
| 3219 | |
| 3220 | auto listOfGridNames = internal::split(std::string(gridnames), ','); |
| 3221 | ListOfGenericGrids grids; |
| 3222 | for (const auto &gridnameStr : listOfGridNames) { |
| 3223 | const char *gridname = gridnameStr.c_str(); |
| 3224 | bool canFail = false; |
| 3225 | if (gridname[0] == '@') { |
| 3226 | canFail = true; |
| 3227 | gridname++; |
| 3228 | } |
| 3229 | auto gridSet = GenericShiftGridSet::open(P->ctx, gridname); |
| 3230 | if (!gridSet) { |
| 3231 | if (!canFail) { |
| 3232 | if (proj_context_errno(P->ctx) != |
| 3233 | PROJ_ERR_OTHER_NETWORK_ERROR) { |
| 3234 | proj_context_errno_set( |
| 3235 | P->ctx, PROJ_ERR_INVALID_OP_FILE_NOT_FOUND_OR_INVALID); |
| 3236 | } |
| 3237 | return {}; |
| 3238 | } |
| 3239 | proj_context_errno_set(P->ctx, |
| 3240 | 0); // don't treat as a persistent error |
| 3241 | } else { |
| 3242 | grids.emplace_back(std::move(gridSet)); |
| 3243 | } |
| 3244 | } |
| 3245 | |
| 3246 | return grids; |
| 3247 | } |
| 3248 | |
| 3249 | // --------------------------------------------------------------------------- |
| 3250 |
no test coverage detected