From 2e74c7374eaf0252cea21993edf2f1ffbfc7dd13 Mon Sep 17 00:00:00 2001 From: Vindaar Date: Mon, 11 Mar 2024 14:15:59 +0100 Subject: [PATCH] adjust `BufferWrapper` destructor for old Nim --- src/nimhdf5/hdf5_json.nim | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/nimhdf5/hdf5_json.nim b/src/nimhdf5/hdf5_json.nim index def0668..d2cc71d 100644 --- a/src/nimhdf5/hdf5_json.nim +++ b/src/nimhdf5/hdf5_json.nim @@ -14,9 +14,14 @@ type MemberSizeTable = OrderedTable[string, (int, int, DtypeKind)] -proc `=destroy`(buf: BufferWrapperObj) = - buf.cleanup(buf.buf, buf.dtypeID, buf.dspaceID) - `=destroy`(buf.buf) +when (NimMajor, NimMinor, NimPatch) >= (2, 0, 0): + proc `=destroy`(buf: BufferWrapperObj) = + buf.cleanup(buf.buf, buf.dtypeID, buf.dspaceID) + `=destroy`(buf.buf) +else: + proc `=destroy`(buf: var BufferWrapperObj) = + buf.cleanup(buf.buf, buf.dtypeID, buf.dspaceID) + `=destroy`(buf.buf) ## Code to read also datasets and groups as JSON: