summaryrefslogtreecommitdiffstats
path: root/src/H5HL.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-04-03 21:11:05 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-04-03 21:11:05 (GMT)
commit92571bbe1d77c74ddefeeba6ac0b2097593c058d (patch)
tree610c3a65c2d3fa5dabfda39635770029bb734646 /src/H5HL.c
parenta780cdd178f849afbc8cbb24e416eef733cbc9f2 (diff)
downloadhdf5-92571bbe1d77c74ddefeeba6ac0b2097593c058d.zip
hdf5-92571bbe1d77c74ddefeeba6ac0b2097593c058d.tar.gz
hdf5-92571bbe1d77c74ddefeeba6ac0b2097593c058d.tar.bz2
[svn-r336] Changes since 19980402
---------------------- ./MANIFEST ./test/Makefile.in ./test/shtype.c [NEW] Added some tests for shared data types. ./configure.in Removed MF and HL from the default debug list since. MF because it hasn't been implemented yet and HL because it produces lots of annoying messages about adjusting the size of local heaps. ./src/H5F.c ./src/H5T.c ./src/H5Tprivate.h Fixed a bug with opening the same file twice. The first close on the file_id incorrectly closed shared data structs. Closing a file now correctly unshares data types that might be pointing into that file. ./src/H5T.c ./src/H5Tpublic.h Added an H5Tis_shared(). The caller supplies a file and a data type and the function returns true if the data type is currently marked for sharing in that file. ./src/H5AC.c ./src/H5F.c ./src/H5HL.c ./src/H5HG.c ./src/H5MF.c ./src/H5O.c We now detect errors sooner when writing to a read-only file. In the past, the error might not show up until the cached item was flushed, and it was sometimes possible to not even get an error! ./src/H5I.c ./src/H5Iprivate.h If the search function fails then H5I_search() returns failure. Also, the first argument for the search function isn't const anymore because we might want the search to have side effects (like calling H5T_unshare() for all shared data types whose file just closed).
Diffstat (limited to 'src/H5HL.c')
-rw-r--r--src/H5HL.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/H5HL.c b/src/H5HL.c
index 8c141a0..d7f83c0 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -537,6 +537,10 @@ H5HL_insert(H5F_t *f, const haddr_t *addr, size_t buf_size, const void *buf)
assert(addr && H5F_addr_defined(addr));
assert(buf_size > 0);
assert(buf);
+ if (0==(f->intent & H5F_ACC_RDWR)) {
+ HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, (size_t)(-1),
+ "no write intent on file");
+ }
if (NULL == (heap = H5AC_find(f, H5AC_LHEAP, addr, NULL, NULL))) {
HRETURN_ERROR(H5E_HEAP, H5E_CANTLOAD, (size_t)(-1),
@@ -686,6 +690,10 @@ H5HL_write(H5F_t *f, const haddr_t *addr, size_t offset, size_t size,
assert(addr && H5F_addr_defined(addr));
assert(buf);
assert (offset==H5HL_ALIGN (offset));
+ if (0==(f->intent & H5F_ACC_RDWR)) {
+ HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL,
+ "no write intent on file");
+ }
if (NULL == (heap = H5AC_find(f, H5AC_LHEAP, addr, NULL, NULL))) {
HRETURN_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL,
@@ -741,8 +749,12 @@ H5HL_remove(H5F_t *f, const haddr_t *addr, size_t offset, size_t size)
assert(addr && H5F_addr_defined(addr));
assert(size > 0);
assert (offset==H5HL_ALIGN (offset));
- size = H5HL_ALIGN (size);
+ if (0==(f->intent & H5F_ACC_RDWR)) {
+ HRETURN_ERROR (H5E_HEAP, H5E_WRITEERROR, FAIL,
+ "no write intent on file");
+ }
+ size = H5HL_ALIGN (size);
if (NULL == (heap = H5AC_find(f, H5AC_LHEAP, addr, NULL, NULL))) {
HRETURN_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL,
"unable to load heap");