From a8df8470bbd6d5abd52f8c53b4d63e8add59adcc Mon Sep 17 00:00:00 2001
From: Dana Robinson <derobins@hdfgroup.org>
Date: Sun, 6 Sep 2015 19:22:07 -0500
Subject: [svn-r27689] Merge of r27459 and r27460 from trunk

Minor warning cleanup

(27459) Renamed a few "h5tri_t extended" variables to "h5tri_t was_extended".
Apparently, "extended" is a typedef name someplace in the headers used on
Solaris, which causes potentially confusing warnings to be emitted.

(27460) Minor code cleanup in test/trefer.c

- Fixed an out-of-range char assignment.
- Added a couple of malloc() casts.

Tested on: h5committest
---
 src/H5Fcwfs.c  |  8 +++----
 src/H5HL.c     | 10 ++++-----
 src/H5MFaggr.c | 12 +++++-----
 src/H5Oalloc.c |  8 +++----
 test/mf.c      | 70 +++++++++++++++++++++++++++++-----------------------------
 test/trefer.c  |  6 ++---
 6 files changed, 57 insertions(+), 57 deletions(-)

diff --git a/src/H5Fcwfs.c b/src/H5Fcwfs.c
index d0688f7..36f0a93 100644
--- a/src/H5Fcwfs.c
+++ b/src/H5Fcwfs.c
@@ -210,12 +210,12 @@ H5F_cwfs_find_free_heap(H5F_t *f, hid_t dxpl_id, size_t need, haddr_t *addr)
             new_need = MAX(H5HG_SIZE(f->shared->cwfs[cwfsno]), new_need);
 
             if((H5HG_SIZE(f->shared->cwfs[cwfsno]) + new_need) <= H5HG_MAXSIZE) {
-                htri_t extended;        /* Whether the heap was extended */
+                htri_t was_extended;        /* Whether the heap was extended */
 
-                extended = H5MF_try_extend(f, dxpl_id, H5FD_MEM_GHEAP, H5HG_ADDR(f->shared->cwfs[cwfsno]), (hsize_t)H5HG_SIZE(f->shared->cwfs[cwfsno]), (hsize_t)new_need);
-                if(extended < 0)
+                was_extended = H5MF_try_extend(f, dxpl_id, H5FD_MEM_GHEAP, H5HG_ADDR(f->shared->cwfs[cwfsno]), (hsize_t)H5HG_SIZE(f->shared->cwfs[cwfsno]), (hsize_t)new_need);
+                if(was_extended < 0)
                     HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "error trying to extend heap")
-                else if(extended == TRUE) {
+                else if(was_extended == TRUE) {
                     if(H5HG_extend(f, dxpl_id, H5HG_ADDR(f->shared->cwfs[cwfsno]), new_need) < 0)
                         HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to extend global heap collection")
                     *addr = H5HG_ADDR(f->shared->cwfs[cwfsno]);
diff --git a/src/H5HL.c b/src/H5HL.c
index b1b5b24..a5d01cd 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -758,7 +758,7 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void *
         size_t	need_more;      /* How much more space we need */
         size_t	new_dblk_size;  /* Final size of space allocated for heap data block */
         size_t	old_dblk_size;  /* Previous size of space allocated for heap data block */
-        htri_t	extended;       /* Whether the local heap's data segment on disk was extended */
+        htri_t  was_extended;   /* Whether the local heap's data segment on disk was extended */
 
         /* At least double the heap's size, making certain there's enough room
          * for the new object */
@@ -781,12 +781,12 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void *
 	H5_CHECK_OVERFLOW(new_dblk_size, size_t, hsize_t);
 
         /* Extend current heap if possible */
-	extended = H5MF_try_extend(f, dxpl_id, H5FD_MEM_LHEAP, heap->dblk_addr, (hsize_t)(heap->dblk_size), (hsize_t)need_more);
-        if(extended < 0)
+	was_extended = H5MF_try_extend(f, dxpl_id, H5FD_MEM_LHEAP, heap->dblk_addr, (hsize_t)(heap->dblk_size), (hsize_t)need_more);
+        if(was_extended < 0)
             HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, UFAIL, "error trying to extend heap")
 
-	/* Check if we extended the heap data block in file */
-	if(extended == TRUE) {
+        /* Check if we extended the heap data block in file */
+        if(was_extended == TRUE) {
             /* Check for prefix & data block contiguous */
             if(heap->single_cache_obj) {
                 /* Resize prefix+data block */
diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c
index 5c36302..02a1720 100644
--- a/src/H5MFaggr.c
+++ b/src/H5MFaggr.c
@@ -211,7 +211,7 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz
 
         /* Check if the space requested is larger than the space left in the block */
         if((size + aggr_frag_size) > aggr->size) {
-            htri_t  	extended = FALSE;   /* Whether the file was extended */
+            htri_t  	was_extended = FALSE;   /* Whether the file was extended */
 
             /* Check if the block asked for is too large for 'normal' aggregator block */
             if(size >= aggr->alloc_size) {
@@ -221,9 +221,9 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz
                 if(H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr))
                     HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space")
 
-		if ((aggr->addr > 0) && (extended = H5FD_try_extend(f->shared->lf, alloc_type, f, aggr->addr + aggr->size, ext_size)) < 0)
+		if ((aggr->addr > 0) && (was_extended = H5FD_try_extend(f->shared->lf, alloc_type, f, aggr->addr + aggr->size, ext_size)) < 0)
 		    HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space")
-		else if (extended) {
+		else if (was_extended) {
 		    /* aggr->size is unchanged */
 		    ret_value = aggr->addr + aggr_frag_size;
 		    aggr->addr += ext_size;
@@ -263,9 +263,9 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
                 if(H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr))
                     HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space")
 
-		if((aggr->addr > 0) && (extended = H5FD_try_extend(f->shared->lf, alloc_type, f, aggr->addr + aggr->size, ext_size)) < 0)
+		if((aggr->addr > 0) && (was_extended = H5FD_try_extend(f->shared->lf, alloc_type, f, aggr->addr + aggr->size, ext_size)) < 0)
 		    HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space")
-		else if (extended) {
+		else if (was_extended) {
 		    aggr->addr += aggr_frag_size;
 		    aggr->size += (ext_size - aggr_frag_size);
 		    aggr->tot_size += ext_size;
@@ -313,7 +313,7 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC);
 		    HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment")
 
 	    /* Freeing any possible fragment due to alignment in the block after extension */
-	    if(extended && aggr_frag_size)
+	    if(was_extended && aggr_frag_size)
 		if(H5MF_xfree(f, alloc_type, dxpl_id, aggr_frag_addr, aggr_frag_size) < 0)
 		    HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment")
         } /* end if */
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index 76f392d..e9d4f85 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -514,7 +514,7 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
     size_t      aligned_size = H5O_ALIGN_OH(oh, size);
     uint8_t     *old_image;     /* Old address of chunk's image in memory */
     size_t      old_size;       /* Old size of chunk */
-    htri_t      extended;       /* If chunk can be extended */
+    htri_t      was_extended;   /* If chunk can be extended */
     size_t      extend_msg;     /* Index of null message to extend */
     hbool_t     extended_msg = FALSE;   /* Whether an existing message was extended */
     uint8_t     new_size_flags = 0;     /* New chunk #0 size flags */
@@ -592,11 +592,11 @@ H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno,
 	HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk")
 
     /* Determine whether the chunk can be extended */
-    extended = H5MF_try_extend(f, dxpl_id, H5FD_MEM_OHDR, oh->chunk[chunkno].addr,
+    was_extended = H5MF_try_extend(f, dxpl_id, H5FD_MEM_OHDR, oh->chunk[chunkno].addr,
                                  (hsize_t)(oh->chunk[chunkno].size), (hsize_t)(delta + extra_prfx_size));
-    if(extended < 0) /* error */
+    if(was_extended < 0) /* error */
         HGOTO_ERROR(H5E_OHDR, H5E_CANTEXTEND, FAIL, "can't tell if we can extend chunk")
-    else if(extended == FALSE)     /* can't extend -- we are done */
+    else if(was_extended == FALSE)     /* can't extend -- we are done */
         HGOTO_DONE(FALSE)
 
     /* Adjust object header prefix flags */
diff --git a/test/mf.c b/test/mf.c
index b5d1255..b037fc9 100644
--- a/test/mf.c
+++ b/test/mf.c
@@ -589,12 +589,12 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
     char		filename[FILENAME_LEN]; 	/* Filename to use */
     H5F_t		*f = NULL;              	/* Internal file object pointer */
     h5_stat_size_t      file_size, new_file_size;  	/* File size */
-    H5FD_mem_t 		type;
+    H5FD_mem_t  type;
     haddr_t		addr;
-    htri_t      	extended;
-    haddr_t 		ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF;
-    hsize_t 		ma_size=0, new_ma_size=0;
-    hbool_t             contig_addr_vfd;        /* Whether VFD used has a contigous address space */
+    htri_t      was_extended;
+    haddr_t 	ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF;
+    hsize_t 	ma_size=0, new_ma_size=0;
+    hbool_t     contig_addr_vfd;        /* Whether VFD used has a contigous address space */
 
     TESTING("H5MF_try_extend() of file allocation: test 1");
 
@@ -666,9 +666,9 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
             FAIL_STACK_ERROR
 
         /* should succeed */
-        extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)TEST_BLOCK_SIZE50);
+        was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)TEST_BLOCK_SIZE50);
 
-        if(extended <= 0)
+        if(was_extended <= 0)
             TEST_ERROR
 
         /* nothing should be changed in meta_aggr */
@@ -725,10 +725,10 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl)
         if(new_ma_addr != ma_addr)
             TEST_ERROR
 
-        extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr, (hsize_t)(TEST_BLOCK_SIZE30-10), (hsize_t)(TEST_BLOCK_SIZE50));
+        was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr, (hsize_t)(TEST_BLOCK_SIZE30-10), (hsize_t)(TEST_BLOCK_SIZE50));
 
         /* should not succeed */
