summaryrefslogtreecommitdiffstats
path: root/src/H5Omtime.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-08-23 20:56:42 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-08-23 20:56:42 (GMT)
commit0f95a9d5ab47a609f50c7554e46f60b625df07e8 (patch)
tree2137e981bc20f6e3f40176487780a9032936d228 /src/H5Omtime.c
parent65996f2921391c653d05ad92b7b62ba27f3c2bdd (diff)
downloadhdf5-0f95a9d5ab47a609f50c7554e46f60b625df07e8.zip
hdf5-0f95a9d5ab47a609f50c7554e46f60b625df07e8.tar.gz
hdf5-0f95a9d5ab47a609f50c7554e46f60b625df07e8.tar.bz2
[svn-r19278] Description:
More fixes to memory allocation, etc. exposed by valgrind. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, w/threadsafe, in production mode Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode Mac OS X/32 10.6.4 (amazon) in debug mode Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
Diffstat (limited to 'src/H5Omtime.c')
-rw-r--r--src/H5Omtime.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index e71fb50..731d833 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -96,7 +96,7 @@ const H5O_msg_class_t H5O_MSG_MTIME_NEW[1] = {{
#define H5O_MTIME_VERSION 1
/* Track whether tzset routine was called */
-static int ntzset=0;
+static hbool_t ntzset = FALSE;
/* Declare a free list to manage the time_t struct */
H5FL_DEFINE(time_t);
@@ -180,23 +180,22 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
struct tm tm;
void *ret_value; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5O_mtime_decode);
+ FUNC_ENTER_NOAPI_NOINIT(H5O_mtime_decode)
/* check args */
- assert(f);
- assert(p);
+ HDassert(f);
+ HDassert(p);
/* Initialize time zone information */
- if (!ntzset) {
+ if(!ntzset) {
HDtzset();
- ntzset=1;
+ ntzset = TRUE;
} /* end if */
/* decode */
- for (i=0; i<14; i++) {
- if (!HDisdigit(p[i]))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message");
- }
+ for(i = 0; i < 14; i++)
+ if(!HDisdigit(p[i]))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message")
/*
* Convert YYYYMMDDhhmmss UTC to a time_t. This is a little problematic
@@ -213,8 +212,8 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
tm.tm_min = (p[10]-'0')*10 + (p[11]-'0');
tm.tm_sec = (p[12]-'0')*10 + (p[13]-'0');
tm.tm_isdst = -1; /*figure it out*/
- if ((time_t)-1==(the_time=HDmktime(&tm)))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message");
+ if((time_t)-1 == (the_time = HDmktime(&tm)))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message")
#if defined(H5_HAVE_TM_GMTOFF)
/* FreeBSD, OSF 4.0 */
@@ -230,8 +229,8 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
{
struct timezone tz;
- if (HDBSDgettimeofday(NULL, &tz)<0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information");
+ if(HDBSDgettimeofday(NULL, &tz) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information")
the_time -= tz.tz_minuteswest * 60 - (tm.tm_isdst ? 3600 : 0);
}
#elif defined(H5_HAVE_GETTIMEOFDAY) && defined(H5_HAVE_STRUCT_TIMEZONE) && defined(H5_GETTIMEOFDAY_GIVES_TZ)
@@ -239,8 +238,8 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
struct timezone tz;
struct timeval tv; /* Used as a placebo; some systems don't like NULL */
- if (HDgettimeofday(&tv, &tz) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information");
+ if(HDgettimeofday(&tv, &tz) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information")
the_time -= tz.tz_minuteswest * 60 - (tm.tm_isdst ? 3600 : 0);
}
@@ -254,20 +253,20 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
*/
/* Irix64 */
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information");
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information")
#endif
/* The return value */
- if (NULL==(mesg = H5FL_MALLOC(time_t)))
- HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
+ if(NULL == (mesg = H5FL_MALLOC(time_t)))
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
*mesg = the_time;
/* Set return value */
- ret_value=mesg;
+ ret_value = mesg;
done:
- FUNC_LEAVE_NOAPI(ret_value);
-}
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_mtime_decode() */
/*-------------------------------------------------------------------------