Skip to content

Commit

Permalink
Merge pull request #135 from grimbough/issues-from-LTLA
Browse files Browse the repository at this point in the history
Fixing issues from LTLA
  • Loading branch information
grimbough authored Nov 29, 2023
2 parents cb102ba + a8be09b commit 12839c4
Show file tree
Hide file tree
Showing 13 changed files with 328 additions and 272 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
on:
push:
branches:
- master
- devel
pull_request:
branches:
- master
- devel

name: R-CMD-check
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: rhdf5
Type: Package
Title: R Interface to HDF5
Version: 2.45.2
Version: 2.47.1
Authors@R: c(person("Bernd", "Fischer", role = c("aut")),
person("Mike", "Smith",
role=c("aut", "cre"),
Expand Down
18 changes: 18 additions & 0 deletions inst/NEWS.Rd
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
\name{NEWS}
\title{News for Package 'rhdf5'}

\section{Changes in version 2.48.0}{

\subsection{Bug fixes}{
\itemize{
\item Addressed a bug where fixed length string attributes would be one
character shorter than they should be. Backported to rhdf5 2.47.1.
(Thanks to Aaron Lun @LTLA for reporting this
https://github.com/grimbough/rhdf5/issues/132).
\item Fixed an issue where zero length datasets of uint32, int64 or uint64
datatypes could not be read. This would fail with an error message saying
there was not enough memory. Backported to rhdf5 2.47.1.
(Thanks to Aaron Lun @LTLA for reporting this
https://github.com/grimbough/rhdf5/issues/134).
}
}
}


\section{Changes in version 2.46.0}{

\subsection{CHANGES}{
Expand Down
23 changes: 1 addition & 22 deletions src/H5A.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,28 +441,7 @@ SEXP _H5Awrite( SEXP _attr_id, SEXP _buf) {
break;
case STRSXP :
mem_type_id = H5Aget_type(attr_id);
size_t stsize;
if (H5Tis_variable_str(mem_type_id)) {
const char ** strbuf = (const char **)R_alloc(LENGTH(_buf),sizeof(const char*));
for (int i=0; i < LENGTH(_buf); i++) {
strbuf[i] = CHAR(STRING_ELT(_buf,i));
}
buf = strbuf;
} else {
stsize = H5Tget_size( mem_type_id );
char * strbuf = (char *)R_alloc(LENGTH(_buf),stsize);
int z=0;
int j;
for (int i=0; i < LENGTH(_buf); i++) {
for (j=0; (j < LENGTH(STRING_ELT(_buf,i))) & (j < (stsize-1)); j++) {
strbuf[z++] = CHAR(STRING_ELT(_buf,i))[j];
}
for (; j < stsize; j++) {
strbuf[z++] = '\0';
}
}
buf = strbuf;
}
buf = read_string_datatype(mem_type_id, _buf);
break;
case S4SXP :
if(R_check_class_etc(_buf, H5Ref) >= 0) {
Expand Down
1 change: 1 addition & 0 deletions src/H5A.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "HandleList.h"
#include "printdatatype.h"
#include "bit64conversion.h"
#include "utils.h"

/*################################*/
/* functions */
Expand Down
Loading

0 comments on commit 12839c4

Please sign in to comment.