diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2013-04-04 13:29:14 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2013-04-04 13:29:14 (GMT) |
commit | 9ab7c470005209b36eeb87a7f02e479f4379f107 (patch) | |
tree | 336b59aa5da3141ba09f05e09dbb114f83462738 /src/H5Z.c | |
parent | 68b0945687c29ce157280b66ec1773d6b0890069 (diff) | |
download | hdf5-9ab7c470005209b36eeb87a7f02e479f4379f107.zip hdf5-9ab7c470005209b36eeb87a7f02e479f4379f107.tar.gz hdf5-9ab7c470005209b36eeb87a7f02e479f4379f107.tar.bz2 |
[svn-r23543] Description:
Bring r23542 from desy_1_8 branch to trunk:
Further revisions to dynamic library loading code, to clean it up.
Tested on:
Mac OSX/64 10.8.3 (amazon) w/parallel
Diffstat (limited to 'src/H5Z.c')
-rw-r--r-- | src/H5Z.c | 50 |
1 files changed, 26 insertions, 24 deletions
@@ -1115,26 +1115,35 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, continue;/*filter excluded*/ } - /* If the filter isn't registered and the application doesn't indicate no plugin through HDF5_PRELOAD_PLUG (using the symbol "::"), - * try to load it dynamically and register it. Otherwise, return failure */ - if((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0 && !H5PL_no_plugin()) { - H5Z_class2_t *filter_info; - - if(NULL != (filter_info = (H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)(pline->filter[idx].id)))) { - if(H5Z_register(filter_info) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") - } /* end if */ + /* If the filter isn't registered and the application doesn't + * indicate no plugin through HDF5_PRELOAD_PLUG (using the symbol "::"), + * try to load it dynamically and register it. Otherwise, return failure + */ + if((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) { + hbool_t issue_error = FALSE; + + /* Check for "no plugins" indicated" */ + if(H5PL_no_plugin()) + issue_error = TRUE; else { - /* Print out the filter name to give more info. But the name is optional for - * the filter */ - if(pline->filter[idx].name) - HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "required filter '%s' is not registered", pline->filter[idx].name) + H5Z_class2_t *filter_info; + + /* Try loading the filter */ + if(NULL != (filter_info = (H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, (int)(pline->filter[idx].id)))) { + /* Register the filter we loaded */ + if(H5Z_register(filter_info) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") + + /* Search in the table of registered filters again to find the dynamic filter just loaded and registered */ + if((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) + issue_error = TRUE; + } /* end if */ else - HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "required filter (name unavailable) is not registered") + issue_error = TRUE; } /* end else */ - /* Search in the table of registered filters again to find the dynamic filter just loaded and registered */ - if((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0) { + /* Check for error */ + if(issue_error) { /* Print out the filter name to give more info. But the name is optional for * the filter */ if(pline->filter[idx].name) @@ -1142,14 +1151,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, else HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "required filter (name unavailable) is not registered") } /* end if */ - } else if((fclass_idx = H5Z_find_idx(pline->filter[idx].id)) < 0 && H5PL_no_plugin()) { - /* Print out the filter name to give more info. But the name is optional for - * the filter */ - if(pline->filter[idx].name) - HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "required filter '%s' is not registered", pline->filter[idx].name) - else - HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "required filter (name unavailable) is not registered") - } + } /* end if */ fclass=&H5Z_table_g[fclass_idx]; #ifdef H5Z_DEBUG |