From 0bbb6c16737f6477d54b8722d0ffcf650f73b960 Mon Sep 17 00:00:00 2001 From: Oren Ben-Kiki Date: Tue, 4 Jun 2024 11:06:23 +0300 Subject: [PATCH] Do not try to memory-map zero-size data. --- docs/v0.1.0/.documenter-siteinfo.json | 2 +- src/h5df_format.jl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/v0.1.0/.documenter-siteinfo.json b/docs/v0.1.0/.documenter-siteinfo.json index 763293b..a748a5f 100644 --- a/docs/v0.1.0/.documenter-siteinfo.json +++ b/docs/v0.1.0/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.0","generation_timestamp":"2024-06-04T08:50:31","documenter_version":"1.4.1"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.0","generation_timestamp":"2024-06-04T11:06:02","documenter_version":"1.4.1"}} \ No newline at end of file diff --git a/src/h5df_format.jl b/src/h5df_format.jl index 6adc9a9..f006caf 100644 --- a/src/h5df_format.jl +++ b/src/h5df_format.jl @@ -879,7 +879,7 @@ function Formats.format_get_matrix( end function dataset_as_vector(dataset::HDF5.Dataset)::Tuple{StorageVector, CacheType} - if HDF5.ismmappable(dataset) && HDF5.iscontiguous(dataset) + if HDF5.ismmappable(dataset) && HDF5.iscontiguous(dataset) && length(dataset) > 0 return (HDF5.readmmap(dataset), MappedData) else return (read(dataset), MemoryData) @@ -887,7 +887,7 @@ function dataset_as_vector(dataset::HDF5.Dataset)::Tuple{StorageVector, CacheTyp end function dataset_as_matrix(dataset::HDF5.Dataset)::Tuple{StorageMatrix, CacheType} - if HDF5.ismmappable(dataset) && HDF5.iscontiguous(dataset) + if HDF5.ismmappable(dataset) && HDF5.iscontiguous(dataset) && length(dataset) > 0 return (HDF5.readmmap(dataset), MappedData) else return (read(dataset), MemoryData) # untested