diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2012-11-01 16:01:37 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2012-11-01 16:01:37 (GMT) |
commit | b9d042d2d273cacff8ecfeecd5e1bd75a6da7f3b (patch) | |
tree | 846e6e81be5ccaa721d2c94ef98771de52b0f48b /src | |
parent | 51c5bf8aa76cf378ccd59b02247fb7cd0d9b3eaf (diff) | |
download | hdf5-b9d042d2d273cacff8ecfeecd5e1bd75a6da7f3b.zip hdf5-b9d042d2d273cacff8ecfeecd5e1bd75a6da7f3b.tar.gz hdf5-b9d042d2d273cacff8ecfeecd5e1bd75a6da7f3b.tar.bz2 |
[svn-r22998] Description:
Clean up warnings and bring changes from Coverity branch back to trunk:
r20451:
Fixed coverity 810
r20454:
Purpose: Fix coverity issue 816
Description: Modified various file drivers to always check the return value from
H5P_get_driver_info.
r20455:
Purpose: Cleanup fix for coverity issue 816
Description: Removed redundant check for "fa" in H5FD_core_open.
Tested on:
Mac OSX/64 10.8.2 (amazon) w/debug
(Too minor to require h5committest)
Diffstat (limited to 'src')
-rw-r--r-- | src/H5FDcore.c | 2 | ||||
-rw-r--r-- | src/H5FDdirect.c | 9 | ||||
-rw-r--r-- | src/H5FDfamily.c | 4 | ||||
-rw-r--r-- | src/H5FDlog.c | 18 | ||||
-rw-r--r-- | src/H5FDmpio.c | 4 | ||||
-rw-r--r-- | src/H5FDmpiposix.c | 4 |
6 files changed, 21 insertions, 20 deletions
diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 932e2af..07f4551 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -481,7 +481,7 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, * default value. But if the file access property list was zero then use * the default value instead. */ - file->increment = (fa->increment>0) ? fa->increment : H5FD_CORE_INCREMENT; + file->increment = (fa->increment > 0) ? fa->increment : H5FD_CORE_INCREMENT; /* If save data in backing store. */ file->backing_store = fa->backing_store; diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 4721a44..9715bc1 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -533,7 +533,8 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd /* Get the driver specific information */ if(NULL == (plist = H5P_object_verify(fapl_id,H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - fa = H5P_get_driver_info(plist); + if(NULL == (fa = (H5FD_direct_fapl_t *)H5P_get_driver_info(plist))) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") file->fd = fd; H5_ASSIGN_OVERFLOW(file->eof,sb.st_size,h5_stat_size_t,haddr_t); @@ -562,9 +563,9 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd * is to handle correctly the case that the file is in a different file system * than the one where the program is running. */ - buf1 = (int*)HDmalloc(sizeof(int)); - if (HDposix_memalign(&buf2, file->fa.mboundary, file->fa.fbsize) != 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "HDposix_memalign failed") + buf1 = (int *)HDmalloc(sizeof(int)); + if(HDposix_memalign(&buf2, file->fa.mboundary, file->fa.fbsize) != 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "HDposix_memalign failed") if(o_flags & O_CREAT) { if(write(file->fd, (void*)buf1, sizeof(int))<0) { diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index f051269..dc535a2 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -675,8 +675,8 @@ H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id, if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - fa = (H5FD_family_fapl_t *)H5P_get_driver_info(plist); - HDassert(fa); + if(NULL == (fa = (H5FD_family_fapl_t *)H5P_get_driver_info(plist))) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") /* Check for new family file size. It's used by h5repart only. */ if(H5P_exist_plist(plist, H5F_ACS_FAMILY_NEWSIZE_NAME) > 0) { diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 6a2425c..9f4abd3 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -529,8 +529,8 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* Get the driver specific information */ if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - fa = (H5FD_log_fapl_t *)H5P_get_driver_info(plist); - HDassert(fa); + if(NULL == (fa = (H5FD_log_fapl_t *)H5P_get_driver_info(plist))) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") #ifdef H5_HAVE_GETTIMEOFDAY if(fa->flags & H5FD_LOG_TIME_OPEN) @@ -644,9 +644,9 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) #ifdef H5_HAVE_GETTIMEOFDAY if(file->fa.flags & H5FD_LOG_TIME_OPEN) - HDfprintf(file->logfp, "Open took: (%f s)\n", (double)open_timeval_diff.tv_sec + ((double)open_timeval_diff.tv_usec / (double)1000000.0)); + HDfprintf(file->logfp, "Open took: (%f s)\n", (double)open_timeval_diff.tv_sec + ((double)open_timeval_diff.tv_usec / (double)1000000.0f)); if(file->fa.flags & H5FD_LOG_TIME_STAT) - HDfprintf(file->logfp, "Stat took: (%f s)\n", (double)stat_timeval_diff.tv_sec + ((double)stat_timeval_diff.tv_usec / (double)1000000.0)); + HDfprintf(file->logfp, "Stat took: (%f s)\n", (double)stat_timeval_diff.tv_sec + ((double)stat_timeval_diff.tv_usec / (double)1000000.0f)); #endif /* H5_HAVE_GETTIMEOFDAY */ } /* end if */ @@ -734,7 +734,7 @@ H5FD_log_close(H5FD_t *_file) timeval_diff.tv_usec += 1000000; timeval_diff.tv_sec--; } /* end if */ - HDfprintf(file->logfp, "Close took: (%f s)\n", (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0)); + HDfprintf(file->logfp, "Close took: (%f s)\n", (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f)); } /* end if */ #endif /* H5_HAVE_GETTIMEOFDAY */ @@ -1195,7 +1195,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t addr timeval_diff.tv_usec += 1000000; timeval_diff.tv_sec--; } /* end if */ - time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0); + time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f); HDfprintf(file->logfp, " (%f s)\n", time_diff); /* Add to total seek time */ @@ -1284,7 +1284,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t addr timeval_diff.tv_usec += 1000000; timeval_diff.tv_sec--; } /* end if */ - time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0); + time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f); HDfprintf(file->logfp, " (%f s)\n", time_diff); /* Add to total read time */ @@ -1401,7 +1401,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t add timeval_diff.tv_usec += 1000000; timeval_diff.tv_sec--; } /* end if */ - time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0); + time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f); HDfprintf(file->logfp, " (%f s)\n", time_diff); /* Add to total seek time */ @@ -1487,7 +1487,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t add timeval_diff.tv_usec += 1000000; timeval_diff.tv_sec--; } /* end if */ - time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0); + time_diff = (double)timeval_diff.tv_sec + ((double)timeval_diff.tv_usec / (double)1000000.0f); HDfprintf(file->logfp, " (%f s)\n", time_diff); /* Add to total write time */ diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index cac101b..2db77c9 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1013,8 +1013,8 @@ H5FD_mpio_open(const char *name, unsigned flags, hid_t fapl_id, _fa.info = MPI_INFO_NULL; /*default*/ fa = &_fa; } else { - fa = (const H5FD_mpio_fapl_t *)H5P_get_driver_info(plist); - assert(fa); + if(NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_get_driver_info(plist))) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") } /* Duplicate communicator and Info object for use by this file. */ diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c index 0d0b839..092cd24 100644 --- a/src/H5FDmpiposix.c +++ b/src/H5FDmpiposix.c @@ -600,8 +600,8 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id, fa = &_fa; } /* end if */ else { - fa = H5P_get_driver_info(plist); - HDassert(fa); + if(NULL == (fa = (const H5FD_mpiposix_fapl_t *)H5P_get_driver_info(plist))) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "bad VFL driver info") } /* end else */ /* Duplicate the communicator for use by this file. */ |