-        if(extended > 0)
+        if(was_extended > 0)
             TEST_ERROR
 
         /* nothing should be changed in meta_aggr */
@@ -1435,7 +1435,7 @@ test_mf_fs_extend(hid_t fapl)
     frspace_state_t 	state;          	/* State of free space*/
     H5MF_sect_ud_t 	udata;
     H5FS_section_info_t *node;
-    htri_t      	extended;
+    htri_t      	was_extended;
 
     TESTING("H5MF_try_extend() of free-space manager:test 1");
 
@@ -1529,10 +1529,10 @@ test_mf_fs_extend(hid_t fapl)
         TEST_ERROR
 
     /* Try to extend the allocated block */
-    extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)TEST_BLOCK_SIZE50);
+    was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)TEST_BLOCK_SIZE50);
 
     /* should succeed */
-    if(extended <= 0)
+    if(was_extended <= 0)
 	TEST_ERROR
 
     /* Section B is removed from free-space manager */
@@ -1647,10 +1647,10 @@ test_mf_fs_extend(hid_t fapl)
         TEST_ERROR
 
     /* Try to extend the allocated block */
-    extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)(TEST_BLOCK_SIZE50+10));
+    was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)(TEST_BLOCK_SIZE50+10));
 
     /* Should not be able to extend the allocated block */
-    if(extended)
+    if(was_extended)
 	TEST_ERROR
 
     /* free-space info should remain the same */
@@ -1760,10 +1760,10 @@ test_mf_fs_extend(hid_t fapl)
         TEST_ERROR
 
     /* Try to extend the allocated block */
-    extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)(TEST_BLOCK_SIZE40));
+    was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)(TEST_BLOCK_SIZE40));
 
     /* Should succeed in extending the allocated block */
-    if(extended <=0)
+    if(was_extended <=0)
 	TEST_ERROR
 
     /* Should have 1 section of size=10 left in free-space manager */
@@ -1873,10 +1873,10 @@ test_mf_fs_extend(hid_t fapl)
         TEST_ERROR
 
     /* Try to extend the allocated block */
-    extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)(TEST_BLOCK_SIZE30-10), (hsize_t)TEST_BLOCK_SIZE50);
+    was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)(TEST_BLOCK_SIZE30-10), (hsize_t)TEST_BLOCK_SIZE50);
 
     /* Should not succeed in extending the allocated block */
-    if(extended)
+    if(was_extended)
 	TEST_ERROR
 
     /* Free-space info should be the same */
@@ -3222,7 +3222,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
     haddr_t		new_addr, addr, saddr;
     haddr_t 		ma_addr=HADDR_UNDEF, new_ma_addr=HADDR_UNDEF, sdata_addr=HADDR_UNDEF;
     hsize_t 		ma_size=0, new_ma_size=0, sdata_size=0;
-    htri_t      	extended;
+    htri_t      	was_extended;
     hbool_t             contig_addr_vfd;        /* Whether VFD used has a contigous address space */
 
     TESTING("H5MF_try_extend() of meta/sdata aggregator: test 1");
@@ -3267,10 +3267,10 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
         new_addr = addr - 10;
 
         /* Try to extend the block by an amount < (% * aggr->alloc_size) */
-        extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE50));
+        was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE50));
 
         /* should succeed */
-        if(!extended)
+        if(!was_extended)
             TEST_ERROR
 
         H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
@@ -3283,10 +3283,10 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
         H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE50);
 
         /* Try to extend the block by an amount > (% * aggr->alloc_size) but amount < aggr->alloc_size */
-        extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE700));
+        was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE700));
 
         /* should succeed */
-        if(!extended)
+        if(!was_extended)
             TEST_ERROR
 
         H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
@@ -3299,10 +3299,10 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
         H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE700);
 
         /* Try to extend the block by an amount > (% * aggr->alloc_size) but amount > aggr->alloc_size */
-        extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE2058));
+        was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE2058));
 
         /* should succeed */
-        if(!extended)
+        if(!was_extended)
             TEST_ERROR
 
         H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
