Commit e03e8c82 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Replace sequence of mutually exlusive ifs with switch.

parent b9031984
...@@ -2636,37 +2636,39 @@ static void gridComplete(grid_t *grid) ...@@ -2636,37 +2636,39 @@ static void gridComplete(grid_t *grid)
gridDefArea(gridID, area); gridDefArea(gridID, area);
} }
if ( gridtype == GRID_LAEA ) switch (gridtype)
gridDefLaea(gridID, grid->laea_a, grid->laea_lon_0, grid->laea_lat_0);
if ( gridtype == GRID_LCC2 )
gridDefLcc2(gridID, grid->lcc2_a, grid->lcc2_lon_0, grid->lcc2_lat_0, grid->lcc2_lat_1, grid->lcc2_lat_2);
if ( gridtype == GRID_LCC )
gridDefLCC(gridID, grid->lcc_originLon, grid->lcc_originLat, grid->lcc_lonParY,
grid->lcc_lat1, grid->lcc_lat2, grid->lcc_xinc, grid->lcc_yinc,
grid->lcc_projflag, grid->lcc_scanflag);
if ( gridtype == GRID_UNSTRUCTURED )
{ {
int number = grid->number; case GRID_LAEA:
int position = grid->position >= 0 ? grid->position : 0; gridDefLaea(gridID, grid->laea_a, grid->laea_lon_0, grid->laea_lat_0);
if ( number > 0 ) break;
{ case GRID_LCC2:
gridDefNumber(gridID, number); gridDefLcc2(gridID, grid->lcc2_a, grid->lcc2_lon_0, grid->lcc2_lat_0, grid->lcc2_lat_1, grid->lcc2_lat_2);
gridDefPosition(gridID, position); break;
} case GRID_LCC:
if ( grid->reference ) gridDefLCC(gridID, grid->lcc_originLon, grid->lcc_originLat, grid->lcc_lonParY,
{ grid->lcc_lat1, grid->lcc_lat2, grid->lcc_xinc, grid->lcc_yinc,
const char *reference = grid->reference; grid->lcc_projflag, grid->lcc_scanflag);
grid->reference = NULL; break;
gridDefReference(gridID, reference); case GRID_UNSTRUCTURED:
} {
} int number = grid->number;
int position = grid->position >= 0 ? grid->position : 0;
if ( gridtype == GRID_PROJECTION ) if ( number > 0 )
{ {
grid->name = strdup(grid->name); gridDefNumber(gridID, number);
gridDefPosition(gridID, position);
}
if ( grid->reference )
{
const char *reference = grid->reference;
grid->reference = NULL;
gridDefReference(gridID, reference);
}
}
break;
case GRID_PROJECTION:
grid->name = strdup(grid->name);
break;
} }
break; break;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment