diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2018-03-26 23:36:15 +0200 |
|---|---|---|
| committer | Kristian Evers <kristianevers@gmail.com> | 2018-03-27 11:37:13 +0200 |
| commit | 234eba764d7fea67b597d8f9ed5225e651f4a945 (patch) | |
| tree | 21895b6b3c38a93c2cb2dbe17f19115d22129587 /src | |
| parent | 0962d1ecf116e2eeeccfa6ce5c9613407691f38c (diff) | |
| download | PROJ-234eba764d7fea67b597d8f9ed5225e651f4a945.tar.gz PROJ-234eba764d7fea67b597d8f9ed5225e651f4a945.zip | |
Validate that units match between pipeline steps
As suggested in [0], steps in a pipeline are now checked for compliance.
If the right side units in step n differ from the left side units in
step n+1 the pipeline can't be constructed and an error is raised.
[0] https://lists.osgeo.org/pipermail/grass-dev/2018-March/088123.html
Diffstat (limited to 'src')
| -rw-r--r-- | src/PJ_pipeline.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/PJ_pipeline.c b/src/PJ_pipeline.c index 2791a4e8..b60e05a8 100644 --- a/src/PJ_pipeline.c +++ b/src/PJ_pipeline.c @@ -470,6 +470,19 @@ PJ *OPERATION(pipeline,0) { } } + /* Check that output units from step i are compatible with expected units in step i+1 */ + for (i = 1; i < nsteps; i++) { + enum pj_io_units unit_returned = pj_right (P->opaque->pipeline[i]); + enum pj_io_units unit_expected = pj_left (P->opaque->pipeline[i+1]); + + if ( unit_returned == PJ_IO_UNITS_WHATEVER || unit_expected == PJ_IO_UNITS_WHATEVER ) + continue; + if ( unit_returned != unit_expected ) { + proj_log_error (P, "Pipeline: Mismatched units between step %d and %d", i, i+1); + return destructor (P, PJD_ERR_MALFORMED_PIPELINE); + } + } + proj_log_trace (P, "Pipeline: %d steps built. Determining i/o characteristics", nsteps); /* Determine forward input (= reverse output) data type */ |