@@ -3365,9 +3365,9 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
         new_addr = addr - 10;
 
         /* should be able to fulfill request from the aggreqator itself */
-        extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE50));
+        was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE50));
 
-        if(!extended)
+        if(!was_extended)
             TEST_ERROR
 
         H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
@@ -3435,9 +3435,9 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl)
         new_addr = addr - 10;
 
         /* unable to fulfill request from the aggreqator itself */
-        extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE50));
+        was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE50));
 
-        if(extended)
+        if(was_extended)
             TEST_ERROR
 
         H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size);
@@ -3753,7 +3753,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
     haddr_t		addr1, addr2;
     haddr_t 		ma_addr=HADDR_UNDEF;
     hsize_t 		ma_size=0;
-    htri_t 		extended;
+    htri_t 		was_extended;
     frspace_state_t 	state;
     hsize_t		alignment=0, mis_align=0, tmp=0, accum=0;
     hbool_t             have_alloc_vfd;        /* Whether VFD used has an 'alloc' callback */
@@ -3959,9 +3959,9 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
             FAIL_STACK_ERROR
 
         /* try to extend the block */
-        extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr1, (hsize_t)TEST_BLOCK_SIZE50, (hsize_t)TEST_BLOCK_SIZE30);
+        was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr1, (hsize_t)TEST_BLOCK_SIZE50, (hsize_t)TEST_BLOCK_SIZE30);
 
-        if (extended <=0) TEST_ERROR
+        if (was_extended <=0) TEST_ERROR
 
         if(H5Fclose(file) < 0)
             FAIL_STACK_ERROR
@@ -4033,7 +4033,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
     haddr_t		addr;
     frspace_state_t 	state;
     H5MF_sect_ud_t 	udata;
-    htri_t 		extended;
+    htri_t 		was_extended;
     hsize_t		alignment=0, tmp=0, mis_align=0;
     hbool_t             have_alloc_vfd;        /* Whether VFD used has an 'alloc' callback */
 
@@ -4178,9 +4178,9 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl)
         TEST_ERROR
 
     /* try to extend the block */
-    extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr, (hsize_t)TEST_BLOCK_SIZE600, (hsize_t)TEST_BLOCK_SIZE200);
+    was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr, (hsize_t)TEST_BLOCK_SIZE600, (hsize_t)TEST_BLOCK_SIZE200);
 
-    if (extended <=0) TEST_ERROR
+    if (was_extended <=0) TEST_ERROR
 
     /* space should be decreased by 200, # of sections remain the same */
     state.tot_space -= TEST_BLOCK_SIZE200;
diff --git a/test/trefer.c b/test/trefer.c
index c99d7ee..93c7dd4 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -493,7 +493,7 @@ test_reference_region(void)
     hsize_t	high[SPACE2_RANK];	/* Selection bounds */
     hdset_reg_ref_t      *wbuf,		/* buffer to write to disk */
                *rbuf;       /* buffer read from disk */
-    hdset_reg_ref_t  nvrbuf[3]={{0},{101},{1000000000}}; /* buffer with non-valid refs */
+    hdset_reg_ref_t  nvrbuf[3]={{0},{101},{255}}; /* buffer with non-valid refs */
     uint8_t    *dwbuf,      /* Buffer for writing numeric data to disk */
                *drbuf;      /* Buffer for reading numeric data from disk */
     uint8_t    *tu8;        /* Temporary pointer to uint8 data */
@@ -716,7 +716,7 @@ test_reference_region(void)
     VERIFY(ret, 36, "H5Sget_select_npoints");
     ret = (int)H5Sget_select_hyper_nblocks(sid2);
     VERIFY(ret, 1, "H5Sget_select_hyper_nblocks");
-    coords = HDmalloc(ret * SPACE2_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
+    coords = (hsize_t *)HDmalloc(ret * SPACE2_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
     ret = H5Sget_select_hyper_blocklist(sid2, (hsize_t)0, (hsize_t)ret, coords);
     CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
     VERIFY(coords[0], 2, "Hyperslab Coordinates");
@@ -744,7 +744,7 @@ test_reference_region(void)
     VERIFY(ret, 10, "H5Sget_select_npoints");
     ret = (int)H5Sget_select_elem_npoints(sid2);
     VERIFY(ret, 10, "H5Sget_select_elem_npoints");
-    coords = HDmalloc(ret * SPACE2_RANK * sizeof(hsize_t)); /* allocate space for the element points */
+    coords = (hsize_t *)HDmalloc(ret * SPACE2_RANK * sizeof(hsize_t)); /* allocate space for the element points */
     ret = H5Sget_select_elem_pointlist(sid2, (hsize_t)0, (hsize_t)ret, coords);
     CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
     VERIFY(coords[0], coord1[0][0], "Element Coordinates");
-- 
cgit v0.